Backup type in report e-mail (See vatesfr/xo-web#822)

This commit is contained in:
Pierre 2016-03-23 10:11:01 +01:00
parent f08ab729bd
commit 2f89e3658a

View File

@ -120,6 +120,9 @@ class BackupReportsXoPlugin {
const start = moment(status.start)
const end = moment(status.end)
const duration = moment.duration(end - start).humanize()
let method = status.calls[Object.keys(status.calls)[0]].method
method = method.slice(method.indexOf('.') + 1)
.replace(/([A-Z])/g, ' $1').replace(/^./, letter => letter.toUpperCase()) // humanize
const tag = status.calls[Object.keys(status.calls)[0]].params.tag
if (reportWhen === 'fail' && globalStatus === 'Success') {
@ -128,7 +131,7 @@ class BackupReportsXoPlugin {
// Global status.
text.unshift([
`## Global status for "${tag}": ${globalStatus}`,
`## Global status for "${tag}" (${method}): ${globalStatus}`,
` - Start time: ${String(start)}`,
` - End time: ${String(end)}`,
` - Duration: ${duration}`,