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

View File

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

View File

@ -125,7 +125,8 @@ const message = {
confirmNoNull: 'Make sure the value {0} is not empty', confirmNoNull: 'Make sure the value {0} is not empty',
errPort: 'Incorrect port information, please confirm!', errPort: 'Incorrect port information, please confirm!',
remove: 'Remove', 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: { login: {
username: 'UserName', username: 'UserName',

View File

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

View File

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