From fd74cf16cbc7be39b02a6bd688ea5633f9757a83 Mon Sep 17 00:00:00 2001 From: liyou <103415610+ly109974@users.noreply.github.com> Date: Tue, 2 Jan 2024 17:36:30 +0800 Subject: [PATCH] adjust the sequence of alarm group and add validate (#15382) (#15384) --- .../src/locales/en_US/project.ts | 1 + .../src/locales/zh_CN/project.ts | 1 + .../definition/components/start-modal.tsx | 29 ++++++++--------- .../definition/components/timing-modal.tsx | 31 ++++++++++--------- .../definition/components/use-form.ts | 28 +++++++++++++++-- 5 files changed, 59 insertions(+), 31 deletions(-) diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts index 5feac80707dd..573558b51ee9 100644 --- a/dolphinscheduler-ui/src/locales/en_US/project.ts +++ b/dolphinscheduler-ui/src/locales/en_US/project.ts @@ -129,6 +129,7 @@ export default { success_send: 'Success', failure_send: 'Failure', all_send: 'All', + warning_group_tip: 'Please select alarm group', whether_complement_data: 'Whether it is a complement process?', schedule_date: 'Schedule date', select_date: 'Select Date', diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts index 94d21306256c..622d41d5aaf2 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts @@ -129,6 +129,7 @@ export default { success_send: '成功发', failure_send: '失败发', all_send: '成功或失败都发', + warning_group_tip: '请选择告警组', whether_complement_data: '是否是补数', schedule_date: '调度日期', select_date: '日期选择', diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx index 95d53dc2ce82..83443a00c1b9 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx @@ -293,6 +293,21 @@ export default defineComponent({ v-model:value={this.startForm.warningType} /> + {this.startForm.warningType !== 'NONE' && ( + + + + )} - {this.startForm.warningType !== 'NONE' && ( - - - - )} - + + {this.timingForm.warningType !== 'NONE' && ( + + + + )} - {this.timingForm.warningType !== 'NONE' && ( - - - - )} ) diff --git a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-form.ts b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-form.ts index 2c5cf6820ab3..32b02a788030 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-form.ts +++ b/dolphinscheduler-ui/src/views/projects/workflow/definition/components/use-form.ts @@ -71,7 +71,7 @@ export const useForm = () => { testFlag: 0, version: null, allLevelDependent: 'false', - executionOrder: 'DESC_ORDER', + executionOrder: 'DESC_ORDER' }, saving: false, rules: { @@ -91,6 +91,17 @@ export const useForm = () => { return new Error(t('project.workflow.schedule_date_limit')) } } + }, + warningGroupId: { + trigger: ['blur'], + validator() { + if ( + startState.startForm.warningType !== 'NONE' && + !startState.startForm.warningGroupId + ) { + return new Error(t('project.workflow.warning_group_tip')) + } + } } } }) @@ -112,7 +123,20 @@ export const useForm = () => { tenantCode: 'default', environmentCode: null as null | string }, - saving: false + saving: false, + rules: { + warningGroupId: { + trigger: ['blur'], + validator() { + if ( + timingState.timingForm.warningType !== 'NONE' && + !timingState.timingForm.warningGroupId + ) { + return new Error(t('project.workflow.warning_group_tip')) + } + } + } + } }) const copyState = reactive({