From 8561d65b2b48a0ddbd2fdc8f46b21fa486d2dfd9 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 1 Apr 2020 17:38:57 +0800 Subject: [PATCH] Corrections to historical jar packages and resource data --- .../dag/_source/formModel/tasks/flink.vue | 36 ++++++++++++++++-- .../pages/dag/_source/formModel/tasks/mr.vue | 36 ++++++++++++++++-- .../dag/_source/formModel/tasks/python.vue | 15 +++++++- .../dag/_source/formModel/tasks/shell.vue | 17 +++++++-- .../dag/_source/formModel/tasks/spark.vue | 38 +++++++++++++++++-- .../instance/pages/list/_source/list.vue | 2 +- .../src/js/conf/home/store/dag/actions.js | 13 ++++++- 7 files changed, 139 insertions(+), 18 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 ac04e2187d..abf04571fd 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 @@ -218,6 +218,19 @@ }, mixins: [disabledState], methods: { + /** + * getResourceId + */ + marjarId(name) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+name + }).then(res => { + this.mainJar = res.id + }).catch(e => { + this.$message.error(e.msg || '') + }) + }, /** * return localParams */ @@ -366,7 +379,13 @@ // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' - this.mainJar = o.params.mainJar && o.params.mainJar.id ? o.params.mainJar.id : '' + if(o.params.mainJar.res) { + this.marjarId(o.params.mainJar.res) + } else if(o.params.mainJar.res=='') { + this.mainJar = '' + } else { + this.mainJar = o.params.mainJar.id || '' + } this.deployMode = o.params.deployMode || '' this.slot = o.params.slot || 1 this.taskManager = o.params.taskManager || '2' @@ -380,8 +399,19 @@ // backfill resourceList let resourceList = o.params.resourceList || [] if (resourceList.length) { - this.resourceList = _.map(resourceList, v => { - return v.id + _.map(resourceList, v => { + if(v.res) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+v.res + }).then(res => { + this.resourceList.push(res.id) + }).catch(e => { + this.$message.error(e.msg || '') + }) + } else { + this.resourceList.push(v.id) + } }) this.cacheResourceList = resourceList } 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 3691985d7d..121147d7e5 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 @@ -142,6 +142,19 @@ }, mixins: [disabledState], methods: { + /** + * getResourceId + */ + marjarId(name) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+name + }).then(res => { + this.mainJar = res.id + }).catch(e => { + this.$message.error(e.msg || '') + }) + }, /** * return localParams */ @@ -245,7 +258,13 @@ // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' - this.mainJar = o.params.mainJar.id || '' + if(o.params.mainJar.res) { + this.marjarId(o.params.mainJar.res) + } else if(o.params.mainJar.res=='') { + this.mainJar = '' + } else { + this.mainJar = o.params.mainJar.id || '' + } this.mainArgs = o.params.mainArgs || '' this.others = o.params.others this.programType = o.params.programType || 'JAVA' @@ -253,8 +272,19 @@ // backfill resourceList let resourceList = o.params.resourceList || [] if (resourceList.length) { - this.resourceList = _.map(resourceList, v => { - return v.id + _.map(resourceList, v => { + if(v.res) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+v.res + }).then(res => { + this.resourceList.push(res.id) + }).catch(e => { + this.$message.error(e.msg || '') + }) + } else { + this.resourceList.push(v.id) + } }) this.cacheResourceList = resourceList } 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 e8e7e58771..10cad6cb38 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 @@ -176,8 +176,19 @@ // backfill resourceList let resourceList = o.params.resourceList || [] if (resourceList.length) { - this.resourceList = _.map(resourceList, v => { - return v.id + _.map(resourceList, v => { + if(v.res) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+v.res + }).then(res => { + this.resourceList.push(res.id) + }).catch(e => { + this.$message.error(e.msg || '') + }) + } else { + this.resourceList.push(v.id) + } }) this.cacheResourceList = resourceList } 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 952fd3a38d..fef1579db0 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 @@ -96,6 +96,7 @@ label: node.name } }, + id: null } }, mixins: [disabledState], @@ -238,12 +239,22 @@ // backfill resourceList let resourceList = o.params.resourceList || [] if (resourceList.length) { - this.resourceList = _.map(resourceList, v => { - return v.id + _.map(resourceList, v => { + if(v.res) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+v.res + }).then(res => { + this.resourceList.push(res.id) + }).catch(e => { + this.$message.error(e.msg || '') + }) + } else { + this.resourceList.push(v.id) + } }) this.cacheResourceList = resourceList } - // backfill localParams let localParams = o.params.localParams || [] if (localParams.length) { 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 de7a21d990..61662d96bc 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 @@ -261,6 +261,19 @@ }, mixins: [disabledState], methods: { + /** + * getResourceId + */ + marjarId(name) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+name + }).then(res => { + this.mainJar = res.id + }).catch(e => { + this.$message.error(e.msg || '') + }) + }, /** * return localParams */ @@ -414,7 +427,13 @@ // Non-null objects represent backfill if (!_.isEmpty(o)) { this.mainClass = o.params.mainClass || '' - this.mainJar = o.params.mainJar && o.params.mainJar.id ? o.params.mainJar.id : '' + if(o.params.mainJar.res) { + this.marjarId(o.params.mainJar.res) + } else if(o.params.mainJar.res=='') { + this.mainJar = '' + } else { + this.mainJar = o.params.mainJar.id || '' + } this.deployMode = o.params.deployMode || '' this.driverCores = o.params.driverCores || 1 this.driverMemory = o.params.driverMemory || '512M' @@ -429,9 +448,20 @@ // backfill resourceList let resourceList = o.params.resourceList || [] if (resourceList.length) { - this.resourceList = _.map(resourceList, v => { - return v.id - }) + _.map(resourceList, v => { + if(v.res) { + this.store.dispatch('dag/getResourceId',{ + type: 'FILE', + fullName: '/'+v.res + }).then(res => { + this.resourceList.push(res.id) + }).catch(e => { + this.$message.error(e.msg || '') + }) + } else { + this.resourceList.push(v.id) + } + }) this.cacheResourceList = resourceList } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue index c5992de20f..513b8ec6dd 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue @@ -22,7 +22,7 @@ - + {{$t('#')}} 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 50295ad4b1..1f43383c8c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -715,5 +715,14 @@ export default { reject(e) }) }) - } -} + }, + getResourceId ({ state }, payload) { + return new Promise((resolve, reject) => { + io.get(`resources/queryResource`, payload, res => { + resolve(res.data) + }).catch(e => { + reject(e) + }) + }) + }, +} \ No newline at end of file