Browse Source

fix: process instance version page bug (#5319)

Co-authored-by: wen-hemin <wenhemin@apache.com>
pull/3/MERGE
wen-hemin 4 years ago committed by GitHub
parent
commit
2a81b29b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
  2. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  3. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  4. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
  5. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
  6. 5
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/versions.vue
  7. 10
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
  8. 4
      dolphinscheduler-ui/src/js/conf/home/store/dag/state.js

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java

@ -275,14 +275,14 @@ public class ProcessDefinitionController extends BaseController {
* @param projectName the process definition project name
* @param pageNo the process definition version list current page number
* @param pageSize the process definition version list page size
* @param processDefinitionId the process definition id
* @param processDefinitionCode the process definition code
* @return the process definition version list
*/
@ApiOperation(value = "queryProcessDefinitionVersions", notes = "QUERY_PROCESS_DEFINITION_VERSIONS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/versions")
@ResponseStatus(HttpStatus.OK)
@ -291,11 +291,11 @@ public class ProcessDefinitionController extends BaseController {
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "processDefinitionId") int processDefinitionId) {
logger.info("login user {}, query process versions, project name: {}, pageNo: {}, pageSize: {}, processDefinitionId: {}",
loginUser.getUserName(), projectName, pageNo, pageSize, processDefinitionId);
@RequestParam(value = "processDefinitionCode") long processDefinitionCode) {
logger.info("login user {}, query process versions, project name: {}, pageNo: {}, pageSize: {}, processDefinitionCode: {}",
loginUser.getUserName(), projectName, pageNo, pageSize, processDefinitionCode);
Map<String, Object> result = processDefinitionService.queryProcessDefinitionVersions(loginUser
, projectName, pageNo, pageSize, processDefinitionId);
, projectName, pageNo, pageSize, processDefinitionCode);
return returnDataList(result);
}

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java

@ -276,17 +276,17 @@ public interface ProcessDefinitionService {
, int processDefinitionId, long version);
/**
* query the pagination versions info by one certain process definition id
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectName process definition project name
* @param pageNo page number
* @param pageSize page size
* @param processDefinitionId process definition id
* @param processDefinitionCode process definition code
* @return the pagination process definition versions info of the certain process definition
*/
Map<String, Object> queryProcessDefinitionVersions(User loginUser, String projectName,
int pageNo, int pageSize, int processDefinitionId);
int pageNo, int pageSize, long processDefinitionCode);
/**
* delete one certain process definition by version number and process definition id

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -1726,17 +1726,17 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
}
/**
* query the pagination versions info by one certain process definition id
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectName process definition project name
* @param pageNo page number
* @param pageSize page size
* @param processDefinitionId process definition id
* @param processDefinitionCode process definition code
* @return the pagination process definition versions info of the certain process definition
*/
@Override
public Map<String, Object> queryProcessDefinitionVersions(User loginUser, String projectName, int pageNo, int pageSize, int processDefinitionId) {
public Map<String, Object> queryProcessDefinitionVersions(User loginUser, String projectName, int pageNo, int pageSize, long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
@ -1758,7 +1758,7 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
return checkResult;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineId(processDefinitionId);
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode);
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java

@ -463,12 +463,16 @@ public class ProcessInstanceServiceImpl extends BaseServiceImpl implements Proce
processDefinition.getUserId());
setProcessInstance(processInstance, tenant, scheduleTime, locations,
connects, processInstanceJson, processData);
int update = processService.updateProcessInstance(processInstance);
int updateDefine = 1;
if (Boolean.TRUE.equals(syncDefine)) {
updateDefine = syncDefinition(loginUser, project, locations, connects,
processInstance, processDefinition, processData);
processInstance.setProcessDefinitionVersion(processDefinitionLogMapper.
queryMaxVersionForDefinition(processInstance.getProcessDefinitionCode()));
}
int update = processService.updateProcessInstance(processInstance);
if (update > 0 && updateDefine > 0) {
putMsg(result, Status.SUCCESS);
} else {

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@ -153,7 +153,7 @@
:visible.sync="drawer"
size=""
:with-header="false">
<m-versions :versionData = versionData @mVersionSwitchProcessDefinitionVersion="mVersionSwitchProcessDefinitionVersion" @mVersionGetProcessDefinitionVersionsPage="mVersionGetProcessDefinitionVersionsPage" @mVersionDeleteProcessDefinitionVersion="mVersionDeleteProcessDefinitionVersion" @closeVersion="closeVersion"></m-versions>
<m-versions :versionData = versionData :isInstance="type === 'instance'" @mVersionSwitchProcessDefinitionVersion="mVersionSwitchProcessDefinitionVersion" @mVersionGetProcessDefinitionVersionsPage="mVersionGetProcessDefinitionVersionsPage" @mVersionDeleteProcessDefinitionVersion="mVersionDeleteProcessDefinitionVersion" @closeVersion="closeVersion"></m-versions>
</el-drawer>
<el-drawer
:visible.sync="nodeDrawer"
@ -798,7 +798,7 @@
this.getProcessDefinitionVersionsPage({
pageNo: 1,
pageSize: 10,
processDefinitionId: this.urlParam.id
processDefinitionCode: this.store.state.dag.code
}).then(res => {
let processDefinitionVersions = res.data.lists
let total = res.data.totalCount

5
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/versions.vue

@ -50,7 +50,7 @@
:title="$t('Confirm Switch To This Version?')"
@onConfirm="_mVersionSwitchProcessDefinitionVersion(scope.row)"
>
<el-button :disabled="versionData.processDefinition.releaseState === 'ONLINE' || scope.row.version === versionData.processDefinition.version" type="primary" size="mini" icon="el-icon-warning" circle slot="reference"></el-button>
<el-button :disabled="versionData.processDefinition.releaseState === 'ONLINE' || scope.row.version === versionData.processDefinition.version || isInstance" type="primary" size="mini" icon="el-icon-warning" circle slot="reference"></el-button>
</el-popconfirm>
</el-tooltip>
<el-tooltip :content="$t('Delete')" placement="top">
@ -62,7 +62,7 @@
:title="$t('Delete?')"
@onConfirm="_mVersionDeleteProcessDefinitionVersion(scope.row,scope.row.id)"
>
<el-button :disabled="scope.row.version === versionData.processDefinition.version" type="danger" size="mini" icon="el-icon-delete" circle slot="reference"></el-button>
<el-button :disabled="scope.row.version === versionData.processDefinition.version || isInstance" type="danger" size="mini" icon="el-icon-delete" circle slot="reference"></el-button>
</el-popconfirm>
</el-tooltip>
</template>
@ -110,6 +110,7 @@
}
},
props: {
isInstance: Boolean,
versionData: Object
},
methods: {

10
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@ -158,6 +158,10 @@ export default {
io.get(`projects/${state.projectName}/process/select-by-id`, {
processId: payload
}, res => {
// process definition code
state.code = res.data.code
// version
state.version = res.data.version
// name
state.name = res.data.name
// description
@ -166,8 +170,6 @@ export default {
state.connects = JSON.parse(res.data.connects)
// locations
state.locations = JSON.parse(res.data.locations)
// version
state.version = res.data.version
// Process definition
const processDefinitionJson = JSON.parse(res.data.processDefinitionJson)
// tasks info
@ -243,6 +245,10 @@ export default {
io.get(`projects/${state.projectName}/instance/select-by-id`, {
processInstanceId: payload
}, res => {
// code
state.code = res.data.processDefinitionCode
// version
state.version = res.data.processDefinitionVersion
// name
state.name = res.data.name
// desc

4
dolphinscheduler-ui/src/js/conf/home/store/dag/state.js

@ -21,6 +21,10 @@ import localStore from '@/module/util/localStorage'
const projectName = localStore.getItem('projectName')
export default {
// process definition code
code: '',
// process definition version
version: '',
// name
name: '',
// description

Loading…
Cancel
Save