mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 17:54:32 +08:00
订阅支持自动添加和删除任务设置
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.inline-form-item {
|
||||
margin-bottom: 0;
|
||||
|
||||
.ant-form-item {
|
||||
display: inline-block;
|
||||
width: 50%;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Modal, message, InputNumber, Form, Radio, Select, Input } from 'antd';
|
||||
import {
|
||||
Modal,
|
||||
message,
|
||||
InputNumber,
|
||||
Form,
|
||||
Radio,
|
||||
Select,
|
||||
Input,
|
||||
Switch,
|
||||
} from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cron_parser from 'cron-parser';
|
||||
@@ -26,7 +35,11 @@ const SubscriptionModal = ({
|
||||
const handleOk = async (values: any) => {
|
||||
setLoading(true);
|
||||
const method = subscription ? 'put' : 'post';
|
||||
const payload = { ...values };
|
||||
const payload = {
|
||||
...values,
|
||||
autoAddCron: Boolean(values.autoAddCron),
|
||||
autoDelCron: Boolean(values.autoDelCron),
|
||||
};
|
||||
if (subscription) {
|
||||
payload.id = subscription.id;
|
||||
}
|
||||
@@ -110,8 +123,8 @@ const SubscriptionModal = ({
|
||||
}
|
||||
};
|
||||
|
||||
const numberChange = (value: number) => {
|
||||
setIntervalNumber(value);
|
||||
const numberChange = (value: number | null) => {
|
||||
setIntervalNumber(value || 1);
|
||||
if (!value) {
|
||||
onChange?.(null);
|
||||
} else {
|
||||
@@ -452,6 +465,24 @@ const SubscriptionModal = ({
|
||||
}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item style={{ marginBottom: 0 }} className="inline-form-item">
|
||||
<Form.Item
|
||||
name="autoAddCron"
|
||||
label="自动添加任务"
|
||||
valuePropName="checked"
|
||||
initialValue={true}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="autoDelCron"
|
||||
label="自动删除任务"
|
||||
valuePropName="checked"
|
||||
initialValue={true}
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user