From 182455ced7e85000c51874d0cba07f5ca4a52146 Mon Sep 17 00:00:00 2001 From: Amy0104 Date: Wed, 17 Aug 2022 09:26:01 +0800 Subject: [PATCH] [Fix][UI] Fix the preTask options are unavailable when creating a task in the task definition page. (#11501) --- .../task/components/node/fields/index.ts | 1 + .../components/node/fields/use-pre-tasks.ts | 11 ++++- .../node/fields/use-process-name.ts | 8 +++- .../node/fields/use-task-definition.ts | 46 +++++++++++++++++++ .../task/components/node/tasks/use-chunjun.ts | 16 +------ .../components/node/tasks/use-conditions.ts | 16 +------ .../components/node/tasks/use-data-quality.ts | 16 +------ .../task/components/node/tasks/use-datax.ts | 16 +------ .../components/node/tasks/use-dependent.ts | 16 +------ .../task/components/node/tasks/use-dinky.ts | 16 +------ .../task/components/node/tasks/use-dvc.ts | 18 +------- .../task/components/node/tasks/use-emr.ts | 16 +------ .../components/node/tasks/use-flink-stream.ts | 16 +------ .../task/components/node/tasks/use-flink.ts | 16 +------ .../task/components/node/tasks/use-http.ts | 16 +------ .../task/components/node/tasks/use-jupyter.ts | 16 +------ .../task/components/node/tasks/use-k8s.ts | 16 +------ .../task/components/node/tasks/use-mlflow.ts | 16 +------ .../task/components/node/tasks/use-mr.ts | 16 +------ .../components/node/tasks/use-openmldb.ts | 16 +------ .../task/components/node/tasks/use-pigeon.ts | 16 +------ .../components/node/tasks/use-procedure.ts | 16 +------ .../task/components/node/tasks/use-python.ts | 16 +------ .../components/node/tasks/use-sagemaker.ts | 18 +------- .../components/node/tasks/use-sea-tunnel.ts | 16 +------ .../task/components/node/tasks/use-shell.ts | 16 +------ .../task/components/node/tasks/use-spark.ts | 16 +------ .../task/components/node/tasks/use-sql.ts | 16 +------ .../task/components/node/tasks/use-sqoop.ts | 16 +------ .../components/node/tasks/use-sub-process.ts | 16 +------ .../task/components/node/tasks/use-switch.ts | 16 +------ .../components/node/tasks/use-zeppelin.ts | 16 +------ 32 files changed, 93 insertions(+), 425 deletions(-) create mode 100644 dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-task-definition.ts diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts index 6691d67dbe..d1e2e2b3a2 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts @@ -48,6 +48,7 @@ export { useExecutorMemory } from './use-executor-memory' export { useExecutorCores } from './use-executor-cores' export { useMainJar } from './use-main-jar' export { useResources } from './use-resources' +export { useTaskDefinition } from './use-task-definition' export { useShell } from './use-shell' export { useSpark } from './use-spark' diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-pre-tasks.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-pre-tasks.ts index 5a472d92ae..80bd285e21 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-pre-tasks.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-pre-tasks.ts @@ -15,6 +15,7 @@ * limitations under the License. */ +import { ref, watch } from 'vue' import { useI18n } from 'vue-i18n' import { useTaskNodeStore } from '@/store/project/task-node' import type { IJsonItem } from '../types' @@ -22,6 +23,14 @@ import type { IJsonItem } from '../types' export function usePreTasks(): IJsonItem { const { t } = useI18n() const taskStore = useTaskNodeStore() + const options = ref(taskStore.getPreTaskOptions) + + watch( + () => taskStore.getPreTaskOptions, + (value) => { + options.value = value + } + ) return { type: 'select', @@ -33,6 +42,6 @@ export function usePreTasks(): IJsonItem { multiple: true, filterable: true }, - options: taskStore.getPreTaskOptions + options } } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-process-name.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-process-name.ts index d754acbf46..f9cdccc224 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-process-name.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-process-name.ts @@ -21,6 +21,7 @@ import { querySimpleList, queryProcessDefinitionByCode } from '@/service/modules/process-definition' +import { useTaskNodeStore } from '@/store/project/task-node' import type { IJsonItem } from '../types' export function useProcessName({ @@ -28,16 +29,18 @@ export function useProcessName({ projectCode, isCreate, from, - processName + processName, + taskCode }: { model: { [field: string]: any } projectCode: number isCreate: boolean from?: number processName?: number + taskCode?: number }): IJsonItem { const { t } = useI18n() - + const taskStore = useTaskNodeStore() const options = ref([] as { label: string; value: string }[]) const loading = ref(false) @@ -55,6 +58,7 @@ export function useProcessName({ if (!processCode) return const res = await queryProcessDefinitionByCode(processCode, projectCode) model.definition = res + taskStore.updateDefinition(res, taskCode) } const onChange = (code: number) => { diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-task-definition.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-task-definition.ts new file mode 100644 index 0000000000..d740e366c1 --- /dev/null +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-task-definition.ts @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { useTaskType, useProcessName } from '.' +import type { IJsonItem, ITaskData } from '../types' + +export const useTaskDefinition = ({ + projectCode, + from = 0, + readonly, + data, + model +}: { + projectCode: number + from?: number + readonly?: boolean + data?: ITaskData + model: { [field: string]: any } +}): IJsonItem[] => { + if (from === 0) return [] + return [ + useTaskType(model, readonly), + useProcessName({ + model, + projectCode, + isCreate: !data?.id, + from, + processName: data?.processName, + taskCode: data?.code + }) + ] +} diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-chunjun.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-chunjun.ts index 362bd944fb..eb6dc03d71 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-chunjun.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-chunjun.ts @@ -51,24 +51,10 @@ export function useChunjun({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-conditions.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-conditions.ts index fa6124f67c..c22b2345eb 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-conditions.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-conditions.ts @@ -50,24 +50,10 @@ export function useConditions({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-quality.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-quality.ts index 91e667dd1b..0110570dd9 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-quality.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-quality.ts @@ -60,24 +60,10 @@ export function useDataQuality({ others: '--conf spark.yarn.maxAppAttempts=1' } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-datax.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-datax.ts index 5bbc366759..21b30abd74 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-datax.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-datax.ts @@ -54,24 +54,10 @@ export function useDataX({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dependent.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dependent.ts index 5bb2e0e470..2551d1076f 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dependent.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dependent.ts @@ -51,24 +51,10 @@ export function useDependent({ ...data } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dinky.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dinky.ts index 5e7a0aa0cb..82c2915287 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dinky.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dinky.ts @@ -46,24 +46,10 @@ export function useDinky({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dvc.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dvc.ts index 5838224e13..6108ca4e8e 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dvc.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-dvc.ts @@ -44,27 +44,13 @@ export function useDvc({ delayTime: 0, timeout: 30, timeoutNotifyStrategy: ['WARN'], - dvcTaskType: 'Upload', + dvcTaskType: 'Upload' } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-emr.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-emr.ts index 36dbbefa79..f6cdbaae11 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-emr.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-emr.ts @@ -48,24 +48,10 @@ export function useEmr({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink-stream.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink-stream.ts index 33883e46fa..d55a7b2fcb 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink-stream.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink-stream.ts @@ -56,24 +56,10 @@ export function useFlinkStream({ timeoutNotifyStrategy: ['WARN'] }) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink.ts index b3c455971f..d5671cb46d 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-flink.ts @@ -56,24 +56,10 @@ export function useFlink({ timeoutNotifyStrategy: ['WARN'] }) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-http.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-http.ts index 109258dfce..283910eab3 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-http.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-http.ts @@ -53,24 +53,10 @@ export function useHttp({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-jupyter.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-jupyter.ts index 18f80f69fd..97f683df1e 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-jupyter.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-jupyter.ts @@ -48,24 +48,10 @@ export function useJupyter({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-k8s.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-k8s.ts index c61816505e..1ae460917a 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-k8s.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-k8s.ts @@ -47,24 +47,10 @@ export function useK8s({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mlflow.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mlflow.ts index 8a78f84312..e1957f138e 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mlflow.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mlflow.ts @@ -57,24 +57,10 @@ export function useMlflow({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts index adf40762f7..34e4a86f46 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-mr.ts @@ -47,24 +47,10 @@ export function useMr({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-openmldb.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-openmldb.ts index 9f8d560de9..0e7dbaa629 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-openmldb.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-openmldb.ts @@ -50,24 +50,10 @@ export function useOpenmldb({ executeMode: 'offline' } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-pigeon.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-pigeon.ts index 0d9e471380..8e03244c73 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-pigeon.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-pigeon.ts @@ -46,24 +46,10 @@ export function usePigeon({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-procedure.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-procedure.ts index ecf6d2e345..a1f5f3cfff 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-procedure.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-procedure.ts @@ -50,24 +50,10 @@ export function useProcedure({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-python.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-python.ts index 698e84dd5a..7ad9ee95ec 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-python.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-python.ts @@ -50,24 +50,10 @@ export function usePython({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sagemaker.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sagemaker.ts index fc3a3be0a6..f525b53a48 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sagemaker.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sagemaker.ts @@ -43,27 +43,13 @@ export function userSagemaker({ workerGroup: 'default', delayTime: 0, timeout: 30, - timeoutNotifyStrategy: ['WARN'], + timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sea-tunnel.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sea-tunnel.ts index 4efd21b993..c570bac15b 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sea-tunnel.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sea-tunnel.ts @@ -77,24 +77,10 @@ export function useSeaTunnel({ '}' } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-shell.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-shell.ts index 2caa420734..3808d0d633 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-shell.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-shell.ts @@ -49,24 +49,10 @@ export function useShell({ rawScript: '' } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-spark.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-spark.ts index 054709de55..9d508805fc 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-spark.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-spark.ts @@ -55,24 +55,10 @@ export function useSpark({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sql.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sql.ts index fa6a6a1e03..481bae1b34 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sql.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sql.ts @@ -55,24 +55,10 @@ export function useSql({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts index 5c8cd68705..cc75e37bf1 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sqoop.ts @@ -69,24 +69,10 @@ export function useSqoop({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sub-process.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sub-process.ts index ff77e3762e..77e45686d3 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sub-process.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-sub-process.ts @@ -49,24 +49,10 @@ export function useSubProcess({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-switch.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-switch.ts index 34f054d1b1..55452c2582 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-switch.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-switch.ts @@ -50,24 +50,10 @@ export function useSwitch({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(), diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-zeppelin.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-zeppelin.ts index d97d54ec3c..823752b9a3 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-zeppelin.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-zeppelin.ts @@ -46,24 +46,10 @@ export function useZeppelin({ timeoutNotifyStrategy: ['WARN'] } as INodeData) - let extra: IJsonItem[] = [] - if (from === 1) { - extra = [ - Fields.useTaskType(model, readonly), - Fields.useProcessName({ - model, - projectCode, - isCreate: !data?.id, - from, - processName: data?.processName - }) - ] - } - return { json: [ Fields.useName(from), - ...extra, + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), Fields.useRunFlag(), Fields.useDescription(), Fields.useTaskPriority(),