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

This commit is contained in:
ssongliu 2023-04-12 18:56:33 +08:00 committed by GitHub
parent 01185306f2
commit 11d3e98155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

View File

@ -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!',
}, },

View File

@ -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}] 错误无法下载',
}, },

View File

@ -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;