From 099bde0f78a4d73b63415d7dedad50661281e6e6 Mon Sep 17 00:00:00 2001 From: Amy0104 <97265214+Amy0104@users.noreply.github.com> Date: Wed, 13 Apr 2022 13:45:39 +0800 Subject: [PATCH] [Fix][Next-UI] Add LIST type to the custom parameter types of task node. (#9468) --- .../node/fields/use-custom-params.ts | 4 + .../task/components/node/fields/use-emr.ts | 108 +----------------- .../components/node/fields/use-procedure.ts | 108 +----------------- .../components/dag/dag-save-modal.tsx | 2 +- .../workflow/components/dag/dag-toolbar.tsx | 4 +- 5 files changed, 12 insertions(+), 214 deletions(-) diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-custom-params.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-custom-params.ts index 22b45d32c6..6adac53b30 100644 --- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-custom-params.ts +++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-custom-params.ts @@ -183,6 +183,10 @@ export const TYPE_LIST = [ { value: 'BOOLEAN', label: 'BOOLEAN' + }, + { + value: 'LIST', + label: 'LIST' } ] diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-emr.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-emr.ts index 082de6c3d7..b603f8659b 100644 --- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-emr.ts +++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-emr.ts @@ -15,6 +15,7 @@ * limitations under the License. */ import { useI18n } from 'vue-i18n' +import { useCustomParams } from '.' import type { IJsonItem } from '../types' export function useEmr(model: { [field: string]: any }): IJsonItem[] { @@ -34,111 +35,6 @@ export function useEmr(model: { [field: string]: any }): IJsonItem[] { message: t('project.node.emr_flow_define_json_tips') } }, - { - type: 'custom-parameters', - field: 'localParams', - name: t('project.node.custom_parameters'), - children: [ - { - type: 'input', - field: 'prop', - span: 6, - props: { - placeholder: t('project.node.prop_tips'), - maxLength: 256 - }, - validate: { - trigger: ['input', 'blur'], - required: true, - validator(validate: any, value: string) { - if (!value) { - return new Error(t('project.node.prop_tips')) - } - - const sameItems = model.localParams.filter( - (item: { prop: string }) => item.prop === value - ) - - if (sameItems.length > 1) { - return new Error(t('project.node.prop_repeat')) - } - } - } - }, - { - type: 'select', - field: 'direct', - span: 4, - options: DIRECT_LIST, - value: 'IN' - }, - { - type: 'select', - field: 'type', - span: 6, - options: TYPE_LIST, - value: 'VARCHAR' - }, - { - type: 'input', - field: 'value', - span: 6, - props: { - placeholder: t('project.node.value_tips'), - maxLength: 256 - } - } - ] - } + ...useCustomParams({ model, field: 'localParams', isSimple: false }) ] } - -export const TYPE_LIST = [ - { - value: 'VARCHAR', - label: 'VARCHAR' - }, - { - value: 'INTEGER', - label: 'INTEGER' - }, - { - value: 'LONG', - label: 'LONG' - }, - { - value: 'FLOAT', - label: 'FLOAT' - }, - { - value: 'DOUBLE', - label: 'DOUBLE' - }, - { - value: 'DATE', - label: 'DATE' - }, - { - value: 'TIME', - label: 'TIME' - }, - { - value: 'TIMESTAMP', - label: 'TIMESTAMP' - }, - { - value: 'BOOLEAN', - label: 'BOOLEAN' - } -] - -export const DIRECT_LIST = [ - { - value: 'IN', - label: 'IN' - }, - { - value: 'OUT', - label: 'OUT' - } -] diff --git a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-procedure.ts b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-procedure.ts index b4e0a3f5cb..65ca5b3903 100644 --- a/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-procedure.ts +++ b/dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-procedure.ts @@ -15,6 +15,7 @@ * limitations under the License. */ import { useI18n } from 'vue-i18n' +import { useCustomParams } from '.' import type { IJsonItem } from '../types' export function useProcedure(model: { [field: string]: any }): IJsonItem[] { @@ -38,111 +39,6 @@ export function useProcedure(model: { [field: string]: any }): IJsonItem[] { message: t('project.node.procedure_method_tips') } }, - { - type: 'custom-parameters', - field: 'localParams', - name: t('project.node.custom_parameters'), - children: [ - { - type: 'input', - field: 'prop', - span: 6, - props: { - placeholder: t('project.node.prop_tips'), - maxLength: 256 - }, - validate: { - trigger: ['input', 'blur'], - required: true, - validator(validate: any, value: string) { - if (!value) { - return new Error(t('project.node.prop_tips')) - } - - const sameItems = model.localParams.filter( - (item: { prop: string }) => item.prop === value - ) - - if (sameItems.length > 1) { - return new Error(t('project.node.prop_repeat')) - } - } - } - }, - { - type: 'select', - field: 'direct', - span: 4, - options: DIRECT_LIST, - value: 'IN' - }, - { - type: 'select', - field: 'type', - span: 6, - options: TYPE_LIST, - value: 'VARCHAR' - }, - { - type: 'input', - field: 'value', - span: 6, - props: { - placeholder: t('project.node.value_tips'), - maxLength: 256 - } - } - ] - } + ...useCustomParams({ model, field: 'localParams', isSimple: false }) ] } - -export const TYPE_LIST = [ - { - value: 'VARCHAR', - label: 'VARCHAR' - }, - { - value: 'INTEGER', - label: 'INTEGER' - }, - { - value: 'LONG', - label: 'LONG' - }, - { - value: 'FLOAT', - label: 'FLOAT' - }, - { - value: 'DOUBLE', - label: 'DOUBLE' - }, - { - value: 'DATE', - label: 'DATE' - }, - { - value: 'TIME', - label: 'TIME' - }, - { - value: 'TIMESTAMP', - label: 'TIMESTAMP' - }, - { - value: 'BOOLEAN', - label: 'BOOLEAN' - } -] - -export const DIRECT_LIST = [ - { - value: 'IN', - label: 'IN' - }, - { - value: 'OUT', - label: 'OUT' - } -] diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx index 94b9280075..beafcc4d49 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-save-modal.tsx @@ -115,7 +115,7 @@ export default defineComponent({ validator() { const props = new Set() - const keys = formValue.value.globalParams.map(item => item.key) + const keys = formValue.value.globalParams.map((item) => item.key) const keysSet = new Set(keys) if (keysSet.size !== keys.length) { return new Error(t('project.dag.prop_repeat')) diff --git a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx index 72dd510a14..199f5ad5b1 100644 --- a/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx +++ b/dolphinscheduler-ui-next/src/views/projects/workflow/components/dag/dag-toolbar.tsx @@ -481,7 +481,9 @@ export default defineComponent({ type='info' secondary round - disabled={props.definition?.processDefinition?.releaseState === 'ONLINE'} + disabled={ + props.definition?.processDefinition?.releaseState === 'ONLINE' + } onClick={() => { context.emit('saveModelToggle', true) }}