Skip to content

Commit

Permalink
Merge branch 'master' into poolNetwork/displayBondMode
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuRA committed Sep 26, 2024
2 parents 44fa5b2 + 943ad78 commit f5e164c
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 13 deletions.
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
4 changes: 0 additions & 4 deletions packages/xo-server/src/api/mirror-backup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ editJob.params = {
remotes: {
type: 'object',
},
schedules: {
type: 'object',
optional: true,
},
filter: MIRROR_BACKUP_FILTER,
settings: SCHEMA_SETTINGS,
}
Expand Down
7 changes: 3 additions & 4 deletions packages/xo-web/src/xo-app/backup/new/mirror/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const NewMirrorBackup = decorate([
}

const settings = { ...state.settings }
const schedules = { ...state.schedules }
await Promise.all([
...map(props.schedules, ({ id }) => {
const schedule = state.schedules[id]
Expand All @@ -214,16 +213,16 @@ const NewMirrorBackup = decorate([
enabled: schedule.enabled,
})
settings[newSchedule.id] = settings[schedule.id]
schedules[newSchedule.id] = newSchedule
delete settings[schedule.id]
delete schedules[schedule.id]
}
}),
])

const { schedules, ...jobProps } = normalize({ ...state, settings, isIncremental: state.isIncremental })

await editMirrorBackupJob({
id: props.job.id,
...normalize({ ...state, settings, schedules, isIncremental: state.isIncremental }),
...jobProps,
})
},
resetMirrorBackup: () => (_, props) => getInitialState(props),
Expand Down

0 comments on commit f5e164c

Please sign in to comment.