-
{{ disabled.alias }}
+
diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js
index b90e042d..29bacd1c 100644
--- a/dist/status_ctrl.js
+++ b/dist/status_ctrl.js
@@ -68,6 +68,22 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi
};
}();
+ panelDefaults = {
+ flipCard: false,
+ flipTime: 5,
+ colorMode: 'Panel',
+ // Changed colors to match Table Panel so colorised text is easier to read
+ colors: {
+ crit: 'rgba(245, 54, 54, 0.9)',
+ warn: 'rgba(237, 129, 40, 0.9)',
+ ok: 'rgba(50, 128, 45, 0.9)',
+ disable: 'rgba(128, 128, 128, 0.9)'
+ },
+ isGrayOnNoData: false,
+ isIgnoreOKColors: false,
+ isHideAlertsOnDisable: false
+ };
+
_export("StatusPluginCtrl", StatusPluginCtrl = function (_MetricsPanelCtrl) {
_inherits(StatusPluginCtrl, _MetricsPanelCtrl);
@@ -77,12 +93,15 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi
var _this = _possibleConstructorReturn(this, (StatusPluginCtrl.__proto__ || Object.getPrototypeOf(StatusPluginCtrl)).call(this, $scope, $injector));
+ _.defaultsDeep(_this.panel, panelDefaults);
+
//this.log = $log.debug;
_this.filter = $filter;
_this.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];
_this.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];
_this.displayTypes = ['Regular', 'Annotation'];
+ _this.colorModes = ['Panel', 'Metric', 'Disabled'];
// Dates get stored as strings and will need to be converted back to a Date objects
_.each(_this.panel.targets, function (t) {
@@ -330,6 +349,7 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi
}
this.autoFlip();
+ this.updatePanelState();
this.handleCssDisplay();
this.parseUri();
@@ -466,23 +486,46 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi
}
}
}, {
- key: "handleCssDisplay",
- value: function handleCssDisplay() {
- this.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state default-background');
+ key: "updatePanelState",
+ value: function updatePanelState() {
if (this.duplicates) {
- this.$panelContainer.addClass('error-state');
+ this.panelState = 'error-state';
} else if (this.disabled.length > 0) {
- this.$panelContainer.addClass('disabled-state');
+ this.panelState = 'disabled-state';
} else if (this.crit.length > 0) {
- this.$panelContainer.addClass('error-state');
+ this.panelState = 'error-state';
} else if (this.warn.length > 0) {
- this.$panelContainer.addClass('warn-state');
+ this.panelState = 'warn-state';
} else if ((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {
- this.$panelContainer.addClass('no-data-state');
+ this.panelState = 'no-data-state';
+ } else {
+ this.panelState = 'ok-state';
+ }
+ }
+ }, {
+ key: "handleCssDisplay",
+ value: function handleCssDisplay() {
+ this.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');
+ this.$panelContainer.addClass(this.panelState);
+
+ var okColor = this.panel.isIgnoreOKColors ? '' : this.panel.colors.ok;
+
+ if (this.panel.colorMode === "Panel") {
+ switch (this.panelState) {
+ case 'disabled-state':
+ this.$panelContainer.css('background-color', this.panel.colors.disable);break;
+ case 'error-state':
+ this.$panelContainer.css('background-color', this.panel.colors.crit);break;
+ case 'warn-state':
+ this.$panelContainer.css('background-color', this.panel.colors.warn);break;
+ case 'no-data-state':
+ this.$panelContainer.css('background-color', this.panel.colors.disable);break;
+ default:
+ this.$panelContainer.css('background-color', okColor);break;
+ }
} else {
- this.$panelContainer.addClass('ok-state');
- if (this.panel.useDefaultBackground) this.$panelContainer.addClass('default-background');
+ this.$panelContainer.css('background-color', '');
}
}
}, {
diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map
index 57a24b6f..b9aa3ea5 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","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","filter","valueHandlers","aggregations","displayTypes","each","panel","targets","t","valueHandler","crit","Date","warn","flipTime","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","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","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","Number","undefined","String","c","w","getTime","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","flipCard","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","isHideAlertsOnDisable","autoFlip","handleCssDisplay","parseUri","handleMaxAlertsToShow","isFloat","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","formatDisplayValue","push","isFinite","decimals","Math","floor","toString","split","valueFormats","date","dashboard","isTimezoneUtc","utc","format","dateFormat","disabledValue","isGrayOnNoData","useDefaultBackground","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","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAASA,mB,kBAAAA,gB;;AAGFC,I;;AACAC,a;;AACAC,a;;AACAC,M;;AACAC,S;;;;;;;;;;;;;;;;;;;;;+BAIMC,gB;;;AACZ;AACA,8BAAYC,MAAZ,EAAoBC,SAApB,EAA+BC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B;AACA;;AAED,aAAO1E,GAAP;AACA;;;6BAEcyH,G,EAAK;AACnB,UAAI,CAACtG,MAAMsG,GAAN,CAAD,IAAeA,IAAIxC,QAAJ,GAAeyC,WAAf,GAA6BC,OAA7B,CAAqC,GAArC,KAA6C,CAAC,CAAjE,EAAoE;AACnE,cAAO,IAAP;AACA;AACD,aAAO,KAAP;AACA;;;mCAYoBC,U,EAAY;AAChC,UAAIjF,SAAS,IAAI9F,UAAJ,CAAe;AAC3BsG,mBAAYyE,WAAWzE,UADI;AAE3BlD,cAAO2H,WAAW1H;AAFS,OAAf,CAAb;;AAKAyC,aAAOkF,SAAP,GAAmBlF,OAAOmF,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAOnF,MAAP;AACA;;;;KAjfoChG,gB;;;;AAugBtCM,oBAAiB8K,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\r\nimport \"app/plugins/panel/graph/legend\";\r\nimport \"app/plugins/panel/graph/series_overrides_ctrl\";\r\nimport _ from \"lodash\";\r\nimport TimeSeries from \"app/core/time_series2\";\r\nimport coreModule from \"app/core/core_module\";\r\nimport kbn from \"app/core/utils/kbn\";\r\nimport moment from \"moment\";\r\n\r\nimport './css/status_panel.css!';\r\n\r\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\r\n\t/** @ngInject */\r\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\r\n\t\tsuper($scope, $injector);\r\n\r\n\t\t//this.log = $log.debug;\r\n\t\tthis.filter = $filter;\r\n\r\n\t\tthis.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];\r\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];\r\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\r\n\r\n\t\t// Dates get stored as strings and will need to be converted back to a Date objects\r\n\t\t_.each(this.panel.targets, (t) => {\r\n\t\t\tif (t.valueHandler === \"Date Threshold\") {\r\n\t\t\t\tif (typeof t.crit != \"undefined\") t.crit = new Date(t.crit);\r\n\t\t\t\tif (typeof t.warn != \"undefined\") t.warn = new Date(t.warn);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.panel.flipTime = this.panel.flipTime || 5;\r\n\r\n\t\t/** Bind events to functions **/\r\n\t\tthis.events.on('render', this.onRender.bind(this));\r\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\r\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\r\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\r\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\r\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\r\n\r\n\t\tthis.addFilters()\r\n\t}\r\n\r\n\taddFilters() {\r\n\t\tcoreModule.filter('numberOrText', () => {\r\n\t\t\tlet numberOrTextFilter = (input) => {\r\n\t\t\t\tif(angular.isNumber(input)) {\r\n\t\t\t\t\treturn this.filter('number')(input);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn input;\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tnumberOrTextFilter.$stateful = true;\r\n\t\t\treturn numberOrTextFilter;\r\n\t\t});\r\n\r\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\r\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\r\n\t\t\t\tif(angular.isNumber(input)) {\r\n\t\t\t\t\treturn this.filter('number')(input);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\r\n\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tlet regex;\r\n\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\r\n\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (!input) {\r\n\t\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tlet matchResults = input.match(regex);\r\n\t\t\t\t\t\tif (matchResults == null) {\r\n\t\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn matchResults[0];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tnumberOrTextFilter.$stateful = true;\r\n\t\t\treturn numberOrTextFilter;\r\n\t\t});\r\n\t}\r\n\r\n\tpostRefresh() {\r\n\t\tif (this.panel.fixedSpan) {\r\n\t\t\tthis.panel.span = this.panel.fixedSpan;\r\n\t\t}\r\n\r\n\t\tthis.measurements = this.panel.targets;\r\n\r\n\t\t/** Duplicate alias validation **/\r\n\t\tthis.duplicates = false;\r\n\r\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\r\n\t\t\treturn !measurement.hide;\r\n\t\t});\r\n\r\n\t\t_.each(this.measurements, (m) => {\r\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\r\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\r\n\t\t\t});\r\n\r\n\t\t\tif (res.length > 1) {\r\n\t\t\t\tthis.duplicates = true;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tonInitEditMode() {\r\n this.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\r\n\t\t// Load in the supported units-of-measure formats so they can be displayed in the editor\r\n\t\tthis.unitFormats = kbn.getUnitFormats();\r\n\t}\r\n\r\n setUnitFormat(measurement, subItem) {\r\n\t\tmeasurement.units = subItem.value;\r\n\t\tthis.render();\r\n\t}\r\n\r\n\tsetElementHeight() {\r\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\r\n\t\tthis.minHeight = this.$panelContoller.height-10;\r\n\t}\r\n\r\n\tsetTextMaxWidth() {\r\n\t\tlet tail = ' …';\r\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\r\n\t\tif (isNaN(panelWidth))\r\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\r\n\t\tpanelWidth = panelWidth - 20;\r\n\t\tthis.maxWidth = panelWidth;\r\n\t}\r\n\r\n\tonHandlerChange(measurement) {\r\n\t\t// If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent\r\n\t\tif (measurement.valueHandler === \"Number Threshold\") {\r\n\t\t\tmeasurement.crit = (isNaN(Number(measurement.crit))) ? undefined : Number(measurement.crit);\r\n\t\t\tmeasurement.warn = (isNaN(Number(measurement.warn))) ? undefined : Number(measurement.warn);\r\n\t\t} else if (measurement.valueHandler === \"String Threshold\") {\r\n\t\t\tif (typeof measurement.crit != \"undefined\") measurement.crit = String(measurement.crit);\r\n\t\t\tif (typeof measurement.warn != \"undefined\") measurement.warn = String(measurement.warn);\r\n\t\t} else if (measurement.valueHandler === \"Date Threshold\") {\r\n\t\t\tlet c = new Date(measurement.crit), w = new Date(measurement.warn);\r\n\t\t\tmeasurement.crit = (isNaN(c.getTime())) ? undefined : c;\r\n\t\t\tmeasurement.warn = (isNaN(w.getTime())) ? undefined : w;\r\n\t\t}\r\n\t\tthis.onRender();\r\n\t}\r\n\r\n\tonRender() {\r\n\t\tthis.setElementHeight();\r\n\t\tthis.setTextMaxWidth();\r\n\t\tthis.upgradeOldVersion();\r\n\r\n\t\tif (this.panel.clusterName) {\r\n\t\t\tthis.panel.displayName =\r\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\r\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\r\n\t\t} else {\r\n\t\t\tthis.panel.displayName = \"\";\r\n\t\t}\r\n\r\n\t\tif(this.panel.flipCard){\r\n\t\t this.$panelContainer.addClass(\"effect-hover\");\r\n\t\t} else {\r\n\t\t this.$panelContainer.removeClass(\"effect-hover\");\r\n\t\t}\r\n\r\n\t\tlet targets = this.panel.targets;\r\n\r\n\t\tthis.crit = [];\r\n\t\tthis.warn = [];\r\n\t\tthis.disabled = [];\r\n\t\tthis.display = [];\r\n\t\tthis.annotation = [];\r\n\t\tthis.extraMoreAlerts = null;\r\n\r\n\t\t_.each(this.series, (s) => {\r\n\t\t\tlet target = _.find(targets, (target) => {\r\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\r\n\t\t\t});\r\n\r\n\t\t\tif (!target) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\ts.alias = target.alias;\r\n\t\t\ts.url = target.url;\r\n\t\t\ts.display = true;\r\n\t\t\ts.displayType = target.displayType;\r\n\t\t\ts.valueDisplayRegex = \"\";\r\n\r\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\r\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\r\n\t\t\t}\r\n\r\n\t\t\tlet value;\r\n\t\t\tswitch (target.aggregation) {\r\n\t\t\t\tcase 'Max':\r\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\r\n\t\t\t\t\tvalue = s.stats.max;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Min':\r\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\r\n\t\t\t\t\tvalue = s.stats.min;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Sum':\r\n\t\t\t\t\tvalue = 0;\r\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\r\n\t\t\t\t\tvalue = s.stats.total;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Avg':\r\n\t\t\t\t\tvalue = s.stats.avg;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'First':\r\n\t\t\t\t\tvalue = s.datapoints[0][0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\r\n\t\t\t}\r\n\r\n\t\t\ts.display_value = value;\r\n\r\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\r\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\r\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\r\n\t\t\t\tthis.handleThresholdStatus(s, target);\r\n\t\t\t}\r\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\r\n\t\t\t\tthis.handleDisabledStatus(s,target);\r\n\t\t\t}\r\n\t\t\telse if (target.valueHandler == \"Text Only\") {\r\n\t\t\t\tthis.handleTextOnly(s, target);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\r\n\t\t\tthis.crit = [];\r\n\t\t\tthis.warn = [];\r\n\t\t\tthis.display = [];\r\n\t\t}\r\n\r\n\t\tthis.autoFlip();\r\n\t\tthis.handleCssDisplay();\r\n\t\tthis.parseUri();\r\n\r\n\t\t//This must appear after handling the css style of the panel\r\n\t\tthis.handleMaxAlertsToShow();\r\n\t}\r\n\r\n\tupgradeOldVersion() {\r\n\t\tlet targets = this.panel.targets;\r\n\r\n\t\t//Handle legacy code\r\n\t\t_.each(targets, (target) => {\r\n\t\t\tif(target.valueHandler == null) {\r\n\t\t\t\ttarget.valueHandler = target.displayType;\r\n\t\t\t\tif(target.valueHandler == \"Annotation\") {\r\n\t\t\t\t\ttarget.valueHandler = \"Text Only\"\r\n\t\t\t\t}\r\n\t\t\t\ttarget.displayType = this.displayTypes[0];\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// Depreciate Threshold in favour of Type specific versions\r\n\t\t_.each(targets, (target) => {\r\n\t\t\tif (target.valueHandler === \"Threshold\") {\r\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\r\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)\r\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\r\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\r\n\t\t\t\t\ttarget.crit = Number(target.crit);\r\n\t\t\t\t\ttarget.warn = Number(target.warn);\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\r\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\r\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\thandleThresholdStatus(series, target) {\r\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\r\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\r\n\t\tseries.display = target.display;\r\n\r\n\t\tlet isCritical = false;\r\n\t\tlet isWarning = false;\r\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\r\n\t\tif (isCheckRanges) {\r\n\t\t\tif (!series.inverted) {\r\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\r\n\t\t\t\t\tisCritical = true\r\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\r\n\t\t\t\t\tisWarning = true\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\r\n\t\t\t\t\tisCritical = true\r\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\r\n\t\t\t\t\tisWarning = true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (series.display_value == series.thresholds.crit) {\r\n\t\t\t\tisCritical = true\r\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\r\n\t\t\t\tisWarning = true\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\r\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\r\n\r\n\t\tif(isCritical) {\r\n\t\t\tthis.crit.push(series);\r\n\t\t\tseries.displayType = this.displayTypes[0]\r\n\t\t} else if(isWarning) {\r\n\t\t\tthis.warn.push(series);\r\n\t\t\tseries.displayType = this.displayTypes[0]\r\n\t\t} else if (series.display) {\r\n\t\t\tif(series.displayType == \"Annotation\") {\r\n\t\t\t\tthis.annotation.push(series);\r\n\t\t\t} else {\r\n\t\t\t\tthis.display.push(series);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tformatDisplayValue(value, target) {\r\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\r\n\t\tif (target.valueHandler === \"Number Threshold\") {\r\n\t\t\tif (_.isFinite(value)) {\r\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\r\n\t\t\t\tlet decimals = (Math.floor(value) === value) ? 0 : value.toString().split(\".\")[1].length;\r\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? target.decimals : decimals;\r\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\r\n\t\t\t} else {\r\n\t\t\t\tvalue = \"Invalid Number\";\r\n\t\t\t}\r\n\t\t} else if (target.valueHandler === \"String Threshold\") {\r\n\t\t\tif (value === undefined || value === null || value !== value)\r\n\t\t\t\tvalue = \"Invalid String\";\r\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\r\n\t\t\tif (_.isFinite(value)) {\r\n\t\t\t\tlet date = moment(new Date(value));\r\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\r\n\t\t\t\tvalue = date.format(target.dateFormat);\r\n\t\t\t} else {\r\n\t\t\t\tvalue = \"Invalid Date\";\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn value;\r\n\t}\r\n\r\n\thandleDisabledStatus(series, target) {\r\n\t\tseries.displayType = this.displayTypes[0];\r\n\t\tseries.disabledValue = target.disabledValue;\r\n\r\n\t\tif (series.display_value == series.disabledValue) {\r\n\t\t\tthis.disabled.push(series);\r\n\t\t}\r\n\t}\r\n\r\n\thandleTextOnly(series, target) {\r\n\t\tif(series.displayType == \"Annotation\") {\r\n\t\t\tthis.annotation.push(series);\r\n\t\t} else {\r\n\t\t\tthis.display.push(series);\r\n\t\t}\r\n\t}\r\n\r\n\thandleCssDisplay() {\r\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state default-background');\r\n\r\n\t\tif(this.duplicates) {\r\n\t\t\tthis.$panelContainer.addClass('error-state');\r\n\t\t} else if (this.disabled.length > 0) {\r\n\t\t\tthis.$panelContainer.addClass('disabled-state');\r\n\t\t} else if (this.crit.length > 0) {\r\n\t\t\tthis.$panelContainer.addClass('error-state');\r\n\t\t} else if (this.warn.length > 0) {\r\n\t\t\tthis.$panelContainer.addClass('warn-state');\r\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\r\n\t\t\tthis.$panelContainer.addClass('no-data-state');\r\n\t\t} else {\r\n\t\t\tthis.$panelContainer.addClass('ok-state');\r\n\t\t\tif (this.panel.useDefaultBackground)\r\n\t\t\t\tthis.$panelContainer.addClass('default-background');\r\n\t\t}\r\n\t}\r\n\r\n\thandleMaxAlertsToShow() {\r\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\r\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\r\n\t\t\tlet filteredOutAlerts = 0;\r\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\r\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\r\n\t\t\t\tlet originAlertCount = this[arrayName].length;\r\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\r\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\r\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\r\n\t\t\t});\r\n\r\n\t\t\tif(filteredOutAlerts > 0) {\r\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tparseUri() {\r\n\t\tif (this.panel.links && this.panel.links.length > 0) {\r\n\t\t\tlet link = this.panel.links[0];\r\n\r\n\t\t\tif (link.type == \"absolute\") {\r\n\t\t\t\tthis.uri = link.url;\r\n\t\t\t} else {\r\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\r\n\t\t\t}\r\n\r\n\t\t\tif (link.params) {\r\n\t\t\t\tthis.uri += \"?\" + link.params;\r\n\t\t\t}\r\n\r\n\t\t\tthis.targetBlank = link.targetBlank;\r\n\t\t} else {\r\n\t\t\tthis.uri = undefined;\r\n\t\t}\r\n\t}\r\n\r\n\tvalidateRegex(textRegex) {\r\n\t\tif(textRegex == null || textRegex.length == 0) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tlet regex = new RegExp(textRegex);\r\n\t\t\treturn true\r\n\t\t} catch(e) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t}\r\n\r\n\tstatic parseThresholds(metricOptions) {\r\n\t\tlet res = {};\r\n\r\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\r\n\t\t\tres.warn = parseFloat(metricOptions.warn);\r\n\t\t\tres.warnIsNumber = true;\r\n\t\t} else if (metricOptions.warn instanceof Date) {\r\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\r\n\t\t\tres.warn = metricOptions.warn.valueOf();\r\n\t\t\tres.warnIsNumber = true;\r\n\t\t} else {\r\n\t\t\tres.warn = metricOptions.warn;\r\n\t\t\tres.warnIsNumber = false;\r\n\t\t}\r\n\r\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\r\n\t\t\tres.crit = parseFloat(metricOptions.crit);\r\n\t\t\tres.critIsNumber = true;\r\n\t\t} else if (metricOptions.crit instanceof Date) {\r\n\t\t\tres.crit = metricOptions.crit.valueOf();\r\n\t\t\tres.critIsNumber = true;\r\n\t\t} else {\r\n\t\t\tres.crit = metricOptions.crit;\r\n\t\t\tres.critIsNumber = false;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\tstatic isFloat(val) {\r\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tonDataReceived(dataList) {\r\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\r\n\t\tthis.render();\r\n\t}\r\n\r\n\tonDataError() {\r\n\t\tthis.crit = [];\r\n\t\tthis.warn = [];\r\n\t}\r\n\r\n\tstatic seriesHandler(seriesData) {\r\n\t\tvar series = new TimeSeries({\r\n\t\t\tdatapoints: seriesData.datapoints,\r\n\t\t\talias: seriesData.target\r\n\t\t});\r\n\r\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\r\n\r\n\t\treturn series;\r\n\t}\r\n\r\n\t$onDestroy() {\r\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\r\n\t}\r\n\r\n\tautoFlip() {\r\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\r\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\r\n\t\t\tthis.timeoutId = setInterval(() => {\r\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\r\n\t\t\t}, this.panel.flipTime * 1000);\r\n\t\t}\r\n\t}\r\n\r\n\tlink(scope, elem, attrs, ctrl) {\r\n\t\tthis.$panelContainer = elem.find('.panel-container');\r\n\t\tthis.$panelContainer.addClass(\"st-card\");\r\n\t\tthis.$panelContoller = ctrl;\r\n\t}\r\n}\r\n\r\nStatusPluginCtrl.templateUrl = 'module.html';\r\n"]}
\ No newline at end of file
+{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","colorModes","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","targets","duplicates","measurement","hide","each","m","res","alias","target","addEditorTab","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","displayType","valueDisplayRegex","validateRegex","value","aggregation","max","datapoints","point","stats","min","total","avg","display_value","valueHandler","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","handleCssDisplay","parseUri","handleMaxAlertsToShow","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","push","disabledValue","panelState","undefined","okColor","maxAlertNumber","currentMaxAllowedAlerts","filteredOutAlerts","arrayNamesToSlice","forEach","originAlertCount","arrayName","Math","links","link","type","uri","dashUri","params","targetBlank","dataList","map","seriesHandler","render","timeoutId","clearInterval","setInterval","toggleClass","scope","elem","attrs","ctrl","metricOptions","isFloat","parseFloat","val","toString","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAASA,mB,kBAAAA,gB;;AAGFC,I;;AACAC,a;;AACAC,a;;;;;;;;;;;;;;;;;;;;;AAKDC,gB,GAAgB;AACrBC,cAAU,KADW;AAErBC,cAAU,CAFW;AAGrBC,eAAW,OAHU;AAIrB;AACAC,YAAQ;AACPC,WAAM,wBADC;AAEPC,WAAM,yBAFC;AAGPC,SAAI,wBAHG;AAIPC,cAAS;AAJF,KALa;AAWrBC,oBAAgB,K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AEAA,UAAI6D,YAAJ,GAAmBxG,iBAAiB2I,OAAjB,CAAyBD,cAAchJ,IAAvC,CAAnB;AACA,UAAGiD,IAAI6D,YAAP,EAAqB;AACpB7D,WAAIjD,IAAJ,GAAWkJ,WAAWF,cAAchJ,IAAzB,CAAX;AACA,OAFD,MAEO;AACNiD,WAAIjD,IAAJ,GAAWgJ,cAAchJ,IAAzB;AACA;;AAEDiD,UAAI8D,YAAJ,GAAmBzG,iBAAiB2I,OAAjB,CAAyBD,cAAcjJ,IAAvC,CAAnB;AACA,UAAGkD,IAAI8D,YAAP,EAAqB;AACpB9D,WAAIlD,IAAJ,GAAWmJ,WAAWF,cAAcjJ,IAAzB,CAAX;AACA,OAFD,MAEO;AACNkD,WAAIlD,IAAJ,GAAWiJ,cAAcjJ,IAAzB;AACA;;AAED,aAAOkD,GAAP;AACA;;;6BAEckG,G,EAAK;AACnB,UAAI,CAACrF,MAAMqF,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,UAAIxE,SAAS,IAAIvF,UAAJ,CAAe;AAC3BgG,mBAAY+D,WAAW/D,UADI;AAE3BtC,cAAOqG,WAAWpG;AAFS,OAAf,CAAb;;AAKA4B,aAAOyE,SAAP,GAAmBzE,OAAO0E,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO1E,MAAP;AACA;;;;KAtaoCzF,gB;;;;AA4btCgB,oBAAiBoJ,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\r\nimport \"app/plugins/panel/graph/legend\";\r\nimport \"app/plugins/panel/graph/series_overrides_ctrl\";\r\nimport _ from \"lodash\";\r\nimport TimeSeries from \"app/core/time_series2\";\r\nimport coreModule from \"app/core/core_module\"\r\n\r\nimport './css/status_panel.css!';\r\n\r\n// Set and populate panel defaults\r\nconst panelDefaults = {\n\tflipCard: false,\r\n\tflipTime: 5,\r\n\tcolorMode: 'Panel',\r\n\t// Changed colors to match Table Panel so colorised text is easier to read\r\n\tcolors: {\r\n\t\tcrit: 'rgba(245, 54, 54, 0.9)',\r\n\t\twarn: 'rgba(237, 129, 40, 0.9)',\r\n\t\tok: 'rgba(50, 128, 45, 0.9)',\r\n\t\tdisable: 'rgba(128, 128, 128, 0.9)'\r\n\t},\r\n\tisGrayOnNoData: false,\r\n\tisIgnoreOKColors: false,\n\tisHideAlertsOnDisable: false\r\n};\r\n\r\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\r\n\t/** @ngInject */\r\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\r\n\t\tsuper($scope, $injector);\r\n\t\t_.defaultsDeep(this.panel, panelDefaults);\r\n\r\n\t\t//this.log = $log.debug;\r\n\t\tthis.filter = $filter;\r\n\r\n\t\tthis.valueHandlers = ['Threshold', 'Disable Criteria', 'Text Only'];\r\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];\r\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\r\n\t\tthis.colorModes = ['Panel', 'Metric', 'Disabled'];\r\n\r\n\t\t/** Bind events to functions **/\r\n\t\tthis.events.on('render', this.onRender.bind(this));\r\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\r\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\r\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\r\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\r\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\r\n\r\n\t\tthis.addFilters()\r\n\t}\r\n\r\n\taddFilters() {\r\n\t\tcoreModule.filter('numberOrText', () => {\r\n\t\t\tlet numberOrTextFilter = (input) => {\r\n\t\t\t\tif(angular.isNumber(input)) {\r\n\t\t\t\t\treturn this.filter('number')(input);\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn input;\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tnumberOrTextFilter.$stateful = true;\r\n\t\t\treturn numberOrTextFilter;\r\n\t\t});\r\n\r\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\r\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\r\n\t\t\t\tif(angular.isNumber(input)) {\r\n\t\t\t\t\treturn this.filter('number')(input);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\r\n\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tlet regex;\r\n\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\r\n\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tlet matchResults = input.match(regex);\r\n\t\t\t\t\t\tif (matchResults == null) {\r\n\t\t\t\t\t\t\treturn input;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\treturn matchResults[0];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tnumberOrTextFilter.$stateful = true;\r\n\t\t\treturn numberOrTextFilter;\r\n\t\t});\r\n\t}\r\n\r\n\tpostRefresh() {\r\n\t\tif (this.panel.fixedSpan) {\r\n\t\t\tthis.panel.span = this.panel.fixedSpan;\r\n\t\t}\r\n\r\n\t\tthis.measurements = this.panel.targets;\r\n\r\n\t\t/** Duplicate alias validation **/\r\n\t\tthis.duplicates = false;\r\n\r\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\r\n\t\t\treturn !measurement.hide;\r\n\t\t});\r\n\r\n\t\t_.each(this.measurements, (m) => {\r\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\r\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\r\n\t\t\t});\r\n\r\n\t\t\tif (res.length > 1) {\r\n\t\t\t\tthis.duplicates = true;\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tonInitEditMode() {\r\n\t\tthis.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\r\n\t}\r\n\r\n\tsetElementHeight() {\r\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\r\n\t\tthis.minHeight = this.$panelContoller.height-10;\r\n\t}\r\n\r\n\tsetTextMaxWidth() {\r\n\t\tlet tail = ' …';\r\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\r\n\t\tif (isNaN(panelWidth))\r\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\r\n\t\tpanelWidth = panelWidth - 20;\r\n\t\tthis.maxWidth = panelWidth;\r\n\t}\r\n\r\n\tonRender() {\r\n\t\tthis.setElementHeight();\r\n\t\tthis.setTextMaxWidth();\r\n\t\tthis.upgradeOldVersion();\r\n\r\n\t\tif (this.panel.clusterName) {\r\n\t\t\tthis.panel.displayName =\r\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\r\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\r\n\t\t} else {\r\n\t\t\tthis.panel.displayName = \"\";\r\n\t\t}\r\n\r\n\t\tif(this.panel.flipCard){\r\n\t\t this.$panelContainer.addClass(\"effect-hover\");\r\n\t\t} else {\r\n\t\t this.$panelContainer.removeClass(\"effect-hover\");\r\n\t\t}\r\n\r\n\t\tlet targets = this.panel.targets;\r\n\r\n\t\tthis.crit = [];\r\n\t\tthis.warn = [];\r\n\t\tthis.disabled = [];\r\n\t\tthis.display = [];\r\n\t\tthis.annotation = [];\r\n\t\tthis.extraMoreAlerts = null;\r\n\r\n\t\t_.each(this.series, (s) => {\r\n\t\t\tlet target = _.find(targets, (target) => {\r\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\r\n\t\t\t});\r\n\r\n\t\t\tif (!target) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\ts.alias = target.alias;\r\n\t\t\ts.url = target.url;\r\n\t\t\ts.display = true;\r\n\t\t\ts.displayType = target.displayType;\r\n\t\t\ts.valueDisplayRegex = \"\";\r\n\r\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\r\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\r\n\t\t\t}\r\n\r\n\t\t\tlet value;\r\n\t\t\tswitch (target.aggregation) {\r\n\t\t\t\tcase 'Max':\r\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\r\n\t\t\t\t\tvalue = s.stats.max;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Min':\r\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\r\n\t\t\t\t\tvalue = s.stats.min;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Sum':\r\n\t\t\t\t\tvalue = 0;\r\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\r\n\t\t\t\t\tvalue = s.stats.total;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'Avg':\r\n\t\t\t\t\tvalue = s.stats.avg;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'First':\r\n\t\t\t\t\tvalue = s.datapoints[0][0];\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\r\n\t\t\t}\r\n\r\n\t\t\ts.display_value = value;\r\n\r\n\t\t\tif (target.valueHandler == \"Threshold\") {\r\n\t\t\t\tthis.handleThresholdStatus(s, target);\r\n\t\t\t}\r\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\r\n\t\t\t\tthis.handleDisabledStatus(s,target);\r\n\t\t\t}\r\n\t\t\telse if (target.valueHandler == \"Text Only\") {\r\n\t\t\t\tthis.handleTextOnly(s, target);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\r\n\t\t\tthis.crit = [];\r\n\t\t\tthis.warn = [];\r\n\t\t\tthis.display = [];\r\n\t\t}\r\n\r\n\t\tthis.autoFlip();\r\n\t\tthis.updatePanelState();\r\n\t\tthis.handleCssDisplay();\r\n\t\tthis.parseUri();\r\n\r\n\t\t//This must appear after handling the css style of the panel\r\n\t\tthis.handleMaxAlertsToShow();\r\n\t}\r\n\r\n\tupgradeOldVersion() {\r\n\t\tlet targets = this.panel.targets;\r\n\r\n\t\t//Handle legacy code\r\n\t\t_.each(targets, (target) => {\r\n\t\t\tif(target.valueHandler == null) {\r\n\t\t\t\ttarget.valueHandler = target.displayType;\r\n\t\t\t\tif(target.valueHandler == \"Annotation\") {\r\n\t\t\t\t\ttarget.valueHandler = \"Text Only\"\r\n\t\t\t\t}\r\n\t\t\t\ttarget.displayType = this.displayTypes[0];\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\thandleThresholdStatus(series, target) {\r\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\r\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\r\n\t\tseries.display = target.display;\r\n\r\n\t\tlet isCritical = false;\r\n\t\tlet isWarning = false;\r\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\r\n\t\tif (isCheckRanges) {\r\n\t\t\tif (!series.inverted) {\r\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\r\n\t\t\t\t\tisCritical = true\r\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\r\n\t\t\t\t\tisWarning = true\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\r\n\t\t\t\t\tisCritical = true\r\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\r\n\t\t\t\t\tisWarning = true\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (series.display_value == series.thresholds.crit) {\r\n\t\t\t\tisCritical = true\r\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\r\n\t\t\t\tisWarning = true\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(isCritical) {\r\n\t\t\tthis.crit.push(series);\r\n\t\t\tseries.displayType = this.displayTypes[0]\r\n\t\t} else if(isWarning) {\r\n\t\t\tthis.warn.push(series);\r\n\t\t\tseries.displayType = this.displayTypes[0]\r\n\t\t} else if (series.display) {\r\n\t\t\tif(series.displayType == \"Annotation\") {\r\n\t\t\t\tthis.annotation.push(series);\r\n\t\t\t} else {\r\n\t\t\t\tthis.display.push(series);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\thandleDisabledStatus(series, target) {\r\n\t\tseries.displayType = this.displayTypes[0];\r\n\t\tseries.disabledValue = target.disabledValue;\r\n\r\n\t\tif (series.display_value == series.disabledValue) {\r\n\t\t\tthis.disabled.push(series);\r\n\t\t}\r\n\t}\r\n\r\n\thandleTextOnly(series, target) {\r\n\t\tif(series.displayType == \"Annotation\") {\r\n\t\t\tthis.annotation.push(series);\r\n\t\t} else {\r\n\t\t\tthis.display.push(series);\r\n\t\t}\r\n\t}\r\n\r\n\tupdatePanelState() {\r\n\r\n\t\tif(this.duplicates) {\r\n\t\t\tthis.panelState = 'error-state';\r\n\t\t} else if (this.disabled.length > 0) {\r\n\t\t\tthis.panelState = 'disabled-state';\r\n\t\t} else if (this.crit.length > 0) {\r\n\t\t\tthis.panelState = 'error-state';\r\n\t\t} else if (this.warn.length > 0) {\r\n\t\t\tthis.panelState = 'warn-state';\r\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\r\n\t\t\tthis.panelState = 'no-data-state';\r\n\t\t} else {\r\n\t\t\tthis.panelState = 'ok-state';\r\n\t\t}\r\n\t}\r\n\r\n\thandleCssDisplay() {\r\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\r\n\t\tthis.$panelContainer.addClass(this.panelState);\r\n\r\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\r\n\r\n\t\tif (this.panel.colorMode === \"Panel\") {\r\n\t\t\tswitch(this.panelState) {\r\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\r\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\r\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\r\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\r\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.$panelContainer.css('background-color', '');\r\n\t\t}\r\n\t}\r\n\r\n\thandleMaxAlertsToShow() {\r\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\r\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\r\n\t\t\tlet filteredOutAlerts = 0;\r\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\r\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\r\n\t\t\t\tlet originAlertCount = this[arrayName].length;\r\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\r\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\r\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\r\n\t\t\t});\r\n\r\n\t\t\tif(filteredOutAlerts > 0) {\r\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tparseUri() {\r\n\t\tif (this.panel.links && this.panel.links.length > 0) {\r\n\t\t\tlet link = this.panel.links[0];\r\n\r\n\t\t\tif (link.type == \"absolute\") {\r\n\t\t\t\tthis.uri = link.url;\r\n\t\t\t} else {\r\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\r\n\t\t\t}\r\n\r\n\t\t\tif (link.params) {\r\n\t\t\t\tthis.uri += \"?\" + link.params;\r\n\t\t\t}\r\n\r\n\t\t\tthis.targetBlank = link.targetBlank;\r\n\t\t} else {\r\n\t\t\tthis.uri = undefined;\r\n\t\t}\r\n\t}\r\n\r\n\tvalidateRegex(textRegex) {\r\n\t\tif(textRegex == null || textRegex.length == 0) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tlet regex = new RegExp(textRegex);\r\n\t\t\treturn true\r\n\t\t} catch(e) {\r\n\t\t\treturn false\r\n\t\t}\r\n\t}\r\n\r\n\tstatic parseThresholds(metricOptions) {\r\n\t\tlet res = {};\r\n\r\n\t\tres.warnIsNumber = StatusPluginCtrl.isFloat(metricOptions.warn)\r\n\t\tif(res.warnIsNumber) {\r\n\t\t\tres.warn = parseFloat(metricOptions.warn);\r\n\t\t} else {\r\n\t\t\tres.warn = metricOptions.warn;\r\n\t\t}\r\n\r\n\t\tres.critIsNumber = StatusPluginCtrl.isFloat(metricOptions.crit);\r\n\t\tif(res.critIsNumber) {\r\n\t\t\tres.crit = parseFloat(metricOptions.crit);\r\n\t\t} else {\r\n\t\t\tres.crit = metricOptions.crit;\r\n\t\t}\r\n\r\n\t\treturn res;\r\n\t}\r\n\r\n\tstatic isFloat(val) {\r\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tonDataReceived(dataList) {\r\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\r\n\t\tthis.render();\r\n\t}\r\n\r\n\tonDataError() {\r\n\t\tthis.crit = [];\r\n\t\tthis.warn = [];\r\n\t}\r\n\r\n\tstatic seriesHandler(seriesData) {\r\n\t\tvar series = new TimeSeries({\r\n\t\t\tdatapoints: seriesData.datapoints,\r\n\t\t\talias: seriesData.target\r\n\t\t});\r\n\r\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\r\n\r\n\t\treturn series;\r\n\t}\r\n\r\n\t$onDestroy() {\r\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\r\n\t}\r\n\r\n\tautoFlip() {\r\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\r\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\r\n\t\t\tthis.timeoutId = setInterval(() => {\r\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\r\n\t\t\t}, this.panel.flipTime * 1000);\r\n\t\t}\r\n\t}\r\n\r\n\tlink(scope, elem, attrs, ctrl) {\r\n\t\tthis.$panelContainer = elem.find('.panel-container');\r\n\t\tthis.$panelContainer.addClass(\"st-card\");\r\n\t\tthis.$panelContoller = ctrl;\r\n\t}\r\n}\r\n\r\nStatusPluginCtrl.templateUrl = 'module.html';\r\n"]}
\ No newline at end of file
diff --git a/src/css/status_panel.scss b/src/css/status_panel.scss
index af746a95..24775b69 100644
--- a/src/css/status_panel.scss
+++ b/src/css/status_panel.scss
@@ -82,34 +82,25 @@
}
}
-.ok-state:not(.default-background) {
- background-color: green;
-}
-
.warn-state {
- background-color: orange;
.warning-text {
display: block;
}
}
.error-state {
- background-color: red;
.fail-text {
display: block;
}
}
.no-data-state {
- background-color: gray;
-
.no-data-text {
display: block;
}
}
.disabled-state {
- background-color: gray;
.disabled-text {
display: block;
}
diff --git a/src/editor.html b/src/editor.html
index 0aad2e28..cdb3dff1 100644
--- a/src/editor.html
+++ b/src/editor.html
@@ -1,5 +1,5 @@
- Note: Every metric has to have a unique Alias to be used
+ Note: Every metric has to have a unique Alias to be used
@@ -9,55 +9,95 @@
+
+
+
+
+
+
+
Other Options
-
-
-
-
diff --git a/src/module.html b/src/module.html
index 12dcfbad..64d73e95 100644
--- a/src/module.html
+++ b/src/module.html
@@ -1,22 +1,22 @@
-
+
Error: There are multiple measurements with the same alias. Please give each measurement a unique name.
-
OK
-
Warning
-
Critical
-
No data
-
Disabled
+
OK
+
Warning
+
Critical
+
No data
+
Disabled
-
+
-
-
{{ display.alias }}
+
+
{{ display.alias }}
{{ display.alias }}
- {{ display.display_value | numberOrTextWithRegex : display.valueDisplayRegex }}
-
-
{{ crit.alias }}
+
+
{{ crit.alias }}
{{ crit.alias }}
- {{ crit.display_value | numberOrTextWithRegex : crit.valueDisplayRegex }}
-
-
{{ warn.alias }}
+
+
{{ warn.alias }}
{{ warn.alias }}
- {{ warn.display_value | numberOrTextWithRegex : warn.valueDisplayRegex }}
-
-
{{ disabled.alias }}
+
diff --git a/src/status_ctrl.js b/src/status_ctrl.js
index fa877e66..12d0ccf3 100644
--- a/src/status_ctrl.js
+++ b/src/status_ctrl.js
@@ -9,10 +9,28 @@ import moment from "moment";
import './css/status_panel.css!';
+// Set and populate panel defaults
+const panelDefaults = {
+ flipCard: false,
+ flipTime: 5,
+ colorMode: 'Panel',
+ // Changed colors to match Table Panel so colorised text is easier to read
+ colors: {
+ crit: 'rgba(245, 54, 54, 0.9)',
+ warn: 'rgba(237, 129, 40, 0.9)',
+ ok: 'rgba(50, 128, 45, 0.9)',
+ disable: 'rgba(128, 128, 128, 0.9)'
+ },
+ isGrayOnNoData: false,
+ isIgnoreOKColors: false,
+ isHideAlertsOnDisable: false
+};
+
export class StatusPluginCtrl extends MetricsPanelCtrl {
/** @ngInject */
constructor($scope, $injector, $log, $filter, annotationsSrv) {
super($scope, $injector);
+ _.defaultsDeep(this.panel, panelDefaults);
//this.log = $log.debug;
this.filter = $filter;
@@ -20,6 +38,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {
this.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];
this.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];
this.displayTypes = ['Regular', 'Annotation'];
+ this.colorModes = ['Panel', 'Metric', 'Disabled'];
// Dates get stored as strings and will need to be converted back to a Date objects
_.each(this.panel.targets, (t) => {
@@ -251,6 +270,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {
}
this.autoFlip();
+ this.updatePanelState();
this.handleCssDisplay();
this.parseUri();
@@ -381,23 +401,39 @@ export class StatusPluginCtrl extends MetricsPanelCtrl {
}
}
- handleCssDisplay() {
- this.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state default-background');
+ updatePanelState() {
if(this.duplicates) {
- this.$panelContainer.addClass('error-state');
+ this.panelState = 'error-state';
} else if (this.disabled.length > 0) {
- this.$panelContainer.addClass('disabled-state');
+ this.panelState = 'disabled-state';
} else if (this.crit.length > 0) {
- this.$panelContainer.addClass('error-state');
+ this.panelState = 'error-state';
} else if (this.warn.length > 0) {
- this.$panelContainer.addClass('warn-state');
+ this.panelState = 'warn-state';
} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {
- this.$panelContainer.addClass('no-data-state');
+ this.panelState = 'no-data-state';
+ } else {
+ this.panelState = 'ok-state';
+ }
+ }
+
+ handleCssDisplay() {
+ this.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');
+ this.$panelContainer.addClass(this.panelState);
+
+ let okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;
+
+ if (this.panel.colorMode === "Panel") {
+ switch(this.panelState) {
+ case 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;
+ case 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;
+ case 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;
+ case 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;
+ default: this.$panelContainer.css('background-color', okColor); break;
+ }
} else {
- this.$panelContainer.addClass('ok-state');
- if (this.panel.useDefaultBackground)
- this.$panelContainer.addClass('default-background');
+ this.$panelContainer.css('background-color', '');
}
}