Browse Source

[Fix][UI] Add validator to the next node field of the switch task. (#10898)

3.1.0-release
Amy0104 2 years ago committed by GitHub
parent
commit
51d6eae7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-ui/src/components/form/fields/custom-parameters.ts
  2. 1
      dolphinscheduler-ui/src/locales/en_US/project.ts
  3. 1
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  4. 25
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-switch.ts

8
dolphinscheduler-ui/src/components/form/fields/custom-parameters.ts

@ -36,7 +36,10 @@ const CustomParameters = defineComponent({
},
render() {
const { disabled, $slots, onAdd } = this
return h(NSpace, null, {
return h(
NSpace,
{ vertical: true, style: { width: '100%' } },
{
default: () => {
return [
renderSlot($slots, 'default', { disabled }),
@ -56,7 +59,8 @@ const CustomParameters = defineComponent({
)
]
}
})
}
)
}
})

1
dolphinscheduler-ui/src/locales/en_US/project.ts

@ -505,6 +505,7 @@ export default {
add_pre_task_check_condition: 'Add pre task check condition',
switch_condition: 'Condition',
switch_branch_flow: 'Branch Flow',
switch_branch_flow_tips: 'Please select branch flow',
and: 'and',
or: 'or',
datax_custom_template: 'Custom Template',

1
dolphinscheduler-ui/src/locales/zh_CN/project.ts

@ -498,6 +498,7 @@ export default {
add_pre_task_check_condition: '添加前置检查条件',
switch_condition: '条件',
switch_branch_flow: '分支流转',
switch_branch_flow_tips: '请选择分支流转',
and: '且',
or: '或',
datax_custom_template: '自定义模板',

25
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-switch.ts

@ -90,12 +90,9 @@ export function useSwitch(
return [
{
type: 'multi-condition',
type: 'custom-parameters',
field: 'dependTaskList',
name: t('project.node.switch_condition'),
validate: {
required: true
},
children: [
{
type: 'input',
@ -105,23 +102,22 @@ export function useSwitch(
loading: loading,
type: 'textarea',
autosize: { minRows: 2 }
},
validate: {
trigger: ['input', 'blur'],
required: true
}
},
{
(i = 0) => ({
type: 'select',
field: 'nextNode',
span: 18,
span: 22,
name: t('project.node.switch_branch_flow'),
options: branchFlowOptions,
validate: {
trigger: ['input', 'blur'],
required: true
validator: (unuse: any, value: string) => {
if (model.dependTaskList[i].condition && !value)
return new Error(t('project.node.switch_branch_flow_tips'))
}
}
})
]
},
{
@ -132,7 +128,12 @@ export function useSwitch(
props: {
loading: loading
},
options: branchFlowOptions
options: branchFlowOptions,
validate: {
trigger: ['input', 'blur'],
required: true,
message: t('project.node.switch_branch_flow_tips')
}
}
]
}

Loading…
Cancel
Save