-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xo-6/dashboard): add backup issues data (#7974)
- Loading branch information
Showing
16 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
@xen-orchestra/lite/src/stories/web-core/state-hero/no-data-hero.story.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<template> | ||
<ComponentStory | ||
v-slot="{ properties }" | ||
:params="[prop('type').required().enum('page', 'card').preset('card').widget()]" | ||
> | ||
<NoDataHero v-bind="properties" /> | ||
</ComponentStory> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import ComponentStory from '@/components/component-story/ComponentStory.vue' | ||
import { prop } from '@/libs/story/story-param' | ||
import NoDataHero from '@core/components/state-hero/NoDataHero.vue' | ||
</script> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion
5
@xen-orchestra/web-core/lib/components/backup-item/BackupItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
@xen-orchestra/web-core/lib/components/state-hero/NoDataHero.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<StateHero class="no-data-hero" image="no-data" :type>{{ $t('no-data') }}</StateHero> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import StateHero, { type StateHeroType } from '@core/components/state-hero/StateHero.vue' | ||
defineProps<{ | ||
type: StateHeroType | ||
}>() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
@xen-orchestra/web/src/components/site/dashboard/BackupIssues.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<UiCard> | ||
<CardTitle> | ||
{{ $t('backup-issues') }} | ||
<UiCounter :value="backupIssues.length" color="danger" size="medium" /> | ||
<template #description>{{ $t('in-last-three-jobs') }}</template> | ||
</CardTitle> | ||
<LoadingHero :disabled="isReady" type="card"> | ||
<NoDataHero v-if="!hasBackupIssues" type="card" /> | ||
<div v-else class="backup-items"> | ||
<BackupItem v-for="(coreBackupIssue, index) in coreBackupIssues" :key="index" :backup="coreBackupIssue" /> | ||
</div> | ||
</LoadingHero> | ||
</UiCard> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useDashboardStore } from '@/stores/xo-rest-api/dashboard.store' | ||
import { convertBackupIssueToCore } from '@/utils/convert-backup-issue-to-core.util' | ||
import BackupItem from '@core/components/backup-item/BackupItem.vue' | ||
import CardTitle from '@core/components/card/CardTitle.vue' | ||
import LoadingHero from '@core/components/state-hero/LoadingHero.vue' | ||
import NoDataHero from '@core/components/state-hero/NoDataHero.vue' | ||
import UiCard from '@core/components/UiCard.vue' | ||
import UiCounter from '@core/components/UiCounter.vue' | ||
import { computed } from 'vue' | ||
const { backupIssues, isReady } = useDashboardStore().subscribe() | ||
const hasBackupIssues = computed(() => backupIssues.value.length !== 0) | ||
const coreBackupIssues = computed(() => backupIssues.value.map(convertBackupIssueToCore)) | ||
</script> | ||
|
||
<style lang="postcss" scoped> | ||
.backup-items { | ||
max-height: 30rem; | ||
overflow-y: auto; | ||
margin-inline: -2.4rem; | ||
margin-block-end: -2.4rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
@xen-orchestra/web/src/utils/convert-backup-issue-to-core.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { BackupIssue } from '@/types/xo/dashboard.type' | ||
import type { Backup as CoreBackup } from '@core/types/backup.type' | ||
|
||
export const convertBackupIssueToCore = (backupIssue: BackupIssue): CoreBackup => ({ | ||
label: backupIssue.name, | ||
states: backupIssue.logs.map(log => (log === 'skipped' || log === 'interrupted' ? 'partial' : log)), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters