From b79630488dcf72d4bb28ea4da2179e0293448e72 Mon Sep 17 00:00:00 2001 From: Wangyizhi1 <87303815+Wangyizhi1@users.noreply.github.com> Date: Mon, 13 Sep 2021 18:03:28 +0800 Subject: [PATCH] convert process definition id to code (#6191) --- .../js/conf/home/pages/dag/_source/dag.vue | 1 + .../pages/dag/_source/formModel/formModel.vue | 8 ++- .../tasks/_source/dependItemList.vue | 20 +++---- .../formModel/tasks/_source/nodeStatus.vue | 6 +- .../definition/pages/list/_source/list.vue | 60 +++++++++---------- .../pages/list/_source/relatedItems.vue | 14 ++--- .../src/js/conf/home/store/dag/actions.js | 14 ++--- 7 files changed, 64 insertions(+), 59 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue index 55a58b1a94..d2cb02c0b6 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue @@ -31,6 +31,7 @@ @addTaskInfo="addTaskInfo" @close="closeTaskDrawer" @onSubProcess="toSubProcess" + :type="type" > @@ -525,7 +525,11 @@ directives: { clickoutside }, mixins: [disabledState], props: { - nodeData: Object + nodeData: Object, + type: { + type: String, + default: '' + } }, inject: ['dagChart'], methods: { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue index c05f784e73..416ce77eec 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue @@ -85,7 +85,7 @@ // add task list let projectId = this.projectList[0].value - this._getProcessByProjectId(projectId).then(definitionList => { + this._getProcessByProjectCode().then(definitionList => { // dependItemList index let is = (value) => _.some(this.dependItemList, { definitionCode: value }) let noArr = _.filter(definitionList, v => !is(v.value)) @@ -124,13 +124,13 @@ resolve() }) }, - _getProcessByProjectId (id) { + _getProcessByProjectCode () { return new Promise((resolve, reject) => { - this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { + this.store.dispatch('dag/getProcessByProjectCode').then(res => { let definitionList = _.map(_.cloneDeep(res), v => { return { - value: v.code, - label: v.name + value: v.processDefinition.code, + label: v.processDefinition.name } }) resolve(definitionList) @@ -143,11 +143,11 @@ _getDependItemList (codes, is = true) { return new Promise((resolve, reject) => { if (is) { - this.store.dispatch('dag/getProcessTasksList', { processDefinitionCode: codes }).then(res => { + this.store.dispatch('dag/getProcessTasksList', { code: codes }).then(res => { resolve(['ALL'].concat(_.map(res, v => v.name))) }) } else { - this.store.dispatch('dag/getTaskListDefIdAll', { processDefinitionCodeList: codes }).then(res => { + this.store.dispatch('dag/getTaskListDefIdAll', { codes: codes }).then(res => { resolve(res) }) } @@ -157,7 +157,7 @@ * change process get dependItemList */ _onChangeProjectId (value, itemIndex) { - this._getProcessByProjectId(value).then(definitionList => { + this._getProcessByProjectCode().then(definitionList => { /* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */ let definitionCode = definitionList[0].value this._getDependItemList(definitionCode).then(depTasksList => { @@ -245,7 +245,7 @@ if (!this.dependItemList.length) { if (!this.projectList.length) return let projectId = this.projectList[0].value - this._getProcessByProjectId(projectId).then(definitionList => { + this._getProcessByProjectCode().then(definitionList => { let value = definitionList[0].value this._getDependItemList(value).then(depTasksList => { this.$emit('dependItemListEvent', _.concat(this.dependItemList, this._rtNewParams(value, definitionList, depTasksList, projectId))) @@ -257,7 +257,7 @@ // get item list this._getDependItemList(codes, false).then(res => { _.map(this.dependItemList, (v, i) => { - this._getProcessByProjectId(v.projectId).then(definitionList => { + this._getProcessByProjectCode().then(definitionList => { this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, definitionList, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v)) }) }) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue index aaa9dde3ed..276374f7ed 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue @@ -107,9 +107,9 @@ resolve() }) }, - _getProcessByProjectId (id) { + _getProcessByProjectCode () { return new Promise((resolve, reject) => { - this.store.dispatch('dag/getProcessByProjectId', { projectId: id }).then(res => { + this.store.dispatch('dag/getProcessByProjectCode').then(res => { this.definitionList = _.map(_.cloneDeep(res), v => { return { value: v.code, @@ -168,7 +168,7 @@ // get item list this._getDependItemList(codes, false).then(res => { _.map(this.dependItemList, (v, i) => { - this._getProcessByProjectId(v.projectId).then(definitionList => { + this._getProcessByProjectCode().then(definitionList => { this.$set(this.dependItemList, i, this._rtOldParams(v.definitionCode, ['ALL'].concat(_.map(res[v.definitionCode] || [], v => v.name)), v)) }) }) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue index 43622f3c44..0af0b5a836 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue @@ -115,12 +115,12 @@ :title="$t('Delete?')" @onConfirm="_delete({},-1)" > - {{$t('Delete')}} + {{$t('Delete')}} - {{$t('Export')}} - {{$t('Batch copy')}} - {{$t('Batch move')}} + {{$t('Export')}} + {{$t('Batch copy')}} + {{$t('Batch move')}} { - this.strSelectIds = '' + this.strSelectCodes = '' this.$message.success(res.msg) // $('body').find('.tooltip.fade.top.in').remove() this._onUpdate() @@ -310,10 +310,10 @@ */ _moveProcess (item) { this.moveProcess({ - processDefinitionIds: item.id, - targetProjectId: item.projectId + codes: item.code, + targetProjectCode: item.projectCode }).then(res => { - this.strSelectIds = '' + this.strSelectCodes = '' this.$message.success(res.msg) $('body').find('.tooltip.fade.top.in').remove() this._onUpdate() @@ -324,7 +324,7 @@ _export (item) { this.exportDefinition({ - processDefinitionIds: item.id, + codes: item.code, fileName: item.name }).catch(e => { this.$message.error(e.msg || '') @@ -334,7 +334,7 @@ * switch version in process definition version list * * @param version the version user want to change - * @param processDefinitionId the process definition id + * @param processDefinitionCode the process definition code * @param fromThis fromThis */ mVersionSwitchProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) { @@ -353,7 +353,7 @@ * * @param pageNo page number * @param pageSize page size - * @param processDefinitionId the process definition id of page version + * @param processDefinitionCode the process definition Code of page version * @param fromThis fromThis */ mVersionGetProcessDefinitionVersionsPage ({ pageNo, pageSize, processDefinitionCode, fromThis }) { @@ -374,7 +374,7 @@ * delete one version of process definition * * @param version the version need to delete - * @param processDefinitionId the process definition id user want to delete + * @param processDefinitionCode the process definition code user want to delete * @param fromThis fromThis */ mVersionDeleteProcessDefinitionVersion ({ version, processDefinitionCode, fromThis }) { @@ -421,14 +421,14 @@ _batchExport () { this.exportDefinition({ - processDefinitionIds: this.strSelectIds, + codes: this.strSelectCodes, fileName: 'process_' + new Date().getTime() }).then(res => { this._onUpdate() this.checkAll = false - this.strSelectIds = '' + this.strSelectCodes = '' }).catch(e => { - this.strSelectIds = '' + this.strSelectCodes = '' this.checkAll = false this.$message.error(e.msg) }) @@ -440,8 +440,8 @@ this.relatedItemsDialog = true this.tmp = false }, - onBatchCopy (item) { - this._copyProcess({ id: this.strSelectIds, projectId: item }) + onBatchCopy (projectCode) { + this._copyProcess({ code: this.strSelectCodes, projectCode: projectCode }) this.relatedItemsDialog = false }, closeRelatedItems () { @@ -454,8 +454,8 @@ this.tmp = true this.relatedItemsDialog = true }, - onBatchMove (item) { - this._moveProcess({ id: this.strSelectIds, projectId: item }) + onBatchMove (projectCode) { + this._moveProcess({ code: this.strSelectCodes, projectCode: projectCode }) this.relatedItemsDialog = false }, /** @@ -478,22 +478,22 @@ */ _arrDelChange (v) { let arr = [] - arr = _.map(v, 'id') - this.strSelectIds = _.join(arr, ',') + arr = _.map(v, 'code') + this.strSelectCodes = _.join(arr, ',') }, /** * batch delete */ _batchDelete () { this.batchDeleteDefinition({ - processDefinitionIds: this.strSelectIds + codes: this.strSelectCodes }).then(res => { this._onUpdate() this.checkAll = false - this.strSelectIds = '' + this.strSelectCodes = '' this.$message.success(res.msg) }).catch(e => { - this.strSelectIds = '' + this.strSelectCodes = '' this.checkAll = false this.$message.error(e.msg || '') }) @@ -512,7 +512,7 @@ deep: true }, pageNo () { - this.strSelectIds = '' + this.strSelectCodes = '' } }, created () { @@ -520,7 +520,7 @@ mounted () { }, computed: { - ...mapState('dag', ['projectId', 'projectCode']) + ...mapState('dag', ['projectCode']) }, components: { mVersions, mStart, mTiming, mRelatedItems } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue index 05defe6fad..24920a5e2d 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue @@ -26,11 +26,11 @@