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() { render() {
const { disabled, $slots, onAdd } = this const { disabled, $slots, onAdd } = this
return h(NSpace, null, { return h(
NSpace,
{ vertical: true, style: { width: '100%' } },
{
default: () => { default: () => {
return [ return [
renderSlot($slots, 'default', { disabled }), 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', add_pre_task_check_condition: 'Add pre task check condition',
switch_condition: 'Condition', switch_condition: 'Condition',
switch_branch_flow: 'Branch Flow', switch_branch_flow: 'Branch Flow',
switch_branch_flow_tips: 'Please select branch flow',
and: 'and', and: 'and',
or: 'or', or: 'or',
datax_custom_template: 'Custom Template', 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: '添加前置检查条件', add_pre_task_check_condition: '添加前置检查条件',
switch_condition: '条件', switch_condition: '条件',
switch_branch_flow: '分支流转', switch_branch_flow: '分支流转',
switch_branch_flow_tips: '请选择分支流转',
and: '且', and: '且',
or: '或', or: '或',
datax_custom_template: '自定义模板', datax_custom_template: '自定义模板',

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

@ -90,12 +90,9 @@ export function useSwitch(
return [ return [
{ {
type: 'multi-condition', type: 'custom-parameters',
field: 'dependTaskList', field: 'dependTaskList',
name: t('project.node.switch_condition'), name: t('project.node.switch_condition'),
validate: {
required: true
},
children: [ children: [
{ {
type: 'input', type: 'input',
@ -105,23 +102,22 @@ export function useSwitch(
loading: loading, loading: loading,
type: 'textarea', type: 'textarea',
autosize: { minRows: 2 } autosize: { minRows: 2 }
},
validate: {
trigger: ['input', 'blur'],
required: true
} }
}, },
{ (i = 0) => ({
type: 'select', type: 'select',
field: 'nextNode', field: 'nextNode',
span: 18, span: 22,
name: t('project.node.switch_branch_flow'), name: t('project.node.switch_branch_flow'),
options: branchFlowOptions, options: branchFlowOptions,
validate: { validate: {
trigger: ['input', 'blur'], 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: { props: {
loading: loading loading: loading
}, },
options: branchFlowOptions options: branchFlowOptions,
validate: {
trigger: ['input', 'blur'],
required: true,
message: t('project.node.switch_branch_flow_tips')
}
} }
] ]
} }

Loading…
Cancel
Save