From 6dd77af7f82ca3d1bec9d120a0a09178f7b727f9 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Fri, 1 Sep 2023 11:00:19 +0800 Subject: [PATCH] feat: add restore by backup record supports (#4511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area console /kind feature /milestone 2.9.x #### What this PR does / why we need it: 支持选择已有备份进行恢复。 image #### Special notes for your reviewer: 需要测试在恢复界面通过选择已有备份进行恢复的功能是否正常。 #### Does this PR introduce a user-facing change? ```release-note 系统恢复功能支持选择已有备份进行系统恢复。 ``` --- console/src/locales/en.yaml | 5 ++ console/src/locales/zh-CN.yaml | 5 ++ console/src/locales/zh-TW.yaml | 9 ++- .../backup/components/BackupListItem.vue | 15 +++-- .../system/backup/composables/use-backup.ts | 38 ++++++++++++- .../src/modules/system/backup/tabs/List.vue | 42 +------------- .../modules/system/backup/tabs/Restore.vue | 55 +++++++++++++++++++ 7 files changed, 122 insertions(+), 47 deletions(-) diff --git a/console/src/locales/en.yaml b/console/src/locales/en.yaml index b014d9c0a..80456d1bd 100644 --- a/console/src/locales/en.yaml +++ b/console/src/locales/en.yaml @@ -1003,6 +1003,9 @@ core: toast_success: Requested to restart remote_download: button: Download and restore + restore_by_backup: + button: Restore + title: Are you sure you want to restore from this backup? list: phases: pending: Pending @@ -1025,6 +1028,8 @@ core: label: Remote fields: url: Remote URL + backup: + label: Restore from backup exception: not_found: message: Page not found diff --git a/console/src/locales/zh-CN.yaml b/console/src/locales/zh-CN.yaml index 8cffb00ca..093a353da 100644 --- a/console/src/locales/zh-CN.yaml +++ b/console/src/locales/zh-CN.yaml @@ -1003,6 +1003,9 @@ core: toast_success: 已请求重启 remote_download: button: 下载并恢复 + restore_by_backup: + button: 恢复 + title: 确认要从此备份进行恢复吗? list: phases: pending: 准备中 @@ -1025,6 +1028,8 @@ core: label: 远程恢复 fields: url: 下载地址 + backup: + label: 从备份恢复 exception: not_found: message: 没有找到该页面 diff --git a/console/src/locales/zh-TW.yaml b/console/src/locales/zh-TW.yaml index 713eb82b5..4f79c03e8 100644 --- a/console/src/locales/zh-TW.yaml +++ b/console/src/locales/zh-TW.yaml @@ -1003,6 +1003,9 @@ core: toast_success: 已請求重啟 remote_download: button: 下載並還原 + restore_by_backup: + button: 還原 + title: 確認要從此備份進行還原嗎? list: phases: pending: 準備中 @@ -1016,15 +1019,17 @@ core: first: 1. 還原過程可能需要較長時間,期間請勿重新整理頁面。 second: 2. 在還原過程中,雖然已有的資料不會被清除,但若有衝突的資料將被覆蓋。 third: 3. 還原完成後需要重新啟動 Halo 才能正常載入系統資源。 - complete: 恢復完成,等待重啟... + complete: 還原完成,等待重啟... start: 開始還原 tabs: local: label: 上傳 remote: - label: 遠程恢復 + label: 遠程還原 fields: url: 下載地址 + backup: + label: 從備份還原 exception: not_found: message: 沒有找到該頁面 diff --git a/console/src/modules/system/backup/components/BackupListItem.vue b/console/src/modules/system/backup/components/BackupListItem.vue index 97ff79879..6afc3ffa6 100644 --- a/console/src/modules/system/backup/components/BackupListItem.vue +++ b/console/src/modules/system/backup/components/BackupListItem.vue @@ -23,9 +23,15 @@ import type { OperationItem } from "packages/shared/dist"; const queryClient = useQueryClient(); const { t } = useI18n(); -const props = defineProps<{ - backup: Backup; -}>(); +const props = withDefaults( + defineProps<{ + backup: Backup; + showOperations: boolean; + }>(), + { + showOperations: true, + } +); const { backup } = toRefs(props); @@ -185,8 +191,9 @@ const { operationItems } = useOperationItemExtensionPoint( + -