Browse Source

fix UI updateProcessInstance interface parameter error (#6487)

wangyizhi 3 years ago
parent
commit
eb21a1763e

+ 8 - 7
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue

@@ -161,7 +161,7 @@
 
       if (this.type === 'instance') {
         this.instanceId = this.$route.params.id
-        this.definitionCode = this.$route.query.code
+        this.definitionCode = this.$route.query.code || this.code
       } else if (this.type === 'definition') {
         this.definitionCode = this.$route.params.code
       }
@@ -199,7 +199,8 @@
         'name',
         'isDetails',
         'projectCode',
-        'version'
+        'version',
+        'code'
       ])
     },
     methods: {
@@ -311,12 +312,12 @@
           .then((res) => {
             if (this.verifyConditions(res.tasks)) {
               this.loading(true)
-              const definitionCode = this.definitionCode
-              if (definitionCode) {
+              const isEdit = !!this.definitionCode
+              if (isEdit) {
+                const methodName = this.type === 'instance' ? 'updateInstance' : 'updateDefinition'
+                const methodParam = this.type === 'instance' ? this.instanceId : this.definitionCode
                 // Edit
-                return this[
-                  this.type === 'instance' ? 'updateInstance' : 'updateDefinition'
-                ](definitionCode)
+                return this[methodName](methodParam)
                   .then((res) => {
                     this.$message({
                       message: res.msg,

+ 1 - 1
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/_source/list.vue

@@ -298,7 +298,7 @@
        * edit
        */
       _reEdit (item) {
-        this.$router.push({ path: `/projects/${this.projectCode}/instance/list/${item.id}` })
+        this.$router.push({ path: `/projects/${this.projectCode}/instance/list/${item.id}`, query: { code: item.processDefinitionCode } })
       },
       /**
        * Rerun

+ 2 - 2
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/_source/list.vue

@@ -149,7 +149,7 @@
         this.$emit('on-update')
       },
       _go (item) {
-        this.$router.push({ path: `/projects/${this.projectId}/instance/list/${item.processInstanceId}` })
+        this.$router.push({ path: `/projects/${this.projectCode}/instance/list/${item.processInstanceId}` })
       }
     },
     watch: {
@@ -166,7 +166,7 @@
       this.list = this.taskInstanceList
     },
     computed: {
-      ...mapState('dag', ['projectId'])
+      ...mapState('dag', ['projectCode'])
     },
     components: { mLog }
   }

+ 8 - 11
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@@ -318,19 +318,16 @@ export default {
   /**
    * Process instance update
    */
-  updateInstance ({ state }, payload) {
+  updateInstance ({ state }, instanceId) {
     return new Promise((resolve, reject) => {
-      const data = {
-        globalParams: state.globalParams,
-        tasks: state.tasks,
-        tenantId: state.tenantId,
-        timeout: state.timeout
-      }
-      io.put(`projects/${state.projectCode}/process-instances/${payload}`, {
-        processInstanceJson: JSON.stringify(data),
+      io.put(`projects/${state.projectCode}/process-instances/${instanceId}`, {
+        syncDefine: state.syncDefine,
+        globalParams: JSON.stringify(state.globalParams),
         locations: JSON.stringify(state.locations),
-        connects: JSON.stringify(state.connects),
-        syncDefine: state.syncDefine
+        taskDefinitionJson: JSON.stringify(state.tasks),
+        taskRelationJson: JSON.stringify(state.connects),
+        tenantCode: state.tenantCode,
+        timeout: state.timeout
       }, res => {
         resolve(res)
         state.isEditDag = false