You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/07/04 09:35:57 UTC

[GitHub] [dolphinscheduler] Amy0104 commented on a diff in pull request #10731: [Fix-10730][UI] fix bug where the environment name not works well

Amy0104 commented on code in PR #10731:
URL: https://github.com/apache/dolphinscheduler/pull/10731#discussion_r912817871


##########
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts:
##########
@@ -54,23 +53,20 @@ export function useEnvironmentName(
     return option.workerGroups.indexOf(model.workerGroup) !== -1
   }
 
-  watch(
-    () => options.value.length,
-    () => {
-      if (isCreate && options.value.length === 1 && !value.value) {
-        model.environmentCode = options.value[0].value
-      }
-      if (options.value.length === 0) model.environmentCode = null
-    }
-  )
-
   watch(
     () => model.workerGroup,
     () => {
       if (!model.workerGroup) return
       options.value = environmentList.filter((option: IEnvironmentNameOption) =>
         filterByWorkerGroup(option)
       )
+      // default environmentCode changing when workerGroup changed.
+      // if options only one. set the one as default.
+      if (options.value.length === 1) {
+        model.environmentCode = options.value[0].value
+      } else {
+        model.environmentCode = null
+      }

Review Comment:
   Data playback will get a problem. Such as you have two workerGroups A and B. And then set the workerGroup to B and set the environment to B-2.  Save the task, and reopen you will get the environment to B-1.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org