feat: 增加备份恢复确认框 (#3711)

This commit is contained in:
ssongliu 2024-01-26 13:46:04 +08:00 committed by GitHub
parent a6891711b7
commit 527c8143a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 72 additions and 48 deletions

View File

@ -122,40 +122,58 @@ const search = async () => {
};
const onBackup = async () => {
let params = {
type: type.value,
name: name.value,
detailName: detailName.value,
};
loading.value = true;
await handleBackup(params)
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search();
})
.catch(() => {
loading.value = false;
});
ElMessageBox.confirm(
i18n.global.t('commons.msg.backupHelper', [name.value + '( ' + detailName.value + ' )']),
i18n.global.t('commons.button.backup'),
{
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
},
).then(async () => {
let params = {
type: type.value,
name: name.value,
detailName: detailName.value,
};
loading.value = true;
await handleBackup(params)
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search();
})
.catch(() => {
loading.value = false;
});
});
};
const onRecover = async (row: Backup.RecordInfo) => {
let params = {
source: row.source,
type: type.value,
name: name.value,
detailName: detailName.value,
file: row.fileDir + '/' + row.fileName,
};
loading.value = true;
await handleRecover(params)
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
.catch(() => {
loading.value = false;
});
ElMessageBox.confirm(
i18n.global.t('commons.msg.recoverHelper', [row.fileName]),
i18n.global.t('commons.button.recover'),
{
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
},
).then(async () => {
let params = {
source: row.source,
type: type.value,
name: name.value,
detailName: detailName.value,
file: row.fileDir + '/' + row.fileName,
};
loading.value = true;
await handleRecover(params)
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
.catch(() => {
loading.value = false;
});
});
};
const onDownload = async (row: Backup.RecordInfo) => {

View File

@ -169,18 +169,21 @@ const search = async () => {
};
const onRecover = async (row: File.File) => {
let params = {
source: 'LOCAL',
type: type.value,
name: name.value,
detailName: detailName.value,
file: baseDir.value + row.name,
};
ElMessageBox.confirm(i18n.global.t('commons.msg.recoverHelper'), i18n.global.t('commons.button.recover'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'info',
}).then(async () => {
ElMessageBox.confirm(
i18n.global.t('commons.msg.recoverHelper', [row.name]),
i18n.global.t('commons.button.recover'),
{
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
},
).then(async () => {
let params = {
source: 'LOCAL',
type: type.value,
name: name.value,
detailName: detailName.value,
file: baseDir.value + row.name,
};
loading.value = true;
await handleRecoverByUpload(params)
.then(() => {

View File

@ -125,7 +125,8 @@ const message = {
confirmNoNull: 'Make sure the value {0} is not empty',
errPort: 'Incorrect port information, please confirm!',
remove: 'Remove',
recoverHelper: 'The current data will be overwritten. Do you want to continue?',
backupHelper: 'The current operation will back up {0}. Do you want to proceed?',
recoverHelper: 'Restoring from {0} file. This operation is irreversible. Do you want to continue?',
},
login: {
username: 'UserName',

View File

@ -91,7 +91,7 @@ const message = {
loadingText: {
Upgrading: '系統升級中請稍候...',
Restarting: '系統重啟中請稍候...',
Recovering: '快照恢復中請稍候...',
Recovering: '快照恢復中請稍候...',
Rollbacking: '快照回滾中請稍候...',
},
msg: {
@ -126,7 +126,8 @@ const message = {
confirmNoNull: '請確認 {0} 值不為空',
errPort: '錯誤的端口信息請確認',
remove: '移出',
recoverHelper: '當前數據將被覆蓋是否繼續',
backupHelper: '當前操作將對 {0} 進行備份是否繼續',
recoverHelper: '將從 {0} 文件進行恢復該操作不可回滾是否繼續',
},
login: {
username: '用戶名',

View File

@ -91,7 +91,7 @@ const message = {
loadingText: {
Upgrading: '系统升级中请稍候...',
Restarting: '系统重启中请稍候...',
Recovering: '快照恢复中请稍候...',
Recovering: '快照恢复中请稍候...',
Rollbacking: '快照回滚中请稍候...',
},
msg: {
@ -126,7 +126,8 @@ const message = {
confirmNoNull: '请确认 {0} 值不为空',
errPort: '错误的端口信息请确认',
remove: '移出',
recoverHelper: '当前数据将被覆盖是否继续',
backupHelper: '当前操作将对 {0} 进行备份是否继续',
recoverHelper: '将从 {0} 文件进行恢复该操作不可回滚是否继续',
},
login: {
username: '用户名',