Skip to content

Commit

Permalink
feat: add empty state for restore by backups (#7078)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

为通过备份文件恢复的界面添加空状态提示。

<img width="1192" alt="image" src="https://github.com/user-attachments/assets/2267e61d-9886-408a-a13f-e986f2172203">

#### Does this PR introduce a user-facing change?

```release-note
为通过备份文件恢复的界面添加空状态提示。
```
  • Loading branch information
ruibaby authored Nov 25, 2024
1 parent e5be856 commit 2ed3bb6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
25 changes: 24 additions & 1 deletion ui/console-src/modules/system/backup/tabs/Restore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Toast,
VAlert,
VButton,
VEmpty,
VEntity,
VEntityField,
VLoading,
Expand Down Expand Up @@ -61,7 +62,12 @@ const { isLoading: downloading, mutate: handleRemoteDownload } = useMutation({
},
});
const { data: backupFiles } = useQuery({
const {
data: backupFiles,
refetch: refetchBackupFiles,
isLoading: isLoadingBackupFiles,
isFetching: isFetchingBackupFiles,
} = useQuery({
queryKey: ["backup-files", activeTabId],
queryFn: async () => {
const { data } = await consoleApiClient.migration.getBackupFiles();
Expand Down Expand Up @@ -179,7 +185,9 @@ useQuery({
id="backups"
:label="$t('core.backup.restore.tabs.backup.label')"
>
<VLoading v-if="isLoadingBackupFiles" />
<ul
v-else-if="backupFiles?.length"
class="box-border h-full w-full divide-y divide-gray-100 overflow-hidden rounded-base border"
role="list"
>
Expand Down Expand Up @@ -216,6 +224,21 @@ useQuery({
</VEntity>
</li>
</ul>
<VEmpty
v-else
:title="$t('core.backup.restore.tabs.backup.empty.title')"
:message="$t('core.backup.restore.tabs.backup.empty.message')"
>
<template #actions>
<VButton
:loading="isFetchingBackupFiles"
@click="refetchBackupFiles"
>
{{ $t("core.common.buttons.refresh") }}
</VButton>
</template>
</VEmpty>
</VTabItem>
</VTabs>
</div>
Expand Down
6 changes: 6 additions & 0 deletions ui/src/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,12 @@ core:
url: Remote URL
backup:
label: Restore from backup files
empty:
title: No backup files
message: >-
Currently no backup files are scanned. You can manually upload the
backup files to the backups directory of the Halo working
directory.
exception:
not_found:
message: Page not found
Expand Down
3 changes: 3 additions & 0 deletions ui/src/locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,9 @@ core:
url: 下载地址
backup:
label: 从备份文件恢复
empty:
title: 没有备份文件
message: 当前没有扫描到备份文件,你可以手动将备份文件上传到 Halo 工作目录的 backups 目录。
exception:
not_found:
message: 没有找到该页面
Expand Down
3 changes: 3 additions & 0 deletions ui/src/locales/zh-TW.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,9 @@ core:
url: 下載地址
backup:
label: 從備份檔案恢復
empty:
title: 沒有備份文件
message: 目前沒有掃描到備份文件,你可以手動將備份文件上傳到 Halo 工作目錄的 backups 目錄。
exception:
not_found:
message: 沒有找到該頁面
Expand Down

0 comments on commit 2ed3bb6

Please sign in to comment.