feat(xo-server-usage-report): ability to send daily (#3582)
Fixes #3544
This commit is contained in:
parent
60f9393d29
commit
dfd66a56c3
@ -21,6 +21,7 @@
|
||||
- [Scheduling] Merge selection and interval tabs [#1902](https://github.com/vatesfr/xen-orchestra/issues/1902) (PR [#3519](https://github.com/vatesfr/xen-orchestra/pull/3519))
|
||||
- [Backup NG/Restore] The backup selector now also shows the job name [#3366](https://github.com/vatesfr/xen-orchestra/issues/3366) (PR [#3564](https://github.com/vatesfr/xen-orchestra/pull/3564))
|
||||
- Sort buttons by criticality in tables [#3168](https://github.com/vatesfr/xen-orchestra/issues/3168) (PR [#3545](https://github.com/vatesfr/xen-orchestra/pull/3545))
|
||||
- [Usage Report] Ability to send a daily report [#3544](https://github.com/vatesfr/xen-orchestra/issues/3544) (PR [#3582](https://github.com/vatesfr/xen-orchestra/pull/3582))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -79,7 +79,7 @@ export const configurationSchema = {
|
||||
},
|
||||
periodicity: {
|
||||
type: 'string',
|
||||
enum: ['monthly', 'weekly'],
|
||||
enum: ['monthly', 'weekly', 'daily'],
|
||||
description:
|
||||
'If you choose weekly you will receive the report every sunday and if you choose monthly you will receive it every first day of the month.',
|
||||
},
|
||||
@ -661,6 +661,12 @@ async function dataBuilder ({ xo, storedStatsPath, all }) {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
const CRON_BY_PERIODICITY = {
|
||||
monthly: '0 6 1 * *',
|
||||
weekly: '0 6 * * 0',
|
||||
daily: '0 6 * * *',
|
||||
}
|
||||
|
||||
class UsageReportPlugin {
|
||||
constructor ({ xo, getDataDir }) {
|
||||
this._xo = xo
|
||||
@ -681,7 +687,7 @@ class UsageReportPlugin {
|
||||
}
|
||||
|
||||
this._job = createSchedule(
|
||||
configuration.periodicity === 'monthly' ? '00 06 1 * *' : '00 06 * * 0'
|
||||
CRON_BY_PERIODICITY[configuration.periodicity]
|
||||
).createJob(async () => {
|
||||
try {
|
||||
await this._sendReport(true)
|
||||
|
Loading…
Reference in New Issue
Block a user