定时任务增加前后规则校验,不能包含 task 命令

This commit is contained in:
whyour 2023-10-10 23:06:01 +08:00
parent 5e73f0390f
commit 99f6073c8e
5 changed files with 34 additions and 8 deletions

View File

@ -459,6 +459,7 @@
"新增定时规则": "Add Timing Rules", "新增定时规则": "Add Timing Rules",
"运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands before executing the task, e.g., cp/mv/python3 xxx.py/node xxx.js", "运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands before executing the task, e.g., cp/mv/python3 xxx.py/node xxx.js",
"运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands after executing the task, e.g., cp/mv/python3 xxx.py/node xxx.js", "运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands after executing the task, e.g., cp/mv/python3 xxx.py/node xxx.js",
"请输入运行任务前要执行的命令": "Please enter the command to run before executing the task", "请输入运行任务前要执行的命令,不能包含 task 命令": "Please enter the command to run before executing the task, cannot contain task commands",
"请输入运行任务后要执行的命令": "Please enter the command to run after executing the task" "请输入运行任务后要执行的命令,不能包含 task 命令": "Please enter the command to run after executing the task, cannot contain task commands",
"不能包含 task 命令": "Cannot contain task commands"
} }

View File

@ -459,6 +459,7 @@
"新增定时规则": "新增定时规则", "新增定时规则": "新增定时规则",
"运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js", "运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js",
"运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js", "运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js",
"请输入运行任务前要执行的命令": "请输入运行任务前要执行的命令", "请输入运行任务前要执行的命令,不能包含 task 命令": "请输入运行任务前要执行的命令,不能包含 task 命令",
"请输入运行任务后要执行的命令": "请输入运行任务后要执行的命令" "请输入运行任务后要执行的命令,不能包含 task 命令": "请输入运行任务后要执行的命令,不能包含 task 命令",
"不能包含 task 命令": "不能包含 task 命令"
} }

View File

@ -153,11 +153,23 @@ const CronModal = ({
tooltip={intl.get( tooltip={intl.get(
'运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js', '运行任务前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js',
)} )}
rules={[
{
validator(rule, value) {
if (value.includes(' task ') || value.startsWith('task ')) {
return Promise.reject(intl.get('不能包含 task 命令'));
}
return Promise.resolve();
},
},
]}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={{ minRows: 1, maxRows: 5 }} autoSize={{ minRows: 1, maxRows: 5 }}
placeholder={intl.get('请输入运行任务前要执行的命令')} placeholder={intl.get(
'请输入运行任务前要执行的命令,不能包含 task 命令',
)}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
@ -166,11 +178,23 @@ const CronModal = ({
tooltip={intl.get( tooltip={intl.get(
'运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js', '运行任务后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js',
)} )}
rules={[
{
validator(rule, value) {
if (value.includes(' task ') || value.startsWith('task ')) {
return Promise.reject(intl.get('不能包含 task 命令'));
}
return Promise.resolve();
},
},
]}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={{ minRows: 1, maxRows: 5 }} autoSize={{ minRows: 1, maxRows: 5 }}
placeholder={intl.get('请输入运行任务后要执行的命令')} placeholder={intl.get(
'请输入运行任务后要执行的命令,不能包含 task 命令',
)}
/> />
</Form.Item> </Form.Item>
</Form> </Form>

View File

@ -92,7 +92,7 @@ const Dependence = () => {
const columns: any = [ const columns: any = [
{ {
title: intl.get('序号'), title: intl.get('序号'),
width: 80, width: 90,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return <span style={{ cursor: 'text' }}>{index + 1} </span>; return <span style={{ cursor: 'text' }}>{index + 1} </span>;
}, },

View File

@ -334,7 +334,7 @@ const Setting = () => {
dataSource={dataSource} dataSource={dataSource}
rowKey="id" rowKey="id"
size="middle" size="middle"
scroll={{ x: 768 }} scroll={{ x: 1000 }}
loading={loading} loading={loading}
/> />
), ),