From e1cadda944c9b6c56a2bca9ada11422a432cd7f2 Mon Sep 17 00:00:00 2001 From: Yochpaz Yehonatan Date: Wed, 28 Mar 2018 17:41:09 +0300 Subject: [PATCH] * support auto scroll in case the panel text overflows the panel view --- README.md | 4 ++- dist/README.md | 12 +++----- dist/css/status_panel.css | 17 +++++++++++ dist/css/status_panel.css.map | 2 +- dist/editor.html | 9 ++++-- dist/module.html | 57 ++++++++++++++++++----------------- dist/plugin.json | 2 +- dist/status_ctrl.js | 14 ++++++++- dist/status_ctrl.js.map | 2 +- src/css/status_panel.scss | 27 +++++++++++++++-- src/editor.html | 7 ++++- src/module.html | 57 ++++++++++++++++++----------------- src/plugin.json | 2 +- src/status_ctrl.js | 17 +++++++++-- 14 files changed, 151 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 8caf1935..023f6b13 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,9 @@ When upgrading there might be some changes in the data the plugin uses and saves To prevent this loss of configuration you should save the panel JSON of all panels you have (by exporting the panel or dashboards) and keep them somewhere safe until you made sure everything is working after the upgrade. ### Version 1.0.8 - What's new? -* Adding support for Grafana 5.0.x +* Adding support for Grafana 5.0.x: + - Added option to auto scroll the alerts in case the text overflows the panel view + - Fix header padding when title is absent # Screenshots ### Panel States diff --git a/dist/README.md b/dist/README.md index 6f7569b9..023f6b13 100644 --- a/dist/README.md +++ b/dist/README.md @@ -70,14 +70,10 @@ Currently the plugin was tested with **influxDB** and **Graphite**. Support for When upgrading there might be some changes in the data the plugin uses and saves, so some of the configurations you made might be removed by accident. To prevent this loss of configuration you should save the panel JSON of all panels you have (by exporting the panel or dashboards) and keep them somewhere safe until you made sure everything is working after the upgrade. -### Version 1.0.7 - What's new? -* Threshold settings - removed `Show Always` option, and replaced it with 2 options: - * `Display Alias` - Select when to show the metric alias. - * `Display Value` - Select when to show the metric value. -* Text format configuration (`bold` / `italic`) for `warning` / `critical` / `disabled` states. -* Option to change the corner radius of the panel. Now you can change the panel's shape to have rounded corners. -* Fixed decimal precision in case we get number with format like '1e-10'. -* Bugfix - When creating new metric, The `Handler Type` didn't get default value. +### Version 1.0.8 - What's new? +* Adding support for Grafana 5.0.x: + - Added option to auto scroll the alerts in case the text overflows the panel view + - Fix header padding when title is absent # Screenshots ### Panel States diff --git a/dist/css/status_panel.css b/dist/css/status_panel.css index c4ec5d34..42481a4f 100644 --- a/dist/css/status_panel.css +++ b/dist/css/status_panel.css @@ -1,4 +1,5 @@ .status-panel { + overflow: hidden; position: relative; width: 100%; height: 100%; @@ -42,6 +43,22 @@ backface-visibility: hidden; transition: transform 0.5s; } +.marquee_container { + overflow: hidden; } + .marquee_container .marquee_element { + backface-visibility: hidden; + transition: transform 0.5s; + display: inline-block; + animation: marquee_container 15s linear infinite; } + .marquee_container .marquee_element:hover { + animation-play-state: paused; } + +/* Make it move */ +@keyframes marquee_container { + 0% { + transform: translate(0, 100%); } + 100% { + transform: translate(0, -100%); } } .st-card-front .ok-text, .st-card-front .warning-text, .st-card-front .fail-text, .st-card-front .no-data-text, .st-card-front .disabled-text { display: none; font-size: 2.0rem; } diff --git a/dist/css/status_panel.css.map b/dist/css/status_panel.css.map index cb9303d2..131907e3 100644 --- a/dist/css/status_panel.css.map +++ b/dist/css/status_panel.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,aAAc;EACb,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,MAAM;EAElB,gBAAG;IACF,SAAS,EAAE,MAAM;EAGlB,4BAAe;IACd,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IAEZ,OAAO,EAAE,IAAI;IACb,cAAc,EAAE,MAAM;IACtB,eAAe,EAAE,MAAM;IACvB,aAAa,EAAE,MAAM;EAGtB,2BAAc;IACb,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,aAAa;IAC9B,cAAc,EAAE,MAAM;IAGrB,qEAA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BAAW;EACV,OAAO,EAAE,KAAK;;AAKf,4BAAc;EACb,OAAO,EAAE,KAAK;;AAKf,8BAAe;EACd,OAAO,EAAE,KAAK;;AAIhB,mCAAoC;EACnC,iBAAiB,EAAE,gBAAgB;EACnC,SAAS,EAAE,gBAAgB;;AAG5B,wFAAyF;EACxF,iBAAiB,EAAE,gBAAgB;EACnC,SAAS,EAAE,gBAAgB;;AAG5B,sFAAuF;EACtF,iBAAiB,EAAE,UAAU;EAC7B,SAAS,EAAE,UAAU;;AAGtB,0CAA2C;EAC1C,OAAO,EAAE,IAAI;;AAGd,gBAAiB;EAChB,WAAW,EAAE,IAAI;;AAGlB,kBAAmB;EAClB,UAAU,EAAE,MAAM", "sources": ["../../src/css/status_panel.scss"], "names": [], "file": "status_panel.css" diff --git a/dist/editor.html b/dist/editor.html index 96e14852..899c76d0 100644 --- a/dist/editor.html +++ b/dist/editor.html @@ -110,9 +110,14 @@
Threshold Preferences
- + +
Other Options
+ Display Settings
- +
Metric display type
diff --git a/dist/module.html b/dist/module.html index c1006119..b882d6fa 100644 --- a/dist/module.html +++ b/dist/module.html @@ -36,41 +36,42 @@

-
-
- {{ display.alias }} - {{ display.alias }} - - {{ display.display_value | numberOrTextWithRegex : display.valueDisplayRegex }} -
+
+
+
+ {{ display.alias }} + {{ display.alias }} + - {{ display.display_value | numberOrTextWithRegex : display.valueDisplayRegex }} +
-
- {{ crit.alias }} - {{ crit.alias }} - - {{ crit.display_value | numberOrTextWithRegex : crit.valueDisplayRegex }} -
+
+ {{ crit.alias }} + {{ crit.alias }} + - {{ crit.display_value | numberOrTextWithRegex : crit.valueDisplayRegex }} +
-
- {{ warn.alias }} - {{ warn.alias }} - - {{ warn.display_value | numberOrTextWithRegex : warn.valueDisplayRegex }} -
+
+ {{ warn.alias }} + {{ warn.alias }} + - {{ warn.display_value | numberOrTextWithRegex : warn.valueDisplayRegex }} +
-
- {{ disabled.alias }} - {{ disabled.alias }} -
+
+ {{ disabled.alias }} + {{ disabled.alias }} +
-
{{ ctrl.extraMoreAlerts }}
+
{{ ctrl.extraMoreAlerts }}
+
-
diff --git a/dist/plugin.json b/dist/plugin.json index c39674fd..6cc48e1b 100644 --- a/dist/plugin.json +++ b/dist/plugin.json @@ -24,7 +24,7 @@ {"name": "Critical State", "path": "img/error.png"} ], "version": "1.0.8", - "updated": "2018-3-27" + "updated": "2018-3-28" }, "dependencies": { diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js index dbdf039f..83e845f6 100644 --- a/dist/status_ctrl.js +++ b/dist/status_ctrl.js @@ -82,7 +82,8 @@ System.register(["app/plugins/sdk", "lodash", "app/core/time_series2", "app/core isGrayOnNoData: false, isIgnoreOKColors: false, isHideAlertsOnDisable: false, - cornerRadius: 0 + cornerRadius: 0, + isAutoScrollOnOverflow: false }; _export("StatusPluginCtrl", StatusPluginCtrl = function (_MetricsPanelCtrl) { @@ -252,6 +253,17 @@ System.register(["app/plugins/sdk", "lodash", "app/core/time_series2", "app/core panelWidth = panelWidth - 20; this.maxWidth = panelWidth; } + }, { + key: "isAutoScrollAlerts", + value: function isAutoScrollAlerts() { + if (!this.panel.isAutoScrollOnOverflow) { + return false; + } + + var element = this.$panelContainer.find('.status-panel')[0]; + var overflowY = element.offsetHeight < element.scrollHeight; + return overflowY; + } }, { key: "onHandlerChange", value: function onHandlerChange(measurement) { diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map index a87512f5..28151695 100644 --- a/dist/status_ctrl.js.map +++ b/dist/status_ctrl.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","kbn","moment","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","cornerRadius","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","displayAliasTypes","displayValueTypes","colorModes","fontFormats","each","targets","t","valueHandler","Date","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","onColorChange","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","duplicates","measurement","hide","m","res","alias","target","addEditorTab","unitFormats","getUnitFormats","subItem","units","value","render","panelHeaderHeight","title","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","Number","undefined","String","c","w","getTime","item","color","fixPanelHeader","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","handleCssDisplay","parseUri","handleMaxAlertsToShow","displayAliasType","displayValueWithAlias","isFloat","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","formatDisplayValue","displayValueWhenAliasDisplayed","displayValueFromWarning","displayValueFromCritical","push","isFinite","decimals","decimalPlaces","Math","valueFormats","date","dashboard","isTimezoneUtc","utc","format","dateFormat","num","disabledValue","panelState","radius","okColor","maxAlertNumber","currentMaxAllowedAlerts","filteredOutAlerts","arrayNamesToSlice","forEach","originAlertCount","arrayName","links","link","type","uri","dashUri","params","targetBlank","dataList","map","seriesHandler","timeoutId","clearInterval","setInterval","toggleClass","scope","elem","attrs","ctrl","metricOptions","parseFloat","valueOf","val","toString","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AACDC,I;;AACAC,a;;AACAC,a;;AACAC,M;;AACAC,S;;;;;;;;;;;;;;;;;;;;;AAKDC,gB,GAAgB;AACrBC,cAAU,KADW;AAErBC,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K;AACnB,UAAI,CAAC/G,MAAM+G,GAAN,CAAD,IAAeA,IAAIC,QAAJ,GAAeC,WAAf,GAA6BC,OAA7B,CAAqC,GAArC,KAA6C,CAAC,CAAjE,EAAoE;AACnE,cAAO,IAAP;AACA;AACD,aAAO,KAAP;AACA;;;mCAYoBC,U,EAAY;AAChC,UAAIzF,SAAS,IAAIlH,UAAJ,CAAe;AAC3B2H,mBAAYgF,WAAWhF,UADI;AAE3BvD,cAAOuI,WAAWtI;AAFS,OAAf,CAAb;;AAKA6C,aAAO0F,SAAP,GAAmB1F,OAAO2F,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO3F,MAAP;AACA;;;;KAlkBoCpH,gB;;;;AAwlBtCmB,oBAAiB6L,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\";\nimport kbn from \"app/core/utils/kbn\";\nimport moment from \"moment\";\n\nimport './css/status_panel.css!';\n\n// Set and populate panel defaults\nconst panelDefaults = {\n\tflipCard: false,\n\tflipTime: 5,\n\tcolorMode: 'Panel',\n\t// Changed colors to match Table Panel so colorised text is easier to read\n\tcolors: {\n\t\tcrit: 'rgba(245, 54, 54, 0.9)',\n\t\twarn: 'rgba(237, 129, 40, 0.9)',\n\t\tok: 'rgba(50, 128, 45, 0.9)',\n\t\tdisable: 'rgba(128, 128, 128, 0.9)'\n\t},\n\tisGrayOnNoData: false,\n\tisIgnoreOKColors: false,\n\tisHideAlertsOnDisable: false,\n\tcornerRadius: 0\n};\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\t\t_.defaultsDeep(this.panel, panelDefaults);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg', 'Delta'];\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\n\t\tthis.displayAliasTypes = ['Warning / Critical', 'Always'];\n\t\tthis.displayValueTypes = ['Never', 'When Alias Displayed', 'Warning / Critical', 'Critical Only'];\n\t\tthis.colorModes = ['Panel', 'Metric', 'Disabled'];\n\t\tthis.fontFormats = ['Regular', 'Bold', 'Italic'];\n\n\t\t// Dates get stored as strings and will need to be converted back to a Date objects\n\t\t_.each(this.panel.targets, (t) => {\n\t\t\tif (t.valueHandler === \"Date Threshold\") {\n\t\t\t\tif (typeof t.crit != \"undefined\") t.crit = new Date(t.crit);\n\t\t\t\tif (typeof t.warn != \"undefined\") t.warn = new Date(t.warn);\n\t\t\t}\n\t\t});\n\n\t\tthis.panel.flipTime = this.panel.flipTime || 5;\n\n\t\t/** Bind events to functions **/\n\t\tthis.events.on('render', this.onRender.bind(this));\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n\n\t\tthis.onColorChange = this.onColorChange.bind(this);\n\n\t\tthis.addFilters()\n\t}\n\n\taddFilters() {\n\t\tcoreModule.filter('numberOrText', () => {\n\t\t\tlet numberOrTextFilter = (input) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\treturn input;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet regex;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!input) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet matchResults = input.match(regex);\n\t\t\t\t\t\tif (matchResults == null) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn matchResults[0];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\t}\n\n\tpostRefresh() {\n\t\tif (this.panel.fixedSpan) {\n\t\t\tthis.panel.span = this.panel.fixedSpan;\n\t\t}\n\n\t\tthis.measurements = this.panel.targets;\n\n\t\t/** Duplicate alias validation **/\n\t\tthis.duplicates = false;\n\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\n\t\t\treturn !measurement.hide;\n\t\t});\n\n\t\t_.each(this.measurements, (m) => {\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\n\t\t\t});\n\n\t\t\tif (res.length > 1) {\n\t\t\t\tthis.duplicates = true;\n\t\t\t}\n\t\t});\n\t}\n\n\tonInitEditMode() {\n\t\tthis.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\n\t\t// Load in the supported units-of-measure formats so they can be displayed in the editor\n\t\tthis.unitFormats = kbn.getUnitFormats();\n\t}\n\n\tsetUnitFormat(measurement, subItem) {\n\t\tmeasurement.units = subItem.value;\n\t\tthis.render();\n\t}\n\n\tfixPanelHeader() {\n\t\t// Handle the panel top menu height, since it's display doesn't look good with the panel\n\t\tlet panelHeaderHeight = '';\n\t\tif(this.panel.title.length === 0) {\n\t\t\tpanelHeaderHeight = '10px';\n\t\t}\n\t\tthis.$panelContainer.find('.panel-header').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.panel-menu-container').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.fa-caret-down').css('display', 'none');\n\t}\n\n\tsetElementHeight() {\n\t\t// Handle the panel height\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\n\t\tthis.minHeight = this.$panelContoller.height-10;\n\t}\n\n\tsetTextMaxWidth() {\n\t\tlet tail = ' …';\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\n\t\tif (isNaN(panelWidth))\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\n\t\tpanelWidth = panelWidth - 20;\n\t\tthis.maxWidth = panelWidth;\n\t}\n\n\tonHandlerChange(measurement) {\n\t\t// If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent\n\t\tif (measurement.valueHandler === \"Number Threshold\") {\n\t\t\tmeasurement.crit = (isNaN(Number(measurement.crit))) ? undefined : Number(measurement.crit);\n\t\t\tmeasurement.warn = (isNaN(Number(measurement.warn))) ? undefined : Number(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"String Threshold\") {\n\t\t\tif (typeof measurement.crit != \"undefined\") measurement.crit = String(measurement.crit);\n\t\t\tif (typeof measurement.warn != \"undefined\") measurement.warn = String(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"Date Threshold\") {\n\t\t\tlet c = new Date(measurement.crit), w = new Date(measurement.warn);\n\t\t\tmeasurement.crit = (isNaN(c.getTime())) ? undefined : c;\n\t\t\tmeasurement.warn = (isNaN(w.getTime())) ? undefined : w;\n\t\t}\n\t\tthis.onRender();\n\t}\n\n\tonColorChange(item) {\n\t\treturn (color) => {\n\t\t\tthis.panel.colors[item] = color;\n\t\t\tthis.render();\n\t\t};\n\t}\n\n\tonRender() {\n\t\tthis.fixPanelHeader();\n\t\tthis.setElementHeight();\n\t\tthis.setTextMaxWidth();\n\t\tthis.upgradeOldVersion();\n\n\t\tif (this.panel.clusterName) {\n\t\t\tthis.panel.displayName =\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\n\t\t} else {\n\t\t\tthis.panel.displayName = \"\";\n\t\t}\n\n\t\tif(this.panel.flipCard){\n\t\t this.$panelContainer.addClass(\"effect-hover\");\n\t\t} else {\n\t\t this.$panelContainer.removeClass(\"effect-hover\");\n\t\t}\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.disabled = [];\n\t\tthis.display = [];\n\t\tthis.annotation = [];\n\t\tthis.extraMoreAlerts = null;\n\n\t\t_.each(this.series, (s) => {\n\t\t\tlet target = _.find(targets, (target) => {\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\n\t\t\t});\n\n\t\t\tif (!target) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts.alias = target.alias;\n\t\t\ts.url = target.url;\n\t\t\ts.isDisplayValue = true;\n\t\t\ts.displayType = target.displayType;\n\t\t\ts.valueDisplayRegex = \"\";\n\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\n\t\t\t}\n\n\t\t\tlet value;\n\t\t\tswitch (target.aggregation) {\n\t\t\t\tcase 'Max':\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.max;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Min':\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.min;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Delta':\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0] - s.datapoints[0][0];\n\t\t\t\t\tvalue = s.stats.diff;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Sum':\n\t\t\t\t\tvalue = 0;\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\n\t\t\t\t\tvalue = s.stats.total;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Avg':\n\t\t\t\t\tvalue = s.stats.avg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'First':\n\t\t\t\t\tvalue = s.datapoints[0][0];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\n\t\t\t}\n\n\t\t\ts.display_value = value;\n\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Text Only\") {\n\t\t\t\tthis.handleTextOnly(s, target);\n\t\t\t}\n\t\t});\n\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\n\t\t\tthis.crit = [];\n\t\t\tthis.warn = [];\n\t\t\tthis.display = [];\n\t\t}\n\n\t\tthis.autoFlip();\n\t\tthis.updatePanelState();\n\t\tthis.handleCssDisplay();\n\t\tthis.parseUri();\n\n\t\t//This must appear after handling the css style of the panel\n\t\tthis.handleMaxAlertsToShow();\n\t}\n\n\tupgradeOldVersion() {\n\t\tlet targets = this.panel.targets;\n\n\t\t//Handle legacy code\n\t\t_.each(targets, (target) => {\n\t\t\tif(target.valueHandler == null) {\n\t\t\t\tif(target.displayType != null) {\n\t\t\t\t\ttarget.valueHandler = target.displayType;\n\t\t\t\t\tif (target.valueHandler == \"Annotation\") {\n\t\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = this.valueHandlers[0]\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\n\t\t\t}\n\n\t\t\tif(target.display != null){\n\t\t\t\ttarget.displayAliasType = target.display ? \"Always\" : this.displayAliasTypes[0];\n\t\t\t\ttarget.displayValueWithAlias = target.display ? 'When Alias Displayed' : this.displayValueTypes[0];\n\t\t\t\tdelete target.display;\n\n\t\t\t}\n\t\t});\n\n\t\t// Depreciate Threshold in favour of Type specific versions\n\t\t_.each(targets, (target) => {\n\t\t\tif (target.valueHandler === \"Threshold\") {\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\n\t\t\t\t// i.e. map to Number Threshold if two floats (i.e. range check) otherwise map to String Threshold (i.e. exact match)\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\n\t\t\t\t\ttarget.crit = Number(target.crit);\n\t\t\t\t\ttarget.warn = Number(target.warn);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\n\t\tlet isCritical = false;\n\t\tlet isWarning = false;\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\n\t\tif (isCheckRanges) {\n\t\t\tif (!series.inverted) {\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value == series.thresholds.crit) {\n\t\t\t\tisCritical = true\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\n\t\t\t\tisWarning = true\n\t\t\t}\n\t\t}\n\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\n\n\t\tlet displayValueWhenAliasDisplayed = 'When Alias Displayed' === target.displayValueWithAlias;\n\t\tlet displayValueFromWarning = 'Warning / Critical' === target.displayValueWithAlias;\n\t\tlet displayValueFromCritical = 'Critical Only' === target.displayValueWithAlias;\n\n\t\tif(isCritical) {\n\t\t\t//In critical state we don't show the error as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning || displayValueFromCritical;\n\t\t\tthis.crit.push(series);\n\t\t} else if(isWarning) {\n\t\t\t//In warning state we don't show the warning as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning;\n\t\t\tthis.warn.push(series);\n\t\t} else if (\"Always\" == target.displayAliasType) {\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed;\n\t\t\tif(series.displayType == \"Annotation\") {\n\t\t\t\tthis.annotation.push(series);\n\t\t\t} else {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\tformatDisplayValue(value, target) {\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\n\t\tif (target.valueHandler === \"Number Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\n\t\t\t\tlet decimals = this.decimalPlaces(value);\n\t\t\t\t// We define the decimal percision by the minimal decimal needed\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? Math.min(target.decimals, decimals) : decimals;\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Number\";\n\t\t\t}\n\t\t} else if (target.valueHandler === \"String Threshold\") {\n\t\t\tif (value === undefined || value === null || value !== value)\n\t\t\t\tvalue = \"Invalid String\";\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet date = moment(new Date(value));\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\n\t\t\t\tvalue = date.format(target.dateFormat);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Date\";\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\n\tdecimalPlaces(num) {\n\t\tvar match = (''+num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\t\tif (!match) { return 0; }\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t// Number of digits right of decimal point.\n\t\t\t(match[1] ? match[1].length : 0)\n\t\t\t// Adjust for scientific notation.\n\t\t\t- (match[2] ? +match[2] : 0));\n\t}\n\n\thandleDisabledStatus(series, target) {\n\t\tseries.displayType = this.displayTypes[0];\n\t\tseries.disabledValue = target.disabledValue;\n\n\t\tif (series.display_value == series.disabledValue) {\n\t\t\tthis.disabled.push(series);\n\t\t}\n\t}\n\n\thandleTextOnly(series, target) {\n\t\tif(series.displayType == \"Annotation\") {\n\t\t\tthis.annotation.push(series);\n\t\t} else {\n\t\t\tthis.display.push(series);\n\t\t}\n\t}\n\n\tupdatePanelState() {\n\t\tif(this.duplicates) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.panelState = 'disabled-state';\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.panelState = 'warn-state';\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.panelState = 'no-data-state';\n\t\t} else {\n\t\t\tthis.panelState = 'ok-state';\n\t\t}\n\t}\n\n\thandleCssDisplay() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\t\tthis.$panelContainer.addClass(this.panelState);\n\n\t\tlet radius = _.isNumber(this.panel.cornerRadius) ? this.panel.cornerRadius : 0\n\t\tthis.$panelContainer.css('border-radius', radius + '%');\n\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\n\n\t\tif (this.panel.colorMode === \"Panel\") {\n\t\t\tswitch(this.panelState) {\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.$panelContainer.css('background-color', '');\n\t\t}\n\t}\n\n\thandleMaxAlertsToShow() {\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\n\t\t\tlet filteredOutAlerts = 0;\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\n\t\t\t\tlet originAlertCount = this[arrayName].length;\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\n\t\t\t});\n\n\t\t\tif(filteredOutAlerts > 0) {\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\n\t\t\t}\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tlet link = this.panel.links[0];\n\n\t\t\tif (link.type == \"absolute\") {\n\t\t\t\tthis.uri = link.url;\n\t\t\t} else {\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\n\t\t\t}\n\n\t\t\tif (link.params) {\n\t\t\t\tthis.uri += \"?\" + link.params;\n\t\t\t}\n\n\t\t\tthis.targetBlank = link.targetBlank;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tvalidateRegex(textRegex) {\n\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\treturn true\n\t\t}\n\t\ttry {\n\t\t\tlet regex = new RegExp(textRegex);\n\t\t\treturn true\n\t\t} catch(e) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\n\t\t\tres.warn = parseFloat(metricOptions.warn);\n\t\t\tres.warnIsNumber = true;\n\t\t} else if (metricOptions.warn instanceof Date) {\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\n\t\t\tres.warn = metricOptions.warn.valueOf();\n\t\t\tres.warnIsNumber = true;\n\t\t} else {\n\t\t\tres.warn = metricOptions.warn;\n\t\t\tres.warnIsNumber = false;\n\t\t}\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\n\t\t\tres.crit = parseFloat(metricOptions.crit);\n\t\t\tres.critIsNumber = true;\n\t\t} else if (metricOptions.crit instanceof Date) {\n\t\t\tres.crit = metricOptions.crit.valueOf();\n\t\t\tres.critIsNumber = true;\n\t\t} else {\n\t\t\tres.crit = metricOptions.crit;\n\t\t\tres.critIsNumber = false;\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tstatic isFloat(val) {\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tstatic seriesHandler(seriesData) {\n\t\tvar series = new TimeSeries({\n\t\t\tdatapoints: seriesData.datapoints,\n\t\t\talias: seriesData.target\n\t\t});\n\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\n\n\t\treturn series;\n\t}\n\n\t$onDestroy() {\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\n\t}\n\n\tautoFlip() {\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\n\t\t\tthis.timeoutId = setInterval(() => {\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\n\t\t\t}, this.panel.flipTime * 1000);\n\t\t}\n\t}\n\n\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\n\t\tthis.$panelContainer.addClass(\"st-card\");\n\t\tthis.$panelContoller = ctrl;\n\t}\n}\n\nStatusPluginCtrl.templateUrl = 'module.html';\n"]} \ No newline at end of file +{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","kbn","moment","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","cornerRadius","isAutoScrollOnOverflow","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","displayAliasTypes","displayValueTypes","colorModes","fontFormats","each","targets","t","valueHandler","Date","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","onColorChange","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","duplicates","measurement","hide","m","res","alias","target","addEditorTab","unitFormats","getUnitFormats","subItem","units","value","render","panelHeaderHeight","title","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","element","overflowY","offsetHeight","scrollHeight","Number","undefined","String","c","w","getTime","item","color","fixPanelHeader","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","handleCssDisplay","parseUri","handleMaxAlertsToShow","displayAliasType","displayValueWithAlias","isFloat","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","formatDisplayValue","displayValueWhenAliasDisplayed","displayValueFromWarning","displayValueFromCritical","push","isFinite","decimals","decimalPlaces","Math","valueFormats","date","dashboard","isTimezoneUtc","utc","format","dateFormat","num","disabledValue","panelState","radius","okColor","maxAlertNumber","currentMaxAllowedAlerts","filteredOutAlerts","arrayNamesToSlice","forEach","originAlertCount","arrayName","links","link","type","uri","dashUri","params","targetBlank","dataList","map","seriesHandler","timeoutId","clearInterval","setInterval","toggleClass","scope","elem","attrs","ctrl","metricOptions","parseFloat","valueOf","val","toString","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;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AAvC,CAAJ,EAAkD;AACjD2D,WAAI3D,IAAJ,GAAWiM,WAAWD,cAAchM,IAAzB,CAAX;AACA2D,WAAIsF,YAAJ,GAAmB,IAAnB;AACA,OAHD,MAGO,IAAI+C,cAAchM,IAAd,YAA8B6B,IAAlC,EAAwC;AAC9C8B,WAAI3D,IAAJ,GAAWgM,cAAchM,IAAd,CAAmBkM,OAAnB,EAAX;AACAvI,WAAIsF,YAAJ,GAAmB,IAAnB;AACA,OAHM,MAGA;AACNtF,WAAI3D,IAAJ,GAAWgM,cAAchM,IAAzB;AACA2D,WAAIsF,YAAJ,GAAmB,KAAnB;AACA;;AAED,aAAOtF,GAAP;AACA;;;6BAEcwI,G,EAAK;AACnB,UAAI,CAACnH,MAAMmH,GAAN,CAAD,IAAeA,IAAIC,QAAJ,GAAeC,WAAf,GAA6BC,OAA7B,CAAqC,GAArC,KAA6C,CAAC,CAAjE,EAAoE;AACnE,cAAO,IAAP;AACA;AACD,aAAO,KAAP;AACA;;;mCAYoBC,U,EAAY;AAChC,UAAIzF,SAAS,IAAIvH,UAAJ,CAAe;AAC3BgI,mBAAYgF,WAAWhF,UADI;AAE3B3D,cAAO2I,WAAW1I;AAFS,OAAf,CAAb;;AAKAiD,aAAO0F,SAAP,GAAmB1F,OAAO2F,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO3F,MAAP;AACA;;;;KA5kBoCzH,gB;;;;AAkmBtCoB,oBAAiBiM,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\";\nimport kbn from \"app/core/utils/kbn\";\nimport moment from \"moment\";\n\nimport './css/status_panel.css!';\n\n// Set and populate panel defaults\nconst panelDefaults = {\n\tflipCard: false,\n\tflipTime: 5,\n\tcolorMode: 'Panel',\n\t// Changed colors to match Table Panel so colorised text is easier to read\n\tcolors: {\n\t\tcrit: 'rgba(245, 54, 54, 0.9)',\n\t\twarn: 'rgba(237, 129, 40, 0.9)',\n\t\tok: 'rgba(50, 128, 45, 0.9)',\n\t\tdisable: 'rgba(128, 128, 128, 0.9)'\n\t},\n\tisGrayOnNoData: false,\n\tisIgnoreOKColors: false,\n\tisHideAlertsOnDisable: false,\n\tcornerRadius: 0,\n\tisAutoScrollOnOverflow: false\n};\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\t\t_.defaultsDeep(this.panel, panelDefaults);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg', 'Delta'];\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\n\t\tthis.displayAliasTypes = ['Warning / Critical', 'Always'];\n\t\tthis.displayValueTypes = ['Never', 'When Alias Displayed', 'Warning / Critical', 'Critical Only'];\n\t\tthis.colorModes = ['Panel', 'Metric', 'Disabled'];\n\t\tthis.fontFormats = ['Regular', 'Bold', 'Italic'];\n\n\t\t// Dates get stored as strings and will need to be converted back to a Date objects\n\t\t_.each(this.panel.targets, (t) => {\n\t\t\tif (t.valueHandler === \"Date Threshold\") {\n\t\t\t\tif (typeof t.crit != \"undefined\") t.crit = new Date(t.crit);\n\t\t\t\tif (typeof t.warn != \"undefined\") t.warn = new Date(t.warn);\n\t\t\t}\n\t\t});\n\n\t\tthis.panel.flipTime = this.panel.flipTime || 5;\n\n\t\t/** Bind events to functions **/\n\t\tthis.events.on('render', this.onRender.bind(this));\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n\n\t\tthis.onColorChange = this.onColorChange.bind(this);\n\n\t\tthis.addFilters()\n\t}\n\n\taddFilters() {\n\t\tcoreModule.filter('numberOrText', () => {\n\t\t\tlet numberOrTextFilter = (input) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\treturn input;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet regex;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!input) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet matchResults = input.match(regex);\n\t\t\t\t\t\tif (matchResults == null) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn matchResults[0];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\t}\n\n\tpostRefresh() {\n\t\tif (this.panel.fixedSpan) {\n\t\t\tthis.panel.span = this.panel.fixedSpan;\n\t\t}\n\n\t\tthis.measurements = this.panel.targets;\n\n\t\t/** Duplicate alias validation **/\n\t\tthis.duplicates = false;\n\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\n\t\t\treturn !measurement.hide;\n\t\t});\n\n\t\t_.each(this.measurements, (m) => {\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\n\t\t\t});\n\n\t\t\tif (res.length > 1) {\n\t\t\t\tthis.duplicates = true;\n\t\t\t}\n\t\t});\n\t}\n\n\tonInitEditMode() {\n\t\tthis.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\n\t\t// Load in the supported units-of-measure formats so they can be displayed in the editor\n\t\tthis.unitFormats = kbn.getUnitFormats();\n\t}\n\n\tsetUnitFormat(measurement, subItem) {\n\t\tmeasurement.units = subItem.value;\n\t\tthis.render();\n\t}\n\n\tfixPanelHeader() {\n\t\t// Handle the panel top menu height, since it's display doesn't look good with the panel\n\t\tlet panelHeaderHeight = '';\n\t\tif(this.panel.title.length === 0) {\n\t\t\tpanelHeaderHeight = '10px';\n\t\t}\n\t\tthis.$panelContainer.find('.panel-header').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.panel-menu-container').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.fa-caret-down').css('display', 'none');\n\t}\n\n\tsetElementHeight() {\n\t\t// Handle the panel height\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\n\t\tthis.minHeight = this.$panelContoller.height-10;\n\t}\n\n\tsetTextMaxWidth() {\n\t\tlet tail = ' …';\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\n\t\tif (isNaN(panelWidth))\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\n\t\tpanelWidth = panelWidth - 20;\n\t\tthis.maxWidth = panelWidth;\n\t}\n\n\tisAutoScrollAlerts() {\n\t\tif(!this.panel.isAutoScrollOnOverflow) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet element = this.$panelContainer.find('.status-panel')[0];\n\t\tlet overflowY = element.offsetHeight < element.scrollHeight;\n\t\treturn overflowY;\n\t}\n\n\tonHandlerChange(measurement) {\n\t\t// If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent\n\t\tif (measurement.valueHandler === \"Number Threshold\") {\n\t\t\tmeasurement.crit = (isNaN(Number(measurement.crit))) ? undefined : Number(measurement.crit);\n\t\t\tmeasurement.warn = (isNaN(Number(measurement.warn))) ? undefined : Number(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"String Threshold\") {\n\t\t\tif (typeof measurement.crit != \"undefined\") measurement.crit = String(measurement.crit);\n\t\t\tif (typeof measurement.warn != \"undefined\") measurement.warn = String(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"Date Threshold\") {\n\t\t\tlet c = new Date(measurement.crit), w = new Date(measurement.warn);\n\t\t\tmeasurement.crit = (isNaN(c.getTime())) ? undefined : c;\n\t\t\tmeasurement.warn = (isNaN(w.getTime())) ? undefined : w;\n\t\t}\n\t\tthis.onRender();\n\t}\n\n\tonColorChange(item) {\n\t\treturn (color) => {\n\t\t\tthis.panel.colors[item] = color;\n\t\t\tthis.render();\n\t\t};\n\t}\n\n\tonRender() {\n\t\tthis.fixPanelHeader();\n\t\tthis.setElementHeight();\n\t\tthis.setTextMaxWidth();\n\t\tthis.upgradeOldVersion();\n\n\t\tif (this.panel.clusterName) {\n\t\t\tthis.panel.displayName =\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\n\t\t} else {\n\t\t\tthis.panel.displayName = \"\";\n\t\t}\n\n\t\tif(this.panel.flipCard){\n\t\t\tthis.$panelContainer.addClass(\"effect-hover\");\n\t\t} else {\n\t\t\tthis.$panelContainer.removeClass(\"effect-hover\");\n\t\t}\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.disabled = [];\n\t\tthis.display = [];\n\t\tthis.annotation = [];\n\t\tthis.extraMoreAlerts = null;\n\n\t\t_.each(this.series, (s) => {\n\t\t\tlet target = _.find(targets, (target) => {\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\n\t\t\t});\n\n\t\t\tif (!target) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts.alias = target.alias;\n\t\t\ts.url = target.url;\n\t\t\ts.isDisplayValue = true;\n\t\t\ts.displayType = target.displayType;\n\t\t\ts.valueDisplayRegex = \"\";\n\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\n\t\t\t}\n\n\t\t\tlet value;\n\t\t\tswitch (target.aggregation) {\n\t\t\t\tcase 'Max':\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.max;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Min':\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.min;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Delta':\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0] - s.datapoints[0][0];\n\t\t\t\t\tvalue = s.stats.diff;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Sum':\n\t\t\t\t\tvalue = 0;\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\n\t\t\t\t\tvalue = s.stats.total;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Avg':\n\t\t\t\t\tvalue = s.stats.avg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'First':\n\t\t\t\t\tvalue = s.datapoints[0][0];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\n\t\t\t}\n\n\t\t\ts.display_value = value;\n\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Text Only\") {\n\t\t\t\tthis.handleTextOnly(s, target);\n\t\t\t}\n\t\t});\n\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\n\t\t\tthis.crit = [];\n\t\t\tthis.warn = [];\n\t\t\tthis.display = [];\n\t\t}\n\n\t\tthis.autoFlip();\n\t\tthis.updatePanelState();\n\t\tthis.handleCssDisplay();\n\t\tthis.parseUri();\n\n\t\t//This must appear after handling the css style of the panel\n\t\tthis.handleMaxAlertsToShow();\n\t}\n\n\tupgradeOldVersion() {\n\t\tlet targets = this.panel.targets;\n\n\t\t//Handle legacy code\n\t\t_.each(targets, (target) => {\n\t\t\tif(target.valueHandler == null) {\n\t\t\t\tif(target.displayType != null) {\n\t\t\t\t\ttarget.valueHandler = target.displayType;\n\t\t\t\t\tif (target.valueHandler == \"Annotation\") {\n\t\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = this.valueHandlers[0]\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\n\t\t\t}\n\n\t\t\tif(target.display != null){\n\t\t\t\ttarget.displayAliasType = target.display ? \"Always\" : this.displayAliasTypes[0];\n\t\t\t\ttarget.displayValueWithAlias = target.display ? 'When Alias Displayed' : this.displayValueTypes[0];\n\t\t\t\tdelete target.display;\n\n\t\t\t}\n\t\t});\n\n\t\t// Depreciate Threshold in favour of Type specific versions\n\t\t_.each(targets, (target) => {\n\t\t\tif (target.valueHandler === \"Threshold\") {\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\n\t\t\t\t// i.e. map to Number Threshold if two floats (i.e. range check) otherwise map to String Threshold (i.e. exact match)\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\n\t\t\t\t\ttarget.crit = Number(target.crit);\n\t\t\t\t\ttarget.warn = Number(target.warn);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\n\t\tlet isCritical = false;\n\t\tlet isWarning = false;\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\n\t\tif (isCheckRanges) {\n\t\t\tif (!series.inverted) {\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value == series.thresholds.crit) {\n\t\t\t\tisCritical = true\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\n\t\t\t\tisWarning = true\n\t\t\t}\n\t\t}\n\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\n\n\t\tlet displayValueWhenAliasDisplayed = 'When Alias Displayed' === target.displayValueWithAlias;\n\t\tlet displayValueFromWarning = 'Warning / Critical' === target.displayValueWithAlias;\n\t\tlet displayValueFromCritical = 'Critical Only' === target.displayValueWithAlias;\n\n\t\tif(isCritical) {\n\t\t\t//In critical state we don't show the error as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning || displayValueFromCritical;\n\t\t\tthis.crit.push(series);\n\t\t} else if(isWarning) {\n\t\t\t//In warning state we don't show the warning as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning;\n\t\t\tthis.warn.push(series);\n\t\t} else if (\"Always\" == target.displayAliasType) {\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed;\n\t\t\tif(series.displayType == \"Annotation\") {\n\t\t\t\tthis.annotation.push(series);\n\t\t\t} else {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\tformatDisplayValue(value, target) {\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\n\t\tif (target.valueHandler === \"Number Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\n\t\t\t\tlet decimals = this.decimalPlaces(value);\n\t\t\t\t// We define the decimal percision by the minimal decimal needed\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? Math.min(target.decimals, decimals) : decimals;\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Number\";\n\t\t\t}\n\t\t} else if (target.valueHandler === \"String Threshold\") {\n\t\t\tif (value === undefined || value === null || value !== value)\n\t\t\t\tvalue = \"Invalid String\";\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet date = moment(new Date(value));\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\n\t\t\t\tvalue = date.format(target.dateFormat);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Date\";\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\n\tdecimalPlaces(num) {\n\t\tvar match = (''+num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\t\tif (!match) { return 0; }\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t// Number of digits right of decimal point.\n\t\t\t(match[1] ? match[1].length : 0)\n\t\t\t// Adjust for scientific notation.\n\t\t\t- (match[2] ? +match[2] : 0));\n\t}\n\n\thandleDisabledStatus(series, target) {\n\t\tseries.displayType = this.displayTypes[0];\n\t\tseries.disabledValue = target.disabledValue;\n\n\t\tif (series.display_value == series.disabledValue) {\n\t\t\tthis.disabled.push(series);\n\t\t}\n\t}\n\n\thandleTextOnly(series, target) {\n\t\tif(series.displayType == \"Annotation\") {\n\t\t\tthis.annotation.push(series);\n\t\t} else {\n\t\t\tthis.display.push(series);\n\t\t}\n\t}\n\n\tupdatePanelState() {\n\t\tif(this.duplicates) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.panelState = 'disabled-state';\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.panelState = 'warn-state';\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.panelState = 'no-data-state';\n\t\t} else {\n\t\t\tthis.panelState = 'ok-state';\n\t\t}\n\t}\n\n\thandleCssDisplay() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\t\tthis.$panelContainer.addClass(this.panelState);\n\n\t\tlet radius = _.isNumber(this.panel.cornerRadius) ? this.panel.cornerRadius : 0\n\t\tthis.$panelContainer.css('border-radius', radius + '%');\n\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\n\n\t\tif (this.panel.colorMode === \"Panel\") {\n\t\t\tswitch(this.panelState) {\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.$panelContainer.css('background-color', '');\n\t\t}\n\t}\n\n\thandleMaxAlertsToShow() {\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\n\t\t\tlet filteredOutAlerts = 0;\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\n\t\t\t\tlet originAlertCount = this[arrayName].length;\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\n\t\t\t});\n\n\t\t\tif(filteredOutAlerts > 0) {\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\n\t\t\t}\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tlet link = this.panel.links[0];\n\n\t\t\tif (link.type == \"absolute\") {\n\t\t\t\tthis.uri = link.url;\n\t\t\t} else {\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\n\t\t\t}\n\n\t\t\tif (link.params) {\n\t\t\t\tthis.uri += \"?\" + link.params;\n\t\t\t}\n\n\t\t\tthis.targetBlank = link.targetBlank;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tvalidateRegex(textRegex) {\n\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\treturn true\n\t\t}\n\t\ttry {\n\t\t\tlet regex = new RegExp(textRegex);\n\t\t\treturn true\n\t\t} catch(e) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\n\t\t\tres.warn = parseFloat(metricOptions.warn);\n\t\t\tres.warnIsNumber = true;\n\t\t} else if (metricOptions.warn instanceof Date) {\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\n\t\t\tres.warn = metricOptions.warn.valueOf();\n\t\t\tres.warnIsNumber = true;\n\t\t} else {\n\t\t\tres.warn = metricOptions.warn;\n\t\t\tres.warnIsNumber = false;\n\t\t}\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\n\t\t\tres.crit = parseFloat(metricOptions.crit);\n\t\t\tres.critIsNumber = true;\n\t\t} else if (metricOptions.crit instanceof Date) {\n\t\t\tres.crit = metricOptions.crit.valueOf();\n\t\t\tres.critIsNumber = true;\n\t\t} else {\n\t\t\tres.crit = metricOptions.crit;\n\t\t\tres.critIsNumber = false;\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tstatic isFloat(val) {\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tstatic seriesHandler(seriesData) {\n\t\tvar series = new TimeSeries({\n\t\t\tdatapoints: seriesData.datapoints,\n\t\t\talias: seriesData.target\n\t\t});\n\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\n\n\t\treturn series;\n\t}\n\n\t$onDestroy() {\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\n\t}\n\n\tautoFlip() {\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\n\t\t\tthis.timeoutId = setInterval(() => {\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\n\t\t\t}, this.panel.flipTime * 1000);\n\t\t}\n\t}\n\n\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\n\t\tthis.$panelContainer.addClass(\"st-card\");\n\t\tthis.$panelContoller = ctrl;\n\t}\n}\n\nStatusPluginCtrl.templateUrl = 'module.html';\n"]} \ No newline at end of file diff --git a/src/css/status_panel.scss b/src/css/status_panel.scss index d89ba0dc..6871f853 100644 --- a/src/css/status_panel.scss +++ b/src/css/status_panel.scss @@ -1,4 +1,5 @@ .status-panel { + overflow: hidden; position: relative; width: 100%; height: 100%; @@ -64,11 +65,33 @@ .st-card-front, .st-card-back { - backface-visibility: hidden; - transition: transform 0.5s; + backface-visibility: hidden; + transition: transform 0.5s; } } +.marquee_container { + overflow: hidden; + + .marquee_element { + backface-visibility: hidden; + transition: transform 0.5s; + + display: inline-block; + animation: marquee_container 15s linear infinite; + } + + .marquee_element:hover { + animation-play-state: paused; + } +} + +/* Make it move */ +@keyframes marquee_container { + 0% { transform: translate(0, 100%); } + 100% { transform: translate(0, -100%); } +} + .st-card-front { .ok-text, .warning-text, .fail-text, .no-data-text, .disabled-text { display: none; diff --git a/src/editor.html b/src/editor.html index 96e14852..04243007 100644 --- a/src/editor.html +++ b/src/editor.html @@ -110,9 +110,14 @@
Threshold Preferences
- + +
Other Options
+
-
-
- {{ display.alias }} - {{ display.alias }} - - {{ display.display_value | numberOrTextWithRegex : display.valueDisplayRegex }} -
+
+
+
+ {{ display.alias }} + {{ display.alias }} + - {{ display.display_value | numberOrTextWithRegex : display.valueDisplayRegex }} +
-
- {{ crit.alias }} - {{ crit.alias }} - - {{ crit.display_value | numberOrTextWithRegex : crit.valueDisplayRegex }} -
+
+ {{ crit.alias }} + {{ crit.alias }} + - {{ crit.display_value | numberOrTextWithRegex : crit.valueDisplayRegex }} +
-
- {{ warn.alias }} - {{ warn.alias }} - - {{ warn.display_value | numberOrTextWithRegex : warn.valueDisplayRegex }} -
+
+ {{ warn.alias }} + {{ warn.alias }} + - {{ warn.display_value | numberOrTextWithRegex : warn.valueDisplayRegex }} +
-
- {{ disabled.alias }} - {{ disabled.alias }} -
+
+ {{ disabled.alias }} + {{ disabled.alias }} +
-
{{ ctrl.extraMoreAlerts }}
+
{{ ctrl.extraMoreAlerts }}
+
-
diff --git a/src/plugin.json b/src/plugin.json index c39674fd..6cc48e1b 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -24,7 +24,7 @@ {"name": "Critical State", "path": "img/error.png"} ], "version": "1.0.8", - "updated": "2018-3-27" + "updated": "2018-3-28" }, "dependencies": { diff --git a/src/status_ctrl.js b/src/status_ctrl.js index 0292dc3b..a60a675c 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -22,7 +22,8 @@ const panelDefaults = { isGrayOnNoData: false, isIgnoreOKColors: false, isHideAlertsOnDisable: false, - cornerRadius: 0 + cornerRadius: 0, + isAutoScrollOnOverflow: false }; export class StatusPluginCtrl extends MetricsPanelCtrl { @@ -176,6 +177,16 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { this.maxWidth = panelWidth; } + isAutoScrollAlerts() { + if(!this.panel.isAutoScrollOnOverflow) { + return false; + } + + let element = this.$panelContainer.find('.status-panel')[0]; + let overflowY = element.offsetHeight < element.scrollHeight; + return overflowY; + } + onHandlerChange(measurement) { // If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent if (measurement.valueHandler === "Number Threshold") { @@ -214,9 +225,9 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { } if(this.panel.flipCard){ - this.$panelContainer.addClass("effect-hover"); + this.$panelContainer.addClass("effect-hover"); } else { - this.$panelContainer.removeClass("effect-hover"); + this.$panelContainer.removeClass("effect-hover"); } let targets = this.panel.targets;