mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-26 16:56:22 +08:00
fix: 计划任务删除弹窗优化 (#1140)
This commit is contained in:
parent
c2629e3945
commit
c8237d59be
2 changed files with 39 additions and 2 deletions
|
|
@ -85,7 +85,7 @@ func (u *CronjobService) CleanRecord(req dto.CronjobClean) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if req.CleanData && cronjob.Type != "shell" && cronjob.Type != "curl" {
|
if req.CleanData && (cronjob.Type == "database" || cronjob.Type == "website" || cronjob.Type == "directory") {
|
||||||
cronjob.RetainCopies = 0
|
cronjob.RetainCopies = 0
|
||||||
backup, err := backupRepo.Get(commonRepo.WithByID(uint(cronjob.TargetDirID)))
|
backup, err := backupRepo.Get(commonRepo.WithByID(uint(cronjob.TargetDirID)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -243,10 +243,47 @@ const onOpenDialog = async (
|
||||||
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
||||||
if (row) {
|
if (row) {
|
||||||
deleteCronjobID.value = row.id;
|
deleteCronjobID.value = row.id;
|
||||||
|
if (row.type !== 'database' && row.type !== 'website' && row.type !== 'directory') {
|
||||||
|
deleteMessageBox();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
deleteVisiable.value = true;
|
||||||
} else {
|
} else {
|
||||||
deleteCronjobID.value = 0;
|
deleteCronjobID.value = 0;
|
||||||
|
for (const item of selects.value) {
|
||||||
|
if (item.type === 'database' || item.type === 'website' || item.type === 'directory') {
|
||||||
|
deleteVisiable.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deleteMessageBox();
|
||||||
}
|
}
|
||||||
deleteVisiable.value = true;
|
};
|
||||||
|
|
||||||
|
const deleteMessageBox = async () => {
|
||||||
|
let ids: Array<number> = [];
|
||||||
|
if (deleteCronjobID.value) {
|
||||||
|
ids.push(deleteCronjobID.value);
|
||||||
|
} else {
|
||||||
|
selects.value.forEach((item: Cronjob.CronjobInfo) => {
|
||||||
|
ids.push(item.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(i18n.global.t('commons.msg.delete'), i18n.global.t('commons.msg.deleteTitle'), {
|
||||||
|
confirmButtonText: i18n.global.t('commons.button.confirm'),
|
||||||
|
cancelButtonText: i18n.global.t('commons.button.cancel'),
|
||||||
|
type: 'info',
|
||||||
|
}).then(async () => {
|
||||||
|
await deleteCronjob(ids, false)
|
||||||
|
.then(() => {
|
||||||
|
delLoading.value = false;
|
||||||
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
|
search();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
delLoading.value = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmitDelete = async () => {
|
const onSubmitDelete = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue