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(xo-6/dashboard): add VMs protection data #8007

Merged
merged 3 commits into from
Sep 26, 2024
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
41 changes: 36 additions & 5 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,13 @@
<UiCard>
<CardTitle>{{ $t('backups') }}</CardTitle>
<LoadingHero :disabled="isReady" type="card">
<DonutChartWithLegend :icon="faServer" :segments :title />
<CardNumbers :label="t('total')" :value="record?.backups?.jobs.total" size="small" />
<NoDataHero v-if="record?.backups === undefined" type="card" />
<template v-else>
<DonutChartWithLegend :segments="jobsSegments" :title="jobsTitle" />
<CardNumbers :label="t('total')" :value="record?.backups?.jobs.total" size="small" />
<Divider type="stretch" />
<DonutChartWithLegend :segments="vmsProtectionSegments" :title="vmsProtectionTitle" />
</template>
</LoadingHero>
</UiCard>
</template>
Expand All @@ -12,26 +17,28 @@
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'
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 { faCircleInfo, faServer } from '@fortawesome/free-solid-svg-icons'
import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'

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 +60,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 @@ -47,5 +47,10 @@ export type XoDashboard = {
total: number
}
issues: BackupIssue[]
vmsProtection: {
protected: number
unprotected: number
notInJob: number
}
}
}
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
> Users must be able to say: “Nice enhancement, I'm eager to test it”

- [Hosts] Display a warning for hosts whose TLS key is too short to update to XCP-ng 8.3 (PR [#7995](https://github.com/vatesfr/xen-orchestra/pull/7995))
- **XO 6**:
- [Dashboard] Display S3 backup repository data (PR [#8006](https://github.com/vatesfr/xen-orchestra/pull/8006))
- [Dashboard] Display VMs protection data (PR [#8007](https://github.com/vatesfr/xen-orchestra/pull/8007))
- **xo-cli**
- `rest get --output $file` now displays progress information during download
- `rest post` and `rest put` now accept `--input $file` to upload a file and display progress information
Expand Down
Loading