You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/07/05 13:25:02 UTC
[dolphinscheduler] branch dev updated: [Fix][UI] Fix the environment name display back error. (#10797)
This is an automated email from the ASF dual-hosted git repository.
songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new a1aff5156e [Fix][UI] Fix the environment name display back error. (#10797)
a1aff5156e is described below
commit a1aff5156e53c7659c4a57fe9b21057433cc48ef
Author: Amy0104 <97...@users.noreply.github.com>
AuthorDate: Tue Jul 5 21:24:51 2022 +0800
[Fix][UI] Fix the environment name display back error. (#10797)
---
.../components/node/fields/use-environment-name.ts | 26 ++++++++++------------
.../workflow/components/dag/use-task-edit.ts | 4 ++--
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts
index 772079d418..dd51b8d1aa 100644
--- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts
+++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-environment-name.ts
@@ -29,7 +29,7 @@ export function useEnvironmentName(
let environmentList = [] as IEnvironmentNameOption[]
const options = ref([] as IEnvironmentNameOption[])
const loading = ref(false)
- const value = ref()
+ let mounted = false
const getEnvironmentList = async () => {
if (loading.value) return
@@ -46,6 +46,11 @@ export function useEnvironmentName(
filterByWorkerGroup(option)
)
loading.value = false
+ if (options.value.length === 0) {
+ model.environmentCode = null
+ } else {
+ isCreate && (model.environmentCode = options.value[0].value)
+ }
}
const filterByWorkerGroup = (option: IEnvironmentNameOption) => {
@@ -54,28 +59,21 @@ 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
+ if (!model.workerGroup || !mounted) return
options.value = environmentList.filter((option: IEnvironmentNameOption) =>
filterByWorkerGroup(option)
)
+ model.environmentCode =
+ options.value.length === 0 ? null : options.value[0].value
}
)
- onMounted(() => {
- getEnvironmentList()
+ onMounted(async () => {
+ await getEnvironmentList()
+ mounted = true
})
return {
diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts
index 8748f39be6..f7759b25e9 100644
--- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts
+++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-task-edit.ts
@@ -29,7 +29,6 @@ import type {
EditWorkflowDefinition
} from './types'
-
interface Options {
graph: Ref<Graph | undefined>
definition: Ref<WorkflowDefinition | undefined>
@@ -175,7 +174,8 @@ export function useTaskEdit(options: Options) {
...taskDef,
version: task.version,
code: task.code,
- taskType: currTask.value.taskType
+ taskType: currTask.value.taskType,
+ id: task.id
}
}
return task