删除订阅支持自动删除任务和脚本

This commit is contained in:
whyour
2023-07-30 21:15:46 +08:00
parent 2e27d4057e
commit b4e5db9da9
8 changed files with 59 additions and 11 deletions
+15 -1
View File
@@ -12,6 +12,7 @@ import {
Typography,
Input,
Tooltip,
Checkbox,
} from 'antd';
import {
ClockCircleOutlined,
@@ -240,6 +241,7 @@ const Subscription = () => {
const [logSubscription, setLogSubscription] = useState<any>();
const tableRef = useRef<HTMLDivElement>(null);
const tableScrollHeight = useTableScrollHeight(tableRef);
const deleteCheckRef = useRef(false);
const runSubscription = (record: any, index: number) => {
Modal.confirm({
@@ -335,6 +337,10 @@ const Subscription = () => {
setIsModalVisible(true);
};
const onCheckChange = (e) => {
deleteCheckRef.current = e.target.checked;
};
const delSubscription = (record: any, index: number) => {
Modal.confirm({
title: intl.get('确认删除'),
@@ -345,11 +351,19 @@ const Subscription = () => {
{record.name}
</Text>{' '}
{intl.get('吗')}
<div style={{ marginTop: 20 }}>
<Checkbox onChange={onCheckChange}>
{intl.get('同时删除关联任务和脚本')}
</Checkbox>
</div>
</>
),
onOk() {
request
.delete(`${config.apiPrefix}subscriptions`, { data: [record.id] })
.delete(`${config.apiPrefix}subscriptions`, {
data: [record.id],
params: { force: deleteCheckRef.current },
})
.then(({ code, data }) => {
if (code === 200) {
message.success('删除成功');