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. 44
      dolphinscheduler-ui/src/components/form/fields/custom-parameters.ts
  2. 31
      dolphinscheduler-ui/src/locales/en_US/project.ts
  3. 9
      dolphinscheduler-ui/src/locales/zh_CN/project.ts
  4. 27
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-switch.ts

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

@ -36,27 +36,31 @@ const CustomParameters = defineComponent({
}, },
render() { render() {
const { disabled, $slots, onAdd } = this const { disabled, $slots, onAdd } = this
return h(NSpace, null, { return h(
default: () => { NSpace,
return [ { vertical: true, style: { width: '100%' } },
renderSlot($slots, 'default', { disabled }), {
h( default: () => {
NButton, return [
{ renderSlot($slots, 'default', { disabled }),
circle: true, h(
size: 'small', NButton,
type: 'info', {
class: 'btn-create-custom-parameter', circle: true,
disabled, size: 'small',
onClick: onAdd type: 'info',
}, class: 'btn-create-custom-parameter',
{ disabled,
icon: () => h(PlusOutlined) onClick: onAdd
} },
) {
] icon: () => h(PlusOutlined)
}
)
]
}
} }
}) )
} }
}) })

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

@ -193,9 +193,9 @@ export default {
project_name: 'Project Name', project_name: 'Project Name',
project_tips: 'Please select project name', project_tips: 'Please select project name',
workflow_relation_no_data_result_title: workflow_relation_no_data_result_title:
'Can not find any relations of workflows.', 'Can not find any relations of workflows.',
workflow_relation_no_data_result_desc: workflow_relation_no_data_result_desc:
'There is not any workflows. Please create a workflow, and then visit this page again.' 'There is not any workflows. Please create a workflow, and then visit this page again.'
}, },
task: { task: {
cancel_full_screen: 'Cancel full screen', cancel_full_screen: 'Cancel full screen',
@ -308,7 +308,7 @@ export default {
task_priority: 'Task priority', task_priority: 'Task priority',
worker_group: 'Worker group', worker_group: 'Worker group',
worker_group_tips: worker_group_tips:
'The Worker group no longer exists, please select the correct Worker group!', 'The Worker group no longer exists, please select the correct Worker group!',
environment_name: 'Environment Name', environment_name: 'Environment Name',
task_group_name: 'Task group name', task_group_name: 'Task group name',
task_group_queue_priority: 'Priority', task_group_queue_priority: 'Priority',
@ -335,11 +335,11 @@ export default {
success: 'Success', success: 'Success',
failed: 'Failed', failed: 'Failed',
backfill_tips: backfill_tips:
'The newly created sub-Process has not yet been executed and cannot enter the sub-Process', 'The newly created sub-Process has not yet been executed and cannot enter the sub-Process',
task_instance_tips: task_instance_tips:
'The task has not been executed and cannot enter the sub-Process', 'The task has not been executed and cannot enter the sub-Process',
branch_tips: branch_tips:
'Cannot select the same node for successful branch flow and failed branch flow', 'Cannot select the same node for successful branch flow and failed branch flow',
timeout_alarm: 'Timeout alarm', timeout_alarm: 'Timeout alarm',
timeout_strategy: 'Timeout strategy', timeout_strategy: 'Timeout strategy',
timeout_strategy_tips: 'Timeout strategy must be selected', timeout_strategy_tips: 'Timeout strategy must be selected',
@ -399,8 +399,8 @@ export default {
parallelism_tips: 'Please enter Parallelism', parallelism_tips: 'Please enter Parallelism',
parallelism_number_tips: 'Parallelism number should be positive integer', parallelism_number_tips: 'Parallelism number should be positive integer',
parallelism_complement_tips: parallelism_complement_tips:
'If there are a large number of tasks requiring complement, you can use the custom parallelism to ' + 'If there are a large number of tasks requiring complement, you can use the custom parallelism to ' +
'set the complement task thread to a reasonable value to avoid too large impact on the server.', 'set the complement task thread to a reasonable value to avoid too large impact on the server.',
task_manager_number: 'TaskManager Number', task_manager_number: 'TaskManager Number',
task_manager_number_tips: 'Please enter TaskManager number', task_manager_number_tips: 'Please enter TaskManager number',
http_url: 'Http Url', http_url: 'Http Url',
@ -435,7 +435,7 @@ export default {
procedure_method: 'SQL Statement', procedure_method: 'SQL Statement',
procedure_method_tips: 'Please enter the procedure script', procedure_method_tips: 'Please enter the procedure script',
procedure_method_snippet: procedure_method_snippet:
'--Please enter the procedure script \n\n--call procedure:call <procedure-name>[(<arg1>,<arg2>, ...)]\n\n--call function:?= call <procedure-name>[(<arg1>,<arg2>, ...)]', '--Please enter the procedure script \n\n--call procedure:call <procedure-name>[(<arg1>,<arg2>, ...)]\n\n--call function:?= call <procedure-name>[(<arg1>,<arg2>, ...)]',
start: 'Start', start: 'Start',
edit: 'Edit', edit: 'Edit',
copy: 'Copy', copy: 'Copy',
@ -501,10 +501,11 @@ export default {
sea_tunnel_master_url: 'Master URL', sea_tunnel_master_url: 'Master URL',
sea_tunnel_queue: 'Queue', sea_tunnel_queue: 'Queue',
sea_tunnel_master_url_tips: sea_tunnel_master_url_tips:
'Please enter the master url, e.g., 127.0.0.1:7077', 'Please enter the master url, e.g., 127.0.0.1:7077',
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',
@ -618,24 +619,24 @@ export default {
'Please enter the paragraph id of your zeppelin paragraph', 'Please enter the paragraph id of your zeppelin paragraph',
jupyter_conda_env_name: 'condaEnvName', jupyter_conda_env_name: 'condaEnvName',
jupyter_conda_env_name_tips: jupyter_conda_env_name_tips:
'Please enter the conda environment name of papermill', 'Please enter the conda environment name of papermill',
jupyter_input_note_path: 'inputNotePath', jupyter_input_note_path: 'inputNotePath',
jupyter_input_note_path_tips: 'Please enter the input jupyter note path', jupyter_input_note_path_tips: 'Please enter the input jupyter note path',
jupyter_output_note_path: 'outputNotePath', jupyter_output_note_path: 'outputNotePath',
jupyter_output_note_path_tips: 'Please enter the output jupyter note path', jupyter_output_note_path_tips: 'Please enter the output jupyter note path',
jupyter_parameters: 'parameters', jupyter_parameters: 'parameters',
jupyter_parameters_tips: jupyter_parameters_tips:
'Please enter the parameters for jupyter parameterization', 'Please enter the parameters for jupyter parameterization',
jupyter_kernel: 'kernel', jupyter_kernel: 'kernel',
jupyter_kernel_tips: 'Please enter the jupyter kernel name', jupyter_kernel_tips: 'Please enter the jupyter kernel name',
jupyter_engine: 'engine', jupyter_engine: 'engine',
jupyter_engine_tips: 'Please enter the engine name', jupyter_engine_tips: 'Please enter the engine name',
jupyter_execution_timeout: 'executionTimeout', jupyter_execution_timeout: 'executionTimeout',
jupyter_execution_timeout_tips: jupyter_execution_timeout_tips:
'Please enter the execution timeout for each jupyter note cell', 'Please enter the execution timeout for each jupyter note cell',
jupyter_start_timeout: 'startTimeout', jupyter_start_timeout: 'startTimeout',
jupyter_start_timeout_tips: jupyter_start_timeout_tips:
'Please enter the start timeout for jupyter kernel', 'Please enter the start timeout for jupyter kernel',
jupyter_others: 'others', jupyter_others: 'others',
jupyter_others_tips: jupyter_others_tips:
'Please enter the other options you need for papermill', 'Please enter the other options you need for papermill',
@ -648,7 +649,7 @@ export default {
mlflow_isSearchParams: 'Search Parameters', mlflow_isSearchParams: 'Search Parameters',
mlflow_dataPath: 'Data Path', mlflow_dataPath: 'Data Path',
mlflow_dataPath_tips: mlflow_dataPath_tips:
' The absolute path of the file or folder. Ends with .csv for file or contain train.csv and test.csv for folder', ' The absolute path of the file or folder. Ends with .csv for file or contain train.csv and test.csv for folder',
mlflow_dataPath_error_tips: ' data data can not be empty ', mlflow_dataPath_error_tips: ' data data can not be empty ',
mlflow_experimentName: 'Experiment Name', mlflow_experimentName: 'Experiment Name',
mlflow_experimentName_tips: 'experiment_001', mlflow_experimentName_tips: 'experiment_001',

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

@ -195,7 +195,7 @@ export default {
project_tips: '请选择项目', project_tips: '请选择项目',
workflow_relation_no_data_result_title: '工作流关系不存在', workflow_relation_no_data_result_title: '工作流关系不存在',
workflow_relation_no_data_result_desc: workflow_relation_no_data_result_desc:
'目前没有任何工作流,请先创建工作流,再访问该页面' '目前没有任何工作流,请先创建工作流,再访问该页面'
}, },
task: { task: {
cancel_full_screen: '取消全屏', cancel_full_screen: '取消全屏',
@ -394,7 +394,7 @@ export default {
parallelism_tips: '请输入并行度', parallelism_tips: '请输入并行度',
parallelism_number_tips: '并行度必须为正整数', parallelism_number_tips: '并行度必须为正整数',
parallelism_complement_tips: parallelism_complement_tips:
'如果存在大量任务需要补数时,可以利用自定义并行度将补数的任务线程设置成合理的数值,避免对服务器造成过大的影响', '如果存在大量任务需要补数时,可以利用自定义并行度将补数的任务线程设置成合理的数值,避免对服务器造成过大的影响',
task_manager_number: 'TaskManager数量', task_manager_number: 'TaskManager数量',
task_manager_number_tips: '请输入TaskManager数量', task_manager_number_tips: '请输入TaskManager数量',
http_url: '请求地址', http_url: '请求地址',
@ -429,7 +429,7 @@ export default {
procedure_method: 'SQL语句', procedure_method: 'SQL语句',
procedure_method_tips: '请输入存储脚本', procedure_method_tips: '请输入存储脚本',
procedure_method_snippet: procedure_method_snippet:
'--请输入存储脚本 \n\n--调用存储过程: call <procedure-name>[(<arg1>,<arg2>, ...)] \n\n--调用存储函数:?= call <procedure-name>[(<arg1>,<arg2>, ...)]', '--请输入存储脚本 \n\n--调用存储过程: call <procedure-name>[(<arg1>,<arg2>, ...)] \n\n--调用存储函数:?= call <procedure-name>[(<arg1>,<arg2>, ...)]',
start: '运行', start: '运行',
edit: '编辑', edit: '编辑',
copy: '复制节点', copy: '复制节点',
@ -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: '自定义模板',
@ -637,7 +638,7 @@ export default {
mlflow_isSearchParams: '是否搜索参数', mlflow_isSearchParams: '是否搜索参数',
mlflow_dataPath: '数据路径', mlflow_dataPath: '数据路径',
mlflow_dataPath_tips: mlflow_dataPath_tips:
' 文件/文件夹的绝对路径, 若文件需以.csv结尾, 文件夹需包含train.csv和test.csv ', ' 文件/文件夹的绝对路径, 若文件需以.csv结尾, 文件夹需包含train.csv和test.csv ',
mlflow_dataPath_error_tips: ' 数据路径不能为空 ', mlflow_dataPath_error_tips: ' 数据路径不能为空 ',
mlflow_experimentName: '实验名称', mlflow_experimentName: '实验名称',
mlflow_experimentName_tips: 'experiment_001', mlflow_experimentName_tips: 'experiment_001',

27
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