diff --git a/frontend/src/components/backup/index.vue b/frontend/src/components/backup/index.vue index bec59d9b5..53775c923 100644 --- a/frontend/src/components/backup/index.vue +++ b/frontend/src/components/backup/index.vue @@ -10,6 +10,19 @@ /> + +
+ +
+ {{ $t('setting.backupJump') }} + + + {{ $t('firewall.quickJump') }} + +
+
+
+ import { reactive, ref } from 'vue'; import { computeSize, dateFormat, downloadFile } from '@/utils/util'; -import { handleBackup, handleRecover } from '@/api/modules/setting'; +import { getBackupList, handleBackup, handleRecover } from '@/api/modules/setting'; import i18n from '@/lang'; import DrawerHeader from '@/components/drawer-header/index.vue'; import { deleteBackupRecord, downloadBackupRecord, searchBackupRecords } from '@/api/modules/setting'; import { Backup } from '@/api/interface/backup'; import { MsgSuccess } from '@/utils/message'; +import router from '@/routers'; const selects = ref([]); const loading = ref(); @@ -83,6 +97,7 @@ const backupVisible = ref(false); const type = ref(); const name = ref(); const detailName = ref(); +const backupPath = ref(); interface DialogProps { type: string; @@ -91,6 +106,9 @@ interface DialogProps { } const acceptParams = (params: DialogProps): void => { type.value = params.type; + if (type.value === 'app') { + loadBackupDir(); + } name.value = params.name; detailName.value = params.detailName; backupVisible.value = true; @@ -100,6 +118,26 @@ const handleClose = () => { backupVisible.value = false; }; +const loadBackupDir = () => { + getBackupList().then((res) => { + let backupList = res.data || []; + for (const bac of backupList) { + if (bac.type !== 'LOCAL') { + continue; + } + if (bac.id !== 0) { + bac.varsJson = JSON.parse(bac.vars); + } + backupPath.value = bac.varsJson['dir']; + break; + } + }); +}; + +const goFile = async () => { + router.push({ name: 'File', query: { path: `${backupPath.value}/app/${name.value}/${detailName.value}` } }); +}; + const search = async () => { let params = { page: paginationConfig.currentPage, @@ -241,3 +279,13 @@ defineExpose({ acceptParams, }); + + diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 41b64e605..2600edbfc 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1428,6 +1428,8 @@ const message = { rootCrtDownload: 'Root certificate download', primaryKey: 'Primary key', certificate: 'Certificate', + backupJump: + 'Backup files not in the current backup list, please try downloading from the file directory and importing for backup.', snapshot: 'Snapshot', status: 'Snapshot status', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index bb97d3cb8..d5c5f3e43 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1258,6 +1258,7 @@ const message = { accountKey: '賬戶密鑰', address: '地址', path: '路徑', + backupJump: '未在當前備份列表中的備份檔案,請嘗試從檔案目錄中下載後導入備份。', snapshot: '快照', status: '快照狀態', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index b5360c297..14b9c124e 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1259,6 +1259,7 @@ const message = { accountKey: '账户密钥', address: '地址', path: '路径', + backupJump: '未在当前备份列表中的备份文件,请尝试从文件目录中下载后导入备份。', snapshot: '快照', ignoreRule: '排除规则',