From 61380be3185d596784a381b12d2066380243a123 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Fri, 14 Sep 2018 21:06:15 +0300 Subject: [PATCH] fix triggers panel rendering with phantomjs, fix #605 --- src/panel-triggers/triggers_panel_ctrl.js | 22 +++++++++++----------- src/sass/_panel-triggers.scss | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/panel-triggers/triggers_panel_ctrl.js b/src/panel-triggers/triggers_panel_ctrl.js index ae938f110..d10f75401 100644 --- a/src/panel-triggers/triggers_panel_ctrl.js +++ b/src/panel-triggers/triggers_panel_ctrl.js @@ -130,7 +130,7 @@ export class TriggerPanelCtrl extends PanelCtrl { } setTimeQueryEnd() { - this.timing.queryEnd = new Date().getTime(); + this.timing.queryEnd = (new Date()).getTime(); } onRefresh() { @@ -144,23 +144,24 @@ export class TriggerPanelCtrl extends PanelCtrl { this.pageIndex = 0; return this.getTriggers() - .then(zabbixTriggers => { + .then(triggers => this.renderTriggers(triggers)) + .then(() => { // Notify panel that request is finished this.loading = false; this.setTimeQueryEnd(); - - this.render(zabbixTriggers); + this.$timeout(() => { + this.renderingCompleted(); + }); }) .catch(err => { - // if cancelled keep loading set to true + this.loading = false; + if (err.cancelled) { console.log('Panel request cancelled', err); return; } - this.loading = false; this.error = err.message || "Request Error"; - if (err.data) { if (err.data.message) { this.error = err.data.message; @@ -175,7 +176,7 @@ export class TriggerPanelCtrl extends PanelCtrl { }); } - render(zabbixTriggers) { + renderTriggers(zabbixTriggers) { let triggers = _.cloneDeep(zabbixTriggers || this.triggerListUnfiltered); this.triggerListUnfiltered = _.cloneDeep(triggers); @@ -189,8 +190,8 @@ export class TriggerPanelCtrl extends PanelCtrl { this.triggerList = triggers; this.getCurrentTriggersPage(); - this.$timeout(() => { - super.render(this.triggerList); + return this.$timeout(() => { + return super.render(this.triggerList); }); } @@ -649,7 +650,6 @@ export class TriggerPanelCtrl extends PanelCtrl { rootElem.css({'max-height': getContentHeight()}); rootElem.css({'height': getContentHeight()}); setFontSize(); - ctrl.renderingCompleted(); } let unbindDestroy = scope.$on('$destroy', function() { diff --git a/src/sass/_panel-triggers.scss b/src/sass/_panel-triggers.scss index 5052ee95d..4db4287fb 100644 --- a/src/sass/_panel-triggers.scss +++ b/src/sass/_panel-triggers.scss @@ -55,6 +55,10 @@ opacity: 0.4; } } + + .alert-rule-item__icon .icon-gf { + right: 0.4rem; + } } .zbx-trigger-card { @@ -181,3 +185,17 @@ font-size: 200%; } } + +// fix for phantomjs (it has troubles with flex blocks rendering) +.body--phantomjs { + .triggers-panel-container { + .alert-rule-list { + display: block; + } + + .alert-rule-item__body, + .alert-rule-item__icon { + display: block; + } + } +}