From ca082c98a16afc231cd05e3c83c44a969d6434a5 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 8 Jul 2019 16:31:48 +0300 Subject: [PATCH] fix panel alert state icon in Grafana 6, closes #715 --- .../zabbixAlerting.service.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/datasource-zabbix/zabbixAlerting.service.js b/src/datasource-zabbix/zabbixAlerting.service.js index 5e1ecfae4..b1644d23c 100644 --- a/src/datasource-zabbix/zabbixAlerting.service.js +++ b/src/datasource-zabbix/zabbixAlerting.service.js @@ -10,7 +10,7 @@ class ZabbixAlertingService { } isFullScreen() { - return this.dashboardSrv.dash.meta.fullscreen; + return this.getDashboardModel().meta.fullscreen; } setPanelAlertState(panelId, alertState) { @@ -35,21 +35,18 @@ class ZabbixAlertingService { $(panelContainers[panelIndex]).removeClass(alertClass); if (alertState) { - if (alertState === 'alerting') { - alertClass = "panel-has-alert panel-alert-state--" + alertState; - $(panelContainers[panelIndex]).addClass(alertClass); - } - if (alertState === 'ok') { - alertClass = "panel-alert-state--" + alertState; - $(panelContainers[panelIndex]).addClass(alertClass); - $(panelContainers[panelIndex]).removeClass("panel-has-alert"); - } + alertClass = "panel-has-alert panel-alert-state--" + alertState; + $(panelContainers[panelIndex]).addClass(alertClass); } } } + getDashboardModel() { + return this.dashboardSrv.dash || this.dashboardSrv.dashboard; + } + getPanelModels() { - return _.filter(this.dashboardSrv.dash.panels, panel => panel.type !== 'row'); + return _.filter(this.getDashboardModel().panels, panel => panel.type !== 'row'); } getPanelModel(panelId) {