Skip to content

Commit

Permalink
feat(xo-6/dashboard): add VMs protection data
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierFL committed Sep 25, 2024
1 parent 13f2afb commit 95c6a59
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
33 changes: 30 additions & 3 deletions @xen-orchestra/web/src/components/site/dashboard/Backups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<UiCard>
<CardTitle>{{ $t('backups') }}</CardTitle>
<LoadingHero :disabled="isReady" type="card">
<DonutChartWithLegend :icon="faServer" :segments :title />
<DonutChartWithLegend :icon="faServer" :segments="jobsSegments" :title="jobsTitle" />
<CardNumbers :label="t('total')" :value="record?.backups?.jobs.total" size="small" />
<Divider type="stretch" />
<DonutChartWithLegend :icon="faServer" :segments="vmsProtectionSegments" :title="vmsProtectionTitle" />
</LoadingHero>
</UiCard>
</template>
Expand All @@ -12,6 +14,7 @@
import { useDashboardStore } from '@/stores/xo-rest-api/dashboard.store'
import CardTitle from '@core/components/card/CardTitle.vue'
import CardNumbers from '@core/components/CardNumbers.vue'
import Divider from '@core/components/divider/Divider.vue'
import DonutChartWithLegend, {
type DonutChartWithLegendProps,
} from '@core/components/donut-chart-with-legend/DonutChartWithLegend.vue'
Expand All @@ -25,13 +28,13 @@ const { record, isReady } = useDashboardStore().subscribe()
const { t } = useI18n()
const title = computed<DonutChartWithLegendProps['title']>(() => ({
const jobsTitle = computed<DonutChartWithLegendProps['title']>(() => ({
label: t('backups.jobs'),
iconTooltip: t('backups.jobs.based-on-last-three'),
icon: faCircleInfo,
}))
const segments = computed<DonutChartWithLegendProps['segments']>(() => [
const jobsSegments = computed<DonutChartWithLegendProps['segments']>(() => [
{
label: t('backups.jobs.running-good'),
value: record.value?.backups?.jobs.successful ?? 0,
Expand All @@ -53,4 +56,28 @@ const segments = computed<DonutChartWithLegendProps['segments']>(() => [
color: 'disabled',
},
])
const vmsProtectionTitle = computed<DonutChartWithLegendProps['title']>(() => ({
label: t('backups.vms-protection'),
iconTooltip: t('backups.vms-protection.tooltip'),
icon: faCircleInfo,
}))
const vmsProtectionSegments = computed<DonutChartWithLegendProps['segments']>(() => [
{
label: t('backups.vms-protection.protected'),
value: record.value?.backups?.vmsProtection?.protected ?? 0,
color: 'success',
},
{
label: t('backups.vms-protection.unprotected'),
value: record.value?.backups?.vmsProtection?.unprotected ?? 0,
color: 'warning',
},
{
label: t('backups.vms-protection.no-job'),
value: record.value?.backups?.vmsProtection?.notInJob ?? 0,
color: 'danger',
},
])
</script>
6 changes: 6 additions & 0 deletions @xen-orchestra/web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"backups.jobs.looks-like-issue": "Looks like there is an issue",
"backups.jobs.running-good": "Running good",

"backups.vms-protection": "VMs protection",
"backups.vms-protection.no-job": "In no job",
"backups.vms-protection.protected": "In at least 1 job & protected",
"backups.vms-protection.tooltip": "A VM is protected if it's in a backup job, with an enabled schedule, and the last run succeeded",
"backups.vms-protection.unprotected": "In at least 1 job but unprotected",

"end-of-life": "End of life",
"eol": "EOL",
"for-backup": "For backup",
Expand Down
6 changes: 6 additions & 0 deletions @xen-orchestra/web/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"backups.jobs.looks-like-issue": "Il semble qu'il y ait un problème",
"backups.jobs.running-good": "Tout est ok",

"backups.vms-protection": "Protection des VMs",
"backups.vms-protection.no-job": "Dans aucun job",
"backups.vms-protection.protected": "Dans au moins 1 job et protégé",
"backups.vms-protection.tooltip": "Une VM est protégée si elle se trouve dans un job, avec une planification activée, et si la dernière exécution a réussi",
"backups.vms-protection.unprotected": "Dans au moins 1 job mais sans protection",

"end-of-life": "Fin de vie",
"eol": "EOL",
"for-backup": "Pour la sauvegarde",
Expand Down
5 changes: 5 additions & 0 deletions @xen-orchestra/web/src/types/xo/dashboard.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ export type XoDashboard = {
total: number
}
issues: BackupIssue[]
vmsProtection: {
protected: number
unprotected: number
notInJob: number
}
}
}
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- [Netbox] Support version 4.1 [#7966](https://github.com/vatesfr/xen-orchestra/issues/7966) (PR [#8002](https://github.com/vatesfr/xen-orchestra/pull/8002))
- **XO 6**:
- [Dashboard] Display backup issues data (PR [#7974](https://github.com/vatesfr/xen-orchestra/pull/7974))
- [Dashboard] Display VMs protection data (PR [#8007](https://github.com/vatesfr/xen-orchestra/pull/8007))
- [REST API] Add S3 backup repository, VMs protection and resources overview information in the `/rest/v0/dashboard` endpoint (PRs [#7978](https://github.com/vatesfr/xen-orchestra/pull/7978), [#7964](https://github.com/vatesfr/xen-orchestra/pull/7964), [#8005](https://github.com/vatesfr/xen-orchestra/pull/8005))
- [Backups] Display more informations in the _Notes_ column of the backup page (PR [#7977](https://github.com/vatesfr/xen-orchestra/pull/7977))
- [REST API] Add `/alarms` endpoint and remove alarms from the `/dashboard` and `/messages` endpoints (PR [#7959](https://github.com/vatesfr/xen-orchestra/pull/7959))
Expand Down

0 comments on commit 95c6a59

Please sign in to comment.