From afc255d4547ba2b56a61e7bbbdb5069424ed4056 Mon Sep 17 00:00:00 2001 From: Peter Basham Date: Fri, 1 Sep 2017 18:40:11 +0100 Subject: [PATCH] Fix legacy defect when upgrading from old version --- dist/module.js.map | 2 +- dist/status_ctrl.js | 2 +- dist/status_ctrl.js.map | 2 +- src/status_ctrl.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/module.js.map b/dist/module.js.map index 962a6d1c..b8a3058f 100644 --- a/dist/module.js.map +++ b/dist/module.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/module.js"],"names":["StatusPluginCtrl"],"mappings":";;;;;;;;AAAQA,sB,gBAAAA,gB;;;2BAGNA,gB","file":"module.js","sourcesContent":["import {StatusPluginCtrl} from './status_ctrl';\n\nexport {\n StatusPluginCtrl as PanelCtrl\n};\n"]} \ No newline at end of file +{"version":3,"sources":["../src/module.js"],"names":["StatusPluginCtrl"],"mappings":";;;;;;;;AAAQA,sB,gBAAAA,gB;;;2BAGNA,gB","file":"module.js","sourcesContent":["import {StatusPluginCtrl} from './status_ctrl';\r\n\r\nexport {\r\n StatusPluginCtrl as PanelCtrl\r\n};\r\n"]} \ No newline at end of file diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js index 327e86b0..ec173535 100644 --- a/dist/status_ctrl.js +++ b/dist/status_ctrl.js @@ -381,7 +381,7 @@ System.register(["app/plugins/sdk", "lodash", "app/core/time_series2", "app/core //Handle legacy code _.each(targets, function (target) { - if (target.valueHandler == null) { + if (target.valueHandler == null && target.displayType != null) { target.valueHandler = target.displayType; if (target.valueHandler == "Annotation") { target.valueHandler = "Text Only"; diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map index 6d3bba8c..21445739 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","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","colorModes","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","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","Number","undefined","String","c","w","getTime","item","color","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","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","panelState","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","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AACDC,I;;AACAC,a;;AACAC,a;;AACAC,M;;AACAC,S;;;;;;;;;;;;;;;;;;;;;A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K,IAAzB;AACAqD,WAAI2E,YAAJ,GAAmB,KAAnB;AACA;;AAED,UAAI1H,iBAAiBmH,OAAjB,CAAyBoD,cAAc9K,IAAvC,CAAJ,EAAkD;AACjDsD,WAAItD,IAAJ,GAAW+K,WAAWD,cAAc9K,IAAzB,CAAX;AACAsD,WAAI4E,YAAJ,GAAmB,IAAnB;AACA,OAHD,MAGO,IAAI4C,cAAc9K,IAAd,YAA8BwB,IAAlC,EAAwC;AAC9C8B,WAAItD,IAAJ,GAAW8K,cAAc9K,IAAd,CAAmBgL,OAAnB,EAAX;AACA1H,WAAI4E,YAAJ,GAAmB,IAAnB;AACA,OAHM,MAGA;AACN5E,WAAItD,IAAJ,GAAW8K,cAAc9K,IAAzB;AACAsD,WAAI4E,YAAJ,GAAmB,KAAnB;AACA;;AAED,aAAO5E,GAAP;AACA;;;6BAEc2H,G,EAAK;AACnB,UAAI,CAACxG,MAAMwG,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,UAAIlF,SAAS,IAAI3G,UAAJ,CAAe;AAC3BmH,mBAAY0E,WAAW1E,UADI;AAE3BnD,cAAO6H,WAAW5H;AAFS,OAAf,CAAb;;AAKA0C,aAAOmF,SAAP,GAAmBnF,OAAOoF,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAOpF,MAAP;AACA;;;;KAhhBoC7G,gB;;;;AAsiBtCkB,oBAAiBgL,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};\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.colorModes = ['Panel', 'Metric', 'Disabled'];\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\tsetElementHeight() {\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.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.display = 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\ttarget.valueHandler = target.displayType;\n\t\t\t\tif(target.valueHandler == \"Annotation\") {\n\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\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\t\tseries.display = target.display;\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\tif(isCritical) {\n\t\t\tthis.crit.push(series);\n\t\t\tseries.displayType = this.displayTypes[0]\n\t\t} else if(isWarning) {\n\t\t\tthis.warn.push(series);\n\t\t\tseries.displayType = this.displayTypes[0]\n\t\t} else if (series.display) {\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 = (Math.floor(value) === value) ? 0 : value.toString().split(\".\")[1].length;\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? target.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\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 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","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","colorModes","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","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","Number","undefined","String","c","w","getTime","item","color","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","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","panelState","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","metricO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A/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};\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.colorModes = ['Panel', 'Metric', 'Disabled'];\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\tsetElementHeight() {\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.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.display = 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\ttarget.valueHandler = target.displayType;\n\t\t\t\tif(target.valueHandler == \"Annotation\") {\n\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\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\t\tseries.display = target.display;\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\tif(isCritical) {\n\t\t\tthis.crit.push(series);\n\t\t\tseries.displayType = this.displayTypes[0]\n\t\t} else if(isWarning) {\n\t\t\tthis.warn.push(series);\n\t\t\tseries.displayType = this.displayTypes[0]\n\t\t} else if (series.display) {\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 = (Math.floor(value) === value) ? 0 : value.toString().split(\".\")[1].length;\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? target.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\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 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"]} diff --git a/src/status_ctrl.js b/src/status_ctrl.js index dc11a172..78e48813 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -294,7 +294,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { //Handle legacy code _.each(targets, (target) => { - if(target.valueHandler == null) { + if(target.valueHandler == null && target.displayType != null) { target.valueHandler = target.displayType; if(target.valueHandler == "Annotation") { target.valueHandler = "Text Only"