From af56cc4c281476dc6e87e873e1710819dfa91e4e Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 19 Jul 2017 21:45:57 +0300 Subject: [PATCH] Panel Alertlist: use dashboard timezone (#8880) * panel-alertlist: use dashboard timezone, fixes #8874 * alert state history: use dashboard timezone, issue #8874 * alert state history: minor refactor --- public/app/features/alerting/alert_tab_ctrl.ts | 2 +- public/app/plugins/panel/alertlist/module.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index 938b24ebc21..5d23ebfec3a 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -79,7 +79,7 @@ export class AlertTabCtrl { getAlertHistory() { this.backendSrv.get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`).then(res => { this.alertHistory = _.map(res, ah => { - ah.time = moment(ah.time).format('MMM D, YYYY HH:mm:ss'); + ah.time = this.dashboardSrv.getCurrent().formatDate(ah.time, 'MMM D, YYYY HH:mm:ss'); ah.stateModel = alertDef.getStateDisplayModel(ah.newState); ah.info = alertDef.getAlertAnnotationInfo(ah); return ah; diff --git a/public/app/plugins/panel/alertlist/module.ts b/public/app/plugins/panel/alertlist/module.ts index c934902e7e1..17d06132751 100644 --- a/public/app/plugins/panel/alertlist/module.ts +++ b/public/app/plugins/panel/alertlist/module.ts @@ -104,7 +104,7 @@ class AlertListPanel extends PanelCtrl { this.backendSrv.get(`/api/annotations`, params) .then(res => { this.alertHistory = _.map(res, al => { - al.time = moment(al.time).format('MMM D, YYYY HH:mm:ss'); + al.time = this.dashboard.formatDate(al.time, 'MMM D, YYYY HH:mm:ss'); al.stateModel = alertDef.getStateDisplayModel(al.newState); al.info = alertDef.getAlertAnnotationInfo(al); return al;