瀏覽代碼

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
Alexander Zobnin 8 年之前
父節點
當前提交
af56cc4c28
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      public/app/features/alerting/alert_tab_ctrl.ts
  2. 1 1
      public/app/plugins/panel/alertlist/module.ts

+ 1 - 1
public/app/features/alerting/alert_tab_ctrl.ts

@@ -79,7 +79,7 @@ export class AlertTabCtrl {
   getAlertHistory() {
   getAlertHistory() {
     this.backendSrv.get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`).then(res => {
     this.backendSrv.get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`).then(res => {
       this.alertHistory = _.map(res, ah => {
       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.stateModel = alertDef.getStateDisplayModel(ah.newState);
         ah.info = alertDef.getAlertAnnotationInfo(ah);
         ah.info = alertDef.getAlertAnnotationInfo(ah);
         return ah;
         return ah;

+ 1 - 1
public/app/plugins/panel/alertlist/module.ts

@@ -104,7 +104,7 @@ class AlertListPanel extends PanelCtrl {
     this.backendSrv.get(`/api/annotations`, params)
     this.backendSrv.get(`/api/annotations`, params)
       .then(res => {
       .then(res => {
         this.alertHistory = _.map(res, al => {
         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.stateModel = alertDef.getStateDisplayModel(al.newState);
           al.info = alertDef.getAlertAnnotationInfo(al);
           al.info = alertDef.getAlertAnnotationInfo(al);
           return al;
           return al;