fix: 计划任务删除提示样式优化 (#600)

pull/602/head
ssongliu 2 years ago committed by GitHub
parent 01185306f2
commit 11d3e98155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,7 +78,8 @@ const message = {
Rollbacking: 'Rollbacking from snapshot, please wait...', Rollbacking: 'Rollbacking from snapshot, please wait...',
}, },
msg: { msg: {
delete: 'This operation cannot be rolled back. Do you want to continue', delete: 'This operation delete cannot be rolled back. Do you want to continue?',
clean: 'This operation clean cannot be rolled back. Do you want to continue?',
deleteTitle: 'Delete', deleteTitle: 'Delete',
deleteSuccess: 'Delete Success', deleteSuccess: 'Delete Success',
loginSuccess: 'Login Success', loginSuccess: 'Login Success',
@ -628,8 +629,7 @@ const message = {
errHandle: 'Task execution failure', errHandle: 'Task execution failure',
noRecord: 'The execution did not generate any logs', noRecord: 'The execution did not generate any logs',
cleanData: 'Clean data', cleanData: 'Clean data',
cleanDataHelper: cleanDataHelper: 'Delete the backup file generated during this task.',
'Clean data will remove all data generated by this scheduled task, including backup files, execution records, and log files.',
noLogs: 'No task output yet...', noLogs: 'No task output yet...',
errPath: 'Backup path [{0}] error, cannot download!', errPath: 'Backup path [{0}] error, cannot download!',
}, },

@ -81,6 +81,7 @@ const message = {
}, },
msg: { msg: {
delete: ' ', delete: ' ',
clean: ' ',
deleteTitle: '', deleteTitle: '',
deleteSuccess: '', deleteSuccess: '',
loginSuccess: '', loginSuccess: '',
@ -628,8 +629,8 @@ const message = {
errRecord: '', errRecord: '',
errHandle: '', errHandle: '',
noRecord: '', noRecord: '',
cleanData: '', cleanData: '',
cleanDataHelper: '', cleanDataHelper: '',
noLogs: '...', noLogs: '...',
errPath: ' [{0}] ', errPath: ' [{0}] ',
}, },

@ -70,7 +70,7 @@
{{ $t('commons.button.enable') }} {{ $t('commons.button.enable') }}
</el-button> </el-button>
<el-divider direction="vertical" /> <el-divider direction="vertical" />
<el-button type="primary" @click="deleteVisiable = true" link> <el-button :disabled="!hasRecords" type="primary" @click="onClean" link>
{{ $t('commons.button.clean') }} {{ $t('commons.button.clean') }}
</el-button> </el-button>
</span> </span>
@ -576,9 +576,31 @@ const loadRecord = async (row: Cronjob.Record) => {
currentRecordDetail.value = res.data; currentRecordDetail.value = res.data;
} }
}; };
const onClean = async () => {
if (dialogData.value.rowData.type === 'shell' || dialogData.value.rowData.type === 'curl') {
ElMessageBox.confirm(i18n.global.t('commons.msg.clean'), i18n.global.t('commons.msg.deleteTitle'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'warning',
}).then(async () => {
await cleanRecords(dialogData.value.rowData.id, cleanData.value)
.then(() => {
delLoading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search(true);
})
.catch(() => {
delLoading.value = false;
});
});
} else {
deleteVisiable.value = true;
}
};
const cleanRecord = async () => { const cleanRecord = async () => {
delLoading.value = true; delLoading.value = true;
console.log(dialogData.value.rowData);
await cleanRecords(dialogData.value.rowData.id, cleanData.value) await cleanRecords(dialogData.value.rowData.id, cleanData.value)
.then(() => { .then(() => {
delLoading.value = false; delLoading.value = false;

Loading…
Cancel
Save