Browse Source

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

pull/602/head
ssongliu 2 years ago committed by GitHub
parent
commit
11d3e98155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      frontend/src/lang/modules/en.ts
  2. 5
      frontend/src/lang/modules/zh.ts
  3. 26
      frontend/src/views/cronjob/record/index.vue

6
frontend/src/lang/modules/en.ts

@ -78,7 +78,8 @@ const message = {
Rollbacking: 'Rollbacking from snapshot, please wait...',
},
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',
deleteSuccess: 'Delete Success',
loginSuccess: 'Login Success',
@ -628,8 +629,7 @@ const message = {
errHandle: 'Task execution failure',
noRecord: 'The execution did not generate any logs',
cleanData: 'Clean data',
cleanDataHelper:
'Clean data will remove all data generated by this scheduled task, including backup files, execution records, and log files.',
cleanDataHelper: 'Delete the backup file generated during this task.',
noLogs: 'No task output yet...',
errPath: 'Backup path [{0}] error, cannot download!',
},

5
frontend/src/lang/modules/zh.ts

@ -81,6 +81,7 @@ const message = {
},
msg: {
delete: '删除 操作不可回滚是否继续',
clean: '清空 操作不可回滚是否继续',
deleteTitle: '删除',
deleteSuccess: '删除成功',
loginSuccess: '登录成功',
@ -628,8 +629,8 @@ const message = {
errRecord: '错误的日志记录',
errHandle: '任务执行失败',
noRecord: '当前计划任务暂未产生记录',
cleanData: '删除数据',
cleanDataHelper: '删除数据将删除计划任务产生的所有数据包括备份文件执行记录以及日志文件',
cleanData: '删除备份文件',
cleanDataHelper: '删除该任务执行过程中产生的备份文件',
noLogs: '暂无任务输出...',
errPath: '备份路径 [{0}] 错误无法下载',
},

26
frontend/src/views/cronjob/record/index.vue

@ -70,7 +70,7 @@
{{ $t('commons.button.enable') }}
</el-button>
<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') }}
</el-button>
</span>
@ -576,9 +576,31 @@ const loadRecord = async (row: Cronjob.Record) => {
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 () => {
delLoading.value = true;
console.log(dialogData.value.rowData);
await cleanRecords(dialogData.value.rowData.id, cleanData.value)
.then(() => {
delLoading.value = false;

Loading…
Cancel
Save