From 95c6a593d5cf5bce76b5d8493ae241344904a4ef Mon Sep 17 00:00:00 2001 From: Olivier Floch Date: Wed, 25 Sep 2024 10:08:32 +0200 Subject: [PATCH] feat(xo-6/dashboard): add VMs protection data --- .../src/components/site/dashboard/Backups.vue | 33 +++++++++++++++++-- @xen-orchestra/web/src/locales/en.json | 6 ++++ @xen-orchestra/web/src/locales/fr.json | 6 ++++ .../web/src/types/xo/dashboard.type.ts | 5 +++ CHANGELOG.unreleased.md | 1 + 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/@xen-orchestra/web/src/components/site/dashboard/Backups.vue b/@xen-orchestra/web/src/components/site/dashboard/Backups.vue index be1add3ebef..9afc54e5ece 100644 --- a/@xen-orchestra/web/src/components/site/dashboard/Backups.vue +++ b/@xen-orchestra/web/src/components/site/dashboard/Backups.vue @@ -2,8 +2,10 @@ {{ $t('backups') }} - + + + @@ -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' @@ -25,13 +28,13 @@ const { record, isReady } = useDashboardStore().subscribe() const { t } = useI18n() -const title = computed(() => ({ +const jobsTitle = computed(() => ({ label: t('backups.jobs'), iconTooltip: t('backups.jobs.based-on-last-three'), icon: faCircleInfo, })) -const segments = computed(() => [ +const jobsSegments = computed(() => [ { label: t('backups.jobs.running-good'), value: record.value?.backups?.jobs.successful ?? 0, @@ -53,4 +56,28 @@ const segments = computed(() => [ color: 'disabled', }, ]) + +const vmsProtectionTitle = computed(() => ({ + label: t('backups.vms-protection'), + iconTooltip: t('backups.vms-protection.tooltip'), + icon: faCircleInfo, +})) + +const vmsProtectionSegments = computed(() => [ + { + 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', + }, +]) diff --git a/@xen-orchestra/web/src/locales/en.json b/@xen-orchestra/web/src/locales/en.json index 9b09ea81379..19019db6a5c 100644 --- a/@xen-orchestra/web/src/locales/en.json +++ b/@xen-orchestra/web/src/locales/en.json @@ -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", diff --git a/@xen-orchestra/web/src/locales/fr.json b/@xen-orchestra/web/src/locales/fr.json index 28d8dbb26dd..7e1457bd4e7 100644 --- a/@xen-orchestra/web/src/locales/fr.json +++ b/@xen-orchestra/web/src/locales/fr.json @@ -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", diff --git a/@xen-orchestra/web/src/types/xo/dashboard.type.ts b/@xen-orchestra/web/src/types/xo/dashboard.type.ts index 9483cad7f6f..dd682fbc2b1 100644 --- a/@xen-orchestra/web/src/types/xo/dashboard.type.ts +++ b/@xen-orchestra/web/src/types/xo/dashboard.type.ts @@ -40,5 +40,10 @@ export type XoDashboard = { total: number } issues: BackupIssue[] + vmsProtection: { + protected: number + unprotected: number + notInJob: number + } } } diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 172748bad75..fd86a9df534 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -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))