mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 09:34:31 +08:00
定时任务支持多个定时规则
This commit is contained in:
@@ -451,3 +451,9 @@ body[data-mode='phone'] header {
|
||||
.ant-table.ant-table-middle tfoot > tr > td {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
body[data-dark='true'] {
|
||||
.ant-popover-arrow-content {
|
||||
--antd-arrow-background-color: rgb(24, 26, 27);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,5 +453,6 @@
|
||||
"主题": "Theme",
|
||||
"语言": "Language",
|
||||
"中...": "ing...",
|
||||
"请选择操作符": "Please select operator"
|
||||
"请选择操作符": "Please select operator",
|
||||
"新增定时规则": "New Timing Rules"
|
||||
}
|
||||
|
||||
@@ -453,5 +453,6 @@
|
||||
"主题": "主题",
|
||||
"语言": "语言",
|
||||
"中...": "中...",
|
||||
"请选择操作符": "请选择操作符"
|
||||
"请选择操作符": "请选择操作符",
|
||||
"新增定时规则": "新增定时规则"
|
||||
}
|
||||
|
||||
@@ -183,6 +183,20 @@ const Crontab = () => {
|
||||
sorter: {
|
||||
compare: (a, b) => a.schedule.localeCompare(b.schedule),
|
||||
},
|
||||
render: (text, record) => {
|
||||
return record.extra_schedules?.length ? (
|
||||
<Popover
|
||||
placement="right"
|
||||
content={record.extra_schedules?.map((x) => (
|
||||
<div>{x.schedule}</div>
|
||||
))}
|
||||
>
|
||||
{text}
|
||||
</Popover>
|
||||
) : (
|
||||
text
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: intl.get('最后运行时长'),
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import intl from 'react-intl-universal';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Modal, message, Input, Form, Button } from 'antd';
|
||||
import { Modal, message, Input, Form, Button, Space } from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cronParse from 'cron-parser';
|
||||
import EditableTagGroup from '@/components/tag';
|
||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
|
||||
const CronModal = ({
|
||||
cron,
|
||||
@@ -107,6 +108,38 @@ const CronModal = ({
|
||||
>
|
||||
<Input placeholder={intl.get('秒(可选) 分 时 天 月 周')} />
|
||||
</Form.Item>
|
||||
<Form.List name="extra_schedules">
|
||||
{(fields, { add, remove }, { errors }) => (
|
||||
<>
|
||||
{fields.map(({ key, name, ...restField }) => (
|
||||
<Form.Item key={key} noStyle>
|
||||
<Space className="view-create-modal-sorts" align="baseline">
|
||||
<Form.Item
|
||||
{...restField}
|
||||
name={[name, 'schedule']}
|
||||
rules={[{ required: true }]}
|
||||
>
|
||||
<Input
|
||||
placeholder={intl.get('秒(可选) 分 时 天 月 周')}
|
||||
/>
|
||||
</Form.Item>
|
||||
<MinusCircleOutlined
|
||||
className="dynamic-delete-button"
|
||||
onClick={() => remove(name)}
|
||||
/>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
))}
|
||||
<Form.Item>
|
||||
<a onClick={() => add({ schedule: '' })}>
|
||||
<PlusOutlined />
|
||||
{intl.get('新增定时规则')}
|
||||
</a>
|
||||
</Form.Item>
|
||||
<Form.ErrorList errors={errors} />
|
||||
</>
|
||||
)}
|
||||
</Form.List>
|
||||
<Form.Item name="labels" label={intl.get('标签')}>
|
||||
<EditableTagGroup />
|
||||
</Form.Item>
|
||||
|
||||
@@ -35,4 +35,6 @@ export interface ICrontab {
|
||||
last_running_time?: number;
|
||||
last_execution_time?: number;
|
||||
nextRunTime: Date;
|
||||
sub_id: number;
|
||||
extra_schedules?: Array<{ schedule: string; }>;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ const ViewCreateModal = ({
|
||||
<Input placeholder={intl.get('请输入视图名称')} />
|
||||
</Form.Item>
|
||||
<Form.List name="filters">
|
||||
{(fields, { add, remove }) => (
|
||||
{(fields, { add, remove }, { errors }) => (
|
||||
<div
|
||||
style={{ position: 'relative' }}
|
||||
className={`view-filters-container ${
|
||||
@@ -297,12 +297,13 @@ const ViewCreateModal = ({
|
||||
{intl.get('新增筛选条件')}
|
||||
</a>
|
||||
</Form.Item>
|
||||
<Form.ErrorList errors={errors} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Form.List>
|
||||
<Form.List name="sorts">
|
||||
{(fields, { add, remove }) => (
|
||||
{(fields, { add, remove }, { errors }) => (
|
||||
<div
|
||||
style={{ position: 'relative' }}
|
||||
className={`view-filters-container ${
|
||||
@@ -372,6 +373,7 @@ const ViewCreateModal = ({
|
||||
{intl.get('新增排序方式')}
|
||||
</a>
|
||||
</Form.Item>
|
||||
<Form.ErrorList errors={errors} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user