From 52aaf0ec92a809983ea95f1b7db625cc1503456f Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Fri, 14 Aug 2020 17:44:57 +0800 Subject: [PATCH] [Fix-3469][ui]The value of maintenance resources and the filtering of resources according to different program types --- .../dag/_source/formModel/tasks/flink.vue | 31 ++++++++++++++++-- .../pages/dag/_source/formModel/tasks/mr.vue | 32 ++++++++++++++++--- .../dag/_source/formModel/tasks/python.vue | 3 +- .../dag/_source/formModel/tasks/shell.vue | 3 +- .../dag/_source/formModel/tasks/spark.vue | 29 +++++++++++++++-- .../conf/home/pages/dag/definitionDetails.vue | 1 + .../conf/home/pages/dag/instanceDetails.vue | 1 + .../src/js/conf/home/store/dag/actions.js | 11 +++++-- .../src/js/conf/home/store/dag/mutations.js | 1 + .../src/js/conf/home/store/dag/state.js | 2 ++ 10 files changed, 99 insertions(+), 15 deletions(-) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue index 0fe5d0cbdb..b8413a1a44 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue @@ -22,6 +22,7 @@ 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -465,13 +479,24 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } + // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue index 26d74bd990..b545d1f20a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue @@ -19,7 +19,7 @@
{{$t('Program Type')}}
- + 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -343,13 +356,24 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } + // Non-null objects represent backfill if (!_.isEmpty(o)) { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue index 40b8c6a0b7..ce899b3606 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue @@ -229,12 +229,13 @@ if(optionsCmp.length>0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.resourceOptions = _.filter(this.resourceOptions, o=> { return o.id!==-1 }) this.resourceOptions = this.resourceOptions.concat(noResources) } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue index 48c5322b16..6f7e7ce7c0 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue @@ -267,12 +267,13 @@ if(optionsCmp.length>0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.options = _.filter(this.options, o=> { return o.id!==-1 }) this.options = this.options.concat(noResources) } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue index 2c59707c69..08c50a9fa9 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue @@ -22,6 +22,7 @@ 0) { this.allNoResources = optionsCmp optionsCmp = optionsCmp.map(item=>{ - return {id: item.id,name: item.name,fullName: item.res} + return {id: item.id,name: item.name || item.res,fullName: item.res} }) optionsCmp.forEach(item=>{ item.isNew = true }) noResources[0].children = optionsCmp + this.mainJarList = _.filter(this.mainJarList, o=> { return o.id!==-1 }) this.mainJarList = this.mainJarList.concat(noResources) } } @@ -512,13 +526,22 @@ } }, created () { + let o = this.backfillItem let item = this.store.state.dag.resourcesListS let items = this.store.state.dag.resourcesListJar + let pythonList = this.store.state.dag.resourcesListPy this.diGuiTree(item) this.diGuiTree(items) + this.diGuiTree(pythonList) + this.mainJarList = item - this.mainJarLists = items - let o = this.backfillItem + this.jarList = items + this.pyList = pythonList + if(!_.isEmpty(o) && o.params.programType === 'PYTHON') { + this.mainJarLists = pythonList + } else { + this.mainJarLists = items + } // Non-null objects represent backfill if (!_.isEmpty(o)) { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue index b1d7a7b1e2..42c6b12234 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue @@ -62,6 +62,7 @@ this.getResourcesList(), // get jar this.getResourcesListJar(), + this.getResourcesListJar('PYTHON'), // get worker group list this.getWorkerGroupsAll(), this.getTenantList() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue index daa30d7c44..f82cea414a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue @@ -64,6 +64,7 @@ this.getResourcesList(), // get jar this.getResourcesListJar(), + this.getResourcesListJar('PYTHON'), // get worker group list this.getWorkerGroupsAll(), this.getTenantList() diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js index a549aafaa2..a2f1516bf0 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -374,16 +374,21 @@ export default { /** * get jar */ - getResourcesListJar ({ state }) { + getResourcesListJar ({ state }, payload) { return new Promise((resolve, reject) => { if (state.resourcesListJar.length) { resolve() return } io.get('resources/list/jar', { - type: 'FILE' + type: 'FILE', + programType: payload }, res => { - state.resourcesListJar = res.data + if(payload) { + state.resourcesListPy = res.data + } else { + state.resourcesListJar = res.data + } resolve(res.data) }).catch(res => { reject(res) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js index cbd828fe01..02d466870a 100755 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/mutations.js @@ -109,6 +109,7 @@ export default { state.processListS = (payload && payload.processListS) || [] state.resourcesListS = (payload && payload.resourcesListS) || [] state.resourcesListJar = (payload && payload.resourcesListJar) || [] + state.resourcesListPy = (payload && payload.resourcesListPy) || [] state.projectListS = (payload && payload.projectListS) || [] state.isDetails = (payload && payload.isDetails) || false state.runFlag = (payload && payload.runFlag) || '' diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js index 05dfa77161..b2aad5ec3a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js @@ -55,6 +55,8 @@ export default { resourcesListS: [], // tasks resourcesListJar resourcesListJar: [], + // tasks resourcesListPy + resourcesListPy: [], // tasks datasource Type dsTypeListS: [ {