Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add empty state for restore by backups #7078

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading