Skip to content

Commit

Permalink
adjust the sequence of alarm group and add validate (apache#15382)
Browse files Browse the repository at this point in the history
  • Loading branch information
ly109974 committed Dec 29, 2023
1 parent c3ffb13 commit 39be22a
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 31 deletions.
1 change: 1 addition & 0 deletions dolphinscheduler-ui/src/locales/en_US/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions dolphinscheduler-ui/src/locales/zh_CN/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ export default {
end: '结束',
none_send: '都不发',
success_send: '成功发',
none_send: '都不发',
failure_send: '失败发',
all_send: '成功或失败都发',
warning_group_tip: '请选择告警组',
whether_complement_data: '是否是补数',
schedule_date: '调度日期',
select_date: '日期选择',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ export default defineComponent({
v-model:value={this.startForm.warningType}
/>
</NFormItem>
{this.startForm.warningType !== 'NONE' && (
<NFormItem
label={t('project.workflow.alarm_group')}
path='warningGroupId'
required
>
<NSelect
options={this.alertGroups}
placeholder={t('project.workflow.please_choose')}
v-model:value={this.startForm.warningGroupId}
clearable
filterable
/>
</NFormItem>
)}
<NFormItem
label={t('project.workflow.workflow_priority')}
path='processInstancePriority'
Expand Down Expand Up @@ -338,20 +353,6 @@ export default defineComponent({
filterable
/>
</NFormItem>
{this.startForm.warningType !== 'NONE' && (
<NFormItem
label={t('project.workflow.alarm_group')}
path='warningGroupId'
>
<NSelect
options={this.alertGroups}
placeholder={t('project.workflow.please_choose')}
v-model:value={this.startForm.warningGroupId}
clearable
filterable
/>
</NFormItem>
)}
<NFormItem
label={t('project.workflow.complement_data')}
path='complement_data'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default defineComponent({
onConfirm={this.handleTiming}
confirmLoading={this.saving}
>
<NForm ref='timingFormRef'>
<NForm ref='timingFormRef' rules={this.rules}>
<NFormItem
label={t('project.workflow.start_and_stop_time')}
path='startEndTime'
Expand Down Expand Up @@ -440,6 +440,21 @@ export default defineComponent({
v-model:value={this.timingForm.warningType}
/>
</NFormItem>
{this.timingForm.warningType !== 'NONE' && (
<NFormItem
label={t('project.workflow.alarm_group')}
path='warningGroupId'
required
>
<NSelect
options={this.alertGroups}
placeholder={t('project.workflow.please_choose')}
v-model:value={this.timingForm.warningGroupId}
clearable
filterable
/>
</NFormItem>
)}
<NFormItem
label={t('project.workflow.workflow_priority')}
path='processInstancePriority'
Expand Down Expand Up @@ -482,20 +497,6 @@ export default defineComponent({
filterable
/>
</NFormItem>
{this.timingForm.warningType !== 'NONE' && (
<NFormItem
label={t('project.workflow.alarm_group')}
path='warningGroupId'
>
<NSelect
options={this.alertGroups}
placeholder={t('project.workflow.please_choose')}
v-model:value={this.timingForm.warningGroupId}
clearable
filterable
/>
</NFormItem>
)}
</NForm>
</Modal>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useForm = () => {
testFlag: 0,
version: null,
allLevelDependent: 'false',
executionOrder: 'DESC_ORDER',
executionOrder: 'DESC_ORDER'
},
saving: false,
rules: {
Expand All @@ -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'))
}
}
}
}
})
Expand All @@ -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({
Expand Down

0 comments on commit 39be22a

Please sign in to comment.