Skip to content

Commit

Permalink
定时任务增加前后规则校验,不能包含 task 命令
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Oct 10, 2023
1 parent 5e73f03 commit 99f6073
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
"新增定时规则": "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 after executing the task, e.g., cp/mv/python3 xxx.py/node xxx.js",
"请输入运行任务前要执行的命令": "Please enter the command to run before executing the task",
"请输入运行任务后要执行的命令": "Please enter the command to run after executing the task"
"请输入运行任务前要执行的命令,不能包含 task 命令": "Please enter the command to run before executing the task, cannot contain task commands",
"请输入运行任务后要执行的命令,不能包含 task 命令": "Please enter the command to run after executing the task, cannot contain task commands",
"不能包含 task 命令": "Cannot contain task commands"
}
5 changes: 3 additions & 2 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"请输入运行任务前要执行的命令": "请输入运行任务前要执行的命令",
"请输入运行任务后要执行的命令": "请输入运行任务后要执行的命令"
"请输入运行任务前要执行的命令,不能包含 task 命令": "请输入运行任务前要执行的命令,不能包含 task 命令",
"请输入运行任务后要执行的命令,不能包含 task 命令": "请输入运行任务后要执行的命令,不能包含 task 命令",
"不能包含 task 命令": "不能包含 task 命令"
}
28 changes: 26 additions & 2 deletions src/pages/crontab/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,23 @@ const CronModal = ({
tooltip={intl.get(
'运行任务前执行的命令,比如 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
rows={4}
autoSize={{ minRows: 1, maxRows: 5 }}
placeholder={intl.get('请输入运行任务前要执行的命令')}
placeholder={intl.get(
'请输入运行任务前要执行的命令,不能包含 task 命令',
)}
/>
</Form.Item>
<Form.Item
Expand All @@ -166,11 +178,23 @@ const CronModal = ({
tooltip={intl.get(
'运行任务后执行的命令,比如 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
rows={4}
autoSize={{ minRows: 1, maxRows: 5 }}
placeholder={intl.get('请输入运行任务后要执行的命令')}
placeholder={intl.get(
'请输入运行任务后要执行的命令,不能包含 task 命令',
)}
/>
</Form.Item>
</Form>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dependence/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Dependence = () => {
const columns: any = [
{
title: intl.get('序号'),
width: 80,
width: 90,
render: (text: string, record: any, index: number) => {
return <span style={{ cursor: 'text' }}>{index + 1} </span>;
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const Setting = () => {
dataSource={dataSource}
rowKey="id"
size="middle"
scroll={{ x: 768 }}
scroll={{ x: 1000 }}
loading={loading}
/>
),
Expand Down

0 comments on commit 99f6073

Please sign in to comment.