Ver Fonte

[Fix-6139][UI] Fix missing relationship issue (#6258)

* the relationship is missing in kinship

* Fix missing environmentCode parameter issue when modifying the process
Wangyizhi1 há 3 anos atrás
pai
commit
69a153c5f5

+ 7 - 2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/_source/relatedEnvironment.vue

@@ -49,6 +49,9 @@
       },
       workerGroup: {
         type: String
+      },
+      isNewCreate: {
+        type: Boolean
       }
     },
     model: {
@@ -70,6 +73,7 @@
       },
       _initEnvironmentOptions (workerGroup) {
         this.environmentOptions = []
+        this.selectedValue = ''
         if (this.environmentList && workerGroup) {
           this.environmentList.forEach(item => {
             if (item.workerGroups && item.workerGroups.length > 0) {
@@ -85,10 +89,11 @@
 
         if (this.environmentOptions.length > 0) {
           /// default to select this environment when only have one environment
-          if (this.environmentOptions.length === 1 && this.selectedValue === '') {
+          /// automatically select only when creating a new task
+          if (this.isNewCreate && this.environmentOptions.length === 1 && this.selectedValue === '') {
             this.selectedValue = this.environmentOptions[0].code
-            this.$emit('environmentCodeEvent', this.selectedValue)
           }
+          this.$emit('environmentCodeEvent', this.selectedValue)
         } else {
           this.selectedValue = ''
           this.$emit('environmentCodeEvent', this.selectedValue)

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

@@ -118,6 +118,7 @@
             <m-related-environment
               v-model="environmentCode"
               :workerGroup="workerGroup"
+              :isNewCreate="isNewCreate"
               v-on:environmentCodeEvent="_onUpdateEnvironmentCode"
             ></m-related-environment>
           </div>
@@ -512,7 +513,9 @@
         postTasks: [],
         prevTasks: [],
         // refresh part of the formModel, after set backfillItem outside
-        backfillRefresh: true
+        backfillRefresh: true,
+        // whether this is a new Task
+        isNewCreate: true
       }
     },
     provide () {
@@ -560,7 +563,8 @@
           },
           type: task.taskType,
           waitStartTimeout: task.taskParams.waitStartTimeout,
-          workerGroup: task.workerGroup
+          workerGroup: task.workerGroup,
+          environmentCode: task.environmentCode
         }
       },
       /**
@@ -902,6 +906,7 @@
             const backfillItem = this.taskToBackfillItem(task)
             o = backfillItem
             this.backfillItem = backfillItem
+            this.isNewCreate = false
           }
         })
       }

+ 1 - 0
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/kinship/_source/graphGridOption.js

@@ -41,6 +41,7 @@ export default function (locations, links, sourceWorkFlowCode, isShowLabel) {
     const { color, category } = getCategory(categoryDic, item, sourceWorkFlowCode)
     return {
       ...item,
+      id: item.code,
       emphasis: {
         itemStyle: {
           color

+ 5 - 3
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@@ -143,7 +143,7 @@ export default {
         state.globalParams = res.data.processDefinition.globalParamList
         // timeout
         state.timeout = res.data.processDefinition.timeout
-        // tenantId
+        // tenantCode
         state.tenantCode = res.data.processDefinition.tenantCode || 'default'
         // tasks info
         state.tasks = res.data.taskDefinitionList.map(task => _.pick(task, [
@@ -161,7 +161,8 @@ export default {
           'failRetryInterval',
           'timeoutFlag',
           'timeoutNotifyStrategy',
-          'timeout'
+          'timeout',
+          'environmentCode'
         ]))
         resolve(res.data)
       }).catch(res => {
@@ -257,7 +258,8 @@ export default {
           'failRetryInterval',
           'timeoutFlag',
           'timeoutNotifyStrategy',
-          'timeout'
+          'timeout',
+          'environmentCode'
         ]))
         // startup parameters
         state.startup = _.assign(state.startup, _.pick(res.data, ['commandType', 'failureStrategy', 'processInstancePriority', 'workerGroup', 'warningType', 'warningGroupId', 'receivers', 'receiversCc']))