Browse Source

[FixBug][JsonSplit] depend task, the field "process definition id" modify to "process definition code" (#5377)

* fix: depend task, the field "process definition id" modify to "process definition code"

* fix: depend task, the field "process definition id" modify to "process definition code"

Co-authored-by: wen-hemin <wenhemin@apache.com>
pull/3/MERGE
wen-hemin 3 years ago committed by GitHub
parent
commit
fd54dc0ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
  2. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
  3. 26
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  4. 12
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
  5. 26
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
  6. 50
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue
  7. 14
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue

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

@ -515,53 +515,53 @@ public class ProcessDefinitionController extends BaseController {
} }
/** /**
* get tasks list by process definition id * get tasks list by process definition code
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
* @param processDefinitionId process definition id * @param processDefinitionCode process definition code
* @return task list * @return task list
*/ */
@ApiOperation(value = "getNodeListByDefinitionId", notes = "GET_NODE_LIST_BY_DEFINITION_ID_NOTES") @ApiOperation(value = "getNodeListByDefinitionCode", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@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 = "100")
}) })
@GetMapping(value = "gen-task-list") @GetMapping(value = "gen-task-list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionId( public Result getNodeListByDefinitionCode(
@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionId") Integer processDefinitionId) throws Exception { @RequestParam("processDefinitionCode") Long processDefinitionCode) throws Exception {
logger.info("query task node name list by definitionId, login user:{}, project name:{}, id : {}", logger.info("query task node name list by definitionCode, login user:{}, project name:{}, code : {}",
loginUser.getUserName(), projectName, processDefinitionId); loginUser.getUserName(), projectName, processDefinitionCode);
Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionId(processDefinitionId); Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionCode(processDefinitionCode);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* get tasks list by process definition id * get tasks list by process definition code list
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectName project name
* @param processDefinitionIdList process definition id list * @param processDefinitionCodeList process definition code list
* @return node list data * @return node list data
*/ */
@ApiOperation(value = "getNodeListByDefinitionIdList", notes = "GET_NODE_LIST_BY_DEFINITION_ID_NOTES") @ApiOperation(value = "getNodeListByDefinitionCodeList", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionIdList", value = "PROCESS_DEFINITION_ID_LIST", required = true, type = "String") @ApiImplicitParam(name = "processDefinitionCodeList", value = "PROCESS_DEFINITION_CODE_LIST", required = true, type = "String")
}) })
@GetMapping(value = "get-task-list") @GetMapping(value = "get-task-list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionIdList( public Result getNodeListByDefinitionCodeList(
@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam("processDefinitionIdList") String processDefinitionIdList) { @RequestParam("processDefinitionCodeList") String processDefinitionCodeList) {
logger.info("query task node name list by definitionId list, login user:{}, project name:{}, id list: {}", logger.info("query task node name list by definitionId list, login user:{}, project name:{}, code list: {}",
loginUser.getUserName(), projectName, processDefinitionIdList); loginUser.getUserName(), projectName, processDefinitionCodeList);
Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionIdList(processDefinitionIdList); Map<String, Object> result = processDefinitionService.getTaskNodeListByDefinitionCodeList(processDefinitionCodeList);
return returnDataList(result); return returnDataList(result);
} }

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

@ -231,18 +231,18 @@ public interface ProcessDefinitionService {
/** /**
* get task node details based on process definition * get task node details based on process definition
* *
* @param defineId define id * @param defineCode define code
* @return task node list * @return task node list
*/ */
Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId); Map<String, Object> getTaskNodeListByDefinitionCode(Long defineCode);
/** /**
* get task node details based on process definition * get task node details based on process definition
* *
* @param defineIdList define id list * @param defineCodeList define code list
* @return task node list * @return task node list
*/ */
Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList); Map<String, Object> getTaskNodeListByDefinitionCodeList(String defineCodeList);
/** /**
* query process definition all by project id * query process definition all by project id

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

@ -1130,17 +1130,16 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
/** /**
* get task node details based on process definition * get task node details based on process definition
* *
* @param defineId define id * @param defineCode define code
* @return task node list * @return task node list
*/ */
@Override public Map<String, Object> getTaskNodeListByDefinitionCode(Long defineCode) {
public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefinitionMapper.selectById(defineId); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(defineCode);
if (processDefinition == null) { if (processDefinition == null) {
logger.info("process define not exists"); logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineCode);
return result; return result;
} }
ProcessData processData = processService.genProcessData(processDefinition); ProcessData processData = processService.genProcessData(processDefinition);
@ -1164,24 +1163,23 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
/** /**
* get task node details based on process definition * get task node details based on process definition
* *
* @param defineIdList define id list * @param defineCodeList define code list
* @return task node list * @return task node list
*/ */
@Override @Override
public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) { public Map<String, Object> getTaskNodeListByDefinitionCodeList(String defineCodeList) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>(); Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>();
String[] idList = defineIdList.split(","); String[] codeArr = defineCodeList.split(",");
List<Integer> idIntList = new ArrayList<>(); List<Long> codeList = new ArrayList<>();
for (String definitionId : idList) { for (String definitionCode : codeArr) {
idIntList.add(Integer.parseInt(definitionId)); codeList.add(Long.parseLong(definitionCode));
} }
Integer[] idArray = idIntList.toArray(new Integer[0]); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(codeList);
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryDefinitionListByIdList(idArray);
if (CollectionUtils.isEmpty(processDefinitionList)) { if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists"); logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineCodeList);
return result; return result;
} }

12
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java

@ -301,13 +301,13 @@ public class ProcessDefinitionControllerTest {
@Test @Test
public void testGetNodeListByDefinitionId() throws Exception { public void testGetNodeListByDefinitionId() throws Exception {
String projectName = "test"; String projectName = "test";
int id = 1; Long code = 1L;
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.getTaskNodeListByDefinitionId(id)).thenReturn(result); Mockito.when(processDefinitionService.getTaskNodeListByDefinitionCode(code)).thenReturn(result);
Result response = processDefinitionController.getNodeListByDefinitionId(user, projectName, id); Result response = processDefinitionController.getNodeListByDefinitionCode(user, projectName, code);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
} }
@ -315,13 +315,13 @@ public class ProcessDefinitionControllerTest {
@Test @Test
public void testGetNodeListByDefinitionIdList() throws Exception { public void testGetNodeListByDefinitionIdList() throws Exception {
String projectName = "test"; String projectName = "test";
String idList = "1,2,3"; String codeList = "1,2,3";
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS); putMsg(result, Status.SUCCESS);
Mockito.when(processDefinitionService.getTaskNodeListByDefinitionIdList(idList)).thenReturn(result); Mockito.when(processDefinitionService.getTaskNodeListByDefinitionCodeList(codeList)).thenReturn(result);
Result response = processDefinitionController.getNodeListByDefinitionIdList(user, projectName, idList); Result response = processDefinitionController.getNodeListByDefinitionCodeList(user, projectName, codeList);
Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue());
} }

26
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java

@ -61,6 +61,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -700,41 +701,42 @@ public class ProcessDefinitionServiceTest {
@Test @Test
public void testGetTaskNodeListByDefinitionId() { public void testGetTaskNodeListByDefinitionId() {
//process definition not exist //process definition not exist
Mockito.when(processDefineMapper.selectById(46)).thenReturn(null); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(null);
Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionCode(46L);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS)); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
//process data null //process data null
ProcessDefinition processDefinition = getProcessDefinition(); ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionCode(46L);
Assert.assertEquals(Status.DATA_IS_NOT_VALID, successRes.get(Constants.STATUS)); Assert.assertEquals(Status.DATA_IS_NOT_VALID, successRes.get(Constants.STATUS));
//success //success
Mockito.when(processService.genProcessData(Mockito.any())).thenReturn(new ProcessData()); Mockito.when(processService.genProcessData(Mockito.any())).thenReturn(new ProcessData());
Mockito.when(processDefineMapper.selectById(46)).thenReturn(processDefinition); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition);
Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionId(46); Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionCode(46L);
Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS)); Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS));
} }
@Test @Test
public void testGetTaskNodeListByDefinitionIdList() { public void testGetTaskNodeListByDefinitionIdList() {
//process definition not exist //process definition not exist
String defineIdList = "46"; String defineCodeList = "46";
Integer[] idArray = {46}; Long[] codeArray = {46L};
Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(null); List<Long> codeList = Arrays.asList(codeArray);
Map<String, Object> processNotExistRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList); Mockito.when(processDefineMapper.queryByCodes(codeList)).thenReturn(null);
Map<String, Object> processNotExistRes = processDefinitionService.getTaskNodeListByDefinitionCodeList(defineCodeList);
Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS)); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS));
//process definition exist //process definition exist
ProcessDefinition processDefinition = getProcessDefinition(); ProcessDefinition processDefinition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>(); List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition); processDefinitionList.add(processDefinition);
Mockito.when(processDefineMapper.queryDefinitionListByIdList(idArray)).thenReturn(processDefinitionList); Mockito.when(processDefineMapper.queryByCodes(codeList)).thenReturn(processDefinitionList);
ProcessData processData = getProcessData(); ProcessData processData = getProcessData();
Mockito.when(processService.genProcessData(processDefinition)).thenReturn(processData); Mockito.when(processService.genProcessData(processDefinition)).thenReturn(processData);
Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionIdList(defineIdList); Map<String, Object> successRes = processDefinitionService.getTaskNodeListByDefinitionCodeList(defineCodeList);
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
} }

50
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue

@ -20,7 +20,7 @@
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.projectId" @change="v => _onChangeProjectId(v, $index)" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.projectId" @change="v => _onChangeProjectId(v, $index)" size="small">
<el-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label"></el-option> <el-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select> </el-select>
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.definitionId" @change="v => _onChangeDefinitionId(v, $index)" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.definitionCode" @change="v => _onChangeDefinitionCode(v, $index)" size="small">
<el-option v-for="item in el.definitionList" :key="item.value" :value="item.value" :label="item.label"></el-option> <el-option v-for="item in el.definitionList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select> </el-select>
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.depTasks" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.depTasks" size="small">
@ -87,7 +87,7 @@
let projectId = this.projectList[0].value let projectId = this.projectList[0].value
this._getProcessByProjectId(projectId).then(definitionList => { this._getProcessByProjectId(projectId).then(definitionList => {
// dependItemList index // dependItemList index
let is = (value) => _.some(this.dependItemList, { definitionId: value }) let is = (value) => _.some(this.dependItemList, { definitionCode: value })
let noArr = _.filter(definitionList, v => !is(v.value)) let noArr = _.filter(definitionList, v => !is(v.value))
let value = noArr[0] && noArr[0].value || null let value = noArr[0] && noArr[0].value || null
let val = value || definitionList[0].value let val = value || definitionList[0].value
@ -124,26 +124,12 @@
resolve() resolve()
}) })
}, },
/**
* get processlist
*/
_getProcessList () {
return new Promise((resolve, reject) => {
let definitionList = _.map(_.cloneDeep(this.store.state.dag.processListS), v => {
return {
value: v.id,
label: v.name
}
})
resolve(definitionList)
})
},
_getProcessByProjectId (id) { _getProcessByProjectId (id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => {
let definitionList = _.map(_.cloneDeep(res), v => { let definitionList = _.map(_.cloneDeep(res), v => {
return { return {
value: v.id, value: v.code,
label: v.name label: v.name
} }
}) })
@ -154,14 +140,14 @@
/** /**
* get dependItemList * get dependItemList
*/ */
_getDependItemList (ids, is = true) { _getDependItemList (codes, is = true) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (is) { if (is) {
this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { this.store.dispatch('dag/getProcessTasksList', { processDefinitionCode: codes }).then(res => {
resolve(['ALL'].concat(_.map(res, v => v.name))) resolve(['ALL'].concat(_.map(res, v => v.name)))
}) })
} else { } else {
this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionIdList: ids }).then(res => { this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionCodeList: codes }).then(res => {
resolve(res) resolve(res)
}) })
} }
@ -173,17 +159,17 @@
_onChangeProjectId (value, itemIndex) { _onChangeProjectId (value, itemIndex) {
this._getProcessByProjectId(value).then(definitionList => { this._getProcessByProjectId(value).then(definitionList => {
/* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */ /* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */
let definitionId = definitionList[0].value let definitionCode = definitionList[0].value
this._getDependItemList(definitionId).then(depTasksList => { this._getDependItemList(definitionCode).then(depTasksList => {
let item = this.dependItemList[itemIndex] let item = this.dependItemList[itemIndex]
// init set depTasks All // init set depTasks All
item.depTasks = 'ALL' item.depTasks = 'ALL'
// set dependItemList item data // set dependItemList item data
this.$set(this.dependItemList, itemIndex, this._cpOldParams(value, definitionId, definitionList, depTasksList, item)) this.$set(this.dependItemList, itemIndex, this._cpOldParams(value, definitionCode, definitionList, depTasksList, item))
}) })
}) })
}, },
_onChangeDefinitionId (value, itemIndex) { _onChangeDefinitionCode (value, itemIndex) {
// get depItem list data // get depItem list data
this._getDependItemList(value).then(depTasksList => { this._getDependItemList(value).then(depTasksList => {
let item = this.dependItemList[itemIndex] let item = this.dependItemList[itemIndex]
@ -201,7 +187,7 @@
_rtNewParams (value, definitionList, depTasksList, projectId) { _rtNewParams (value, definitionList, depTasksList, projectId) {
return { return {
projectId: projectId, projectId: projectId,
definitionId: value, definitionCode: value,
// dependItem need private definitionList // dependItem need private definitionList
definitionList: definitionList, definitionList: definitionList,
depTasks: 'ALL', depTasks: 'ALL',
@ -215,7 +201,7 @@
_rtOldParams (value, definitionList, depTasksList, item) { _rtOldParams (value, definitionList, depTasksList, item) {
return { return {
projectId: item.projectId, projectId: item.projectId,
definitionId: value, definitionCode: value,
// dependItem need private definitionList // dependItem need private definitionList
definitionList: definitionList, definitionList: definitionList,
depTasks: item.depTasks || 'ALL', depTasks: item.depTasks || 'ALL',
@ -227,11 +213,11 @@
} }
}, },
_cpOldParams (value, definitionId, definitionList, depTasksList, item) { _cpOldParams (value, definitionCode, definitionList, depTasksList, item) {
return { return {
projectId: value, projectId: value,
definitionList: definitionList, definitionList: definitionList,
definitionId: definitionId, definitionCode: definitionCode,
depTasks: item.depTasks || 'ALL', depTasks: item.depTasks || 'ALL',
depTasksList: depTasksList, depTasksList: depTasksList,
cycle: item.cycle, cycle: item.cycle,
@ -266,13 +252,13 @@
}) })
}) })
} else { } else {
// get definitionId ids // get definitionCode codes
let ids = _.map(this.dependItemList, v => v.definitionId).join(',') let codes = _.map(this.dependItemList, v => v.definitionCode).join(',')
// get item list // get item list
this._getDependItemList(ids, false).then(res => { this._getDependItemList(codes, false).then(res => {
_.map(this.dependItemList, (v, i) => { _.map(this.dependItemList, (v, i) => {
this._getProcessByProjectId(v.projectId).then(definitionList => { this._getProcessByProjectId(v.projectId).then(definitionList => {
this.$set(this.dependItemList, i, this._rtOldParams(v.definitionId, definitionList, ['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), v)) this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, definitionList, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v))
}) })
}) })
}) })

14
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue

@ -112,7 +112,7 @@
this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => {
this.definitionList = _.map(_.cloneDeep(res), v => { this.definitionList = _.map(_.cloneDeep(res), v => {
return { return {
value: v.id, value: v.code,
label: v.name label: v.name
} }
}) })
@ -123,10 +123,10 @@
/** /**
* get dependItemList * get dependItemList
*/ */
_getDependItemList (ids, is = true) { _getDependItemList (codes, is = true) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (is) { if (is) {
this.store.dispatch('dag/getProcessTasksList', { processDefinitionId: ids }).then(res => { this.store.dispatch('dag/getProcessTasksList', { processDefinitionCodeList: codes }).then(res => {
resolve(['ALL'].concat(_.map(res, v => v.name))) resolve(['ALL'].concat(_.map(res, v => v.name)))
}) })
} }
@ -163,13 +163,13 @@
if (!this.dependItemList.length) { if (!this.dependItemList.length) {
this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams())) this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams()))
} else { } else {
// get definitionId ids // get definitionCode codes
let ids = _.map(this.dependItemList, v => v.definitionId).join(',') let codes = _.map(this.dependItemList, v => v.definitionCode).join(',')
// get item list // get item list
this._getDependItemList(ids, false).then(res => { this._getDependItemList(codes, false).then(res => {
_.map(this.dependItemList, (v, i) => { _.map(this.dependItemList, (v, i) => {
this._getProcessByProjectId(v.projectId).then(definitionList => { this._getProcessByProjectId(v.projectId).then(definitionList => {
this.$set(this.dependItemList, i, this._rtOldParams(v.definitionId, ['ALL'].concat(_.map(res[v.definitionId] || [], v => v.name)), v)) this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v))
}) })
}) })
}) })

Loading…
Cancel
Save