From 649e890096c55570f651f58701d07637db3c0a12 Mon Sep 17 00:00:00 2001 From: Daniel Gesicki Date: Thu, 5 Apr 2018 11:32:17 +0200 Subject: [PATCH 1/2] Allowing to change the font size --- dist/editor.html | 11 ++++++++++- dist/module.html | 2 +- dist/status_ctrl.js | 3 ++- dist/status_ctrl.js.map | 2 +- src/editor.html | 9 +++++++++ src/module.html | 2 +- src/status_ctrl.js | 3 ++- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dist/editor.html b/dist/editor.html index 899c76d0..0c65b525 100644 --- a/dist/editor.html +++ b/dist/editor.html @@ -43,6 +43,15 @@
Panel Options
+
+ + Text Size + + The metric text font size expressed in rem + + + +
@@ -199,7 +208,7 @@
Display Settings
- +
Metric display type
diff --git a/dist/module.html b/dist/module.html index b882d6fa..638db94c 100644 --- a/dist/module.html +++ b/dist/module.html @@ -36,7 +36,7 @@

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

-
+
{{ display.alias }} diff --git a/src/status_ctrl.js b/src/status_ctrl.js index a60a675c..88028647 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -23,7 +23,8 @@ const panelDefaults = { isIgnoreOKColors: false, isHideAlertsOnDisable: false, cornerRadius: 0, - isAutoScrollOnOverflow: false + isAutoScrollOnOverflow: false, + fontSize: 3 }; export class StatusPluginCtrl extends MetricsPanelCtrl { From 7c926b8eaad1e35f378eb794c77a9cb9fd6b06a8 Mon Sep 17 00:00:00 2001 From: Daniel Gesicki Date: Tue, 10 Apr 2018 10:30:43 +0200 Subject: [PATCH 2/2] Adding the ability to edit the font size of the title --- dist/editor.html | 13 +++++++++++-- dist/module.html | 2 +- dist/status_ctrl.js | 3 ++- dist/status_ctrl.js.map | 2 +- src/editor.html | 13 +++++++++++-- src/module.html | 2 +- src/status_ctrl.js | 3 ++- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/dist/editor.html b/dist/editor.html index 0c65b525..da744386 100644 --- a/dist/editor.html +++ b/dist/editor.html @@ -14,6 +14,15 @@
Panel Options
Panel Title
+
+ + Title Font Size + + The title font font size expressed in rem + + + +
Remove Prefix @@ -45,9 +54,9 @@
Panel Options
- Text Size + Metric font Size - The metric text font size expressed in rem + The metric font font size expressed in rem diff --git a/dist/module.html b/dist/module.html index 638db94c..ac5cc900 100644 --- a/dist/module.html +++ b/dist/module.html @@ -26,7 +26,7 @@
-

+

{{ ctrl.panel.displayName | interpolateTemplateVars:this }} diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js index c8d73cb3..92c70da8 100644 --- a/dist/status_ctrl.js +++ b/dist/status_ctrl.js @@ -84,7 +84,8 @@ System.register(["app/plugins/sdk", "lodash", "app/core/time_series2", "app/core isHideAlertsOnDisable: false, cornerRadius: 0, isAutoScrollOnOverflow: false, - fontSize: 3 + titleFontSize: 1, + fontSize: 1 }; _export("StatusPluginCtrl", StatusPluginCtrl = function (_MetricsPanelCtrl) { diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map index 24ad1738..15f31ba9 100644 --- a/dist/status_ctrl.js.map +++ b/dist/status_ctrl.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","kbn","moment","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","cornerRadius","isAutoScrollOnOverflow","fontSize","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","displayAliasTypes","displayValueTypes","colorModes","fontFormats","each","targets","t","valueHandler","Date","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","onColorChange","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","duplicates","measurement","hide","m","res","alias","target","addEditorTab","unitFormats","getUnitFormats","subItem","units","value","render","panelHeaderHeight","title","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","element","overflowY","offsetHeight","scrollHeight","Number","undefined","String","c","w","getTime","item","color","fixPanelHeader","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","handleCssDisplay","parseUri","handleMaxAlertsToShow","displayAliasType","displayValueWithAlias","isFloat","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","formatDisplayValue","displayValueWhenAliasDisplayed","displayValueFromWarning","displayValueFromCritical","push","isFinite","decimals","decimalPlaces","Math","valueFormats","date","dashboard","isTimezoneUtc","utc","format","dateFormat","num","disabledValue","panelState","radius","okColor","maxAlertNumber","currentMaxAllowedAlerts","filteredOutAlerts","arrayNamesToSlice","forEach","originAlertCount","arrayName","links","link","type","uri","dashUri","params","targetBlank","dataList","map","seriesHandler","timeoutId","clearInterval","setInterval","toggleClass","scope","elem","attrs","ctrl","metricOptions","parseFloat","valueOf","val","toString","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AACDC,I;;AACAC,a;;AACAC,a;;AACAC,M;;AACAC,S;;;;;;;;;;;;;;;;;;;;;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,KAXK;AAYrBC,sBAAkB,KAZG;AAarBC,2BAAuB,KAbF;AAcrBC,kBAAc,CAdO;AAerBC,4BAAwB,KAfH;AAgBrBC,cAAU;AAhBW,I;;+BAmBTC,gB;;;AACZ;AACA,8BAAYC,MAAZ,EAAoBC,SAApB,EAA+BC,IAA/B,EAAqCC,OAArC,EAA8CC,cAA9C,EAA8D;AAAA;;AAAA,qIACvDJ,MADuD,EAC/CC,SAD+C;;AAE7DtB,OAAE0B,YAAF,CAAe,MAAKC,KAApB,EAA2BtB,aAA3B;;AAEA;AACA,WAAKuB,MAAL,GAAcJ,OAAd;;AAEA,WAAKK,aAAL,GAAqB,CAAC,kBAAD,EAAqB,kBAArB,EAAyC,gBAAzC,EAA2D,kBAA3D,EAA+E,WAA/E,CAArB;AACA,WAAKC,YAAL,GAAoB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,KAAzB,EAAgC,KAAhC,E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tCqB,oBAAiBiM,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\";\nimport kbn from \"app/core/utils/kbn\";\nimport moment from \"moment\";\n\nimport './css/status_panel.css!';\n\n// Set and populate panel defaults\nconst panelDefaults = {\n\tflipCard: false,\n\tflipTime: 5,\n\tcolorMode: 'Panel',\n\t// Changed colors to match Table Panel so colorised text is easier to read\n\tcolors: {\n\t\tcrit: 'rgba(245, 54, 54, 0.9)',\n\t\twarn: 'rgba(237, 129, 40, 0.9)',\n\t\tok: 'rgba(50, 128, 45, 0.9)',\n\t\tdisable: 'rgba(128, 128, 128, 0.9)'\n\t},\n\tisGrayOnNoData: false,\n\tisIgnoreOKColors: false,\n\tisHideAlertsOnDisable: false,\n\tcornerRadius: 0,\n\tisAutoScrollOnOverflow: false,\n\tfontSize: 3\n};\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\t\t_.defaultsDeep(this.panel, panelDefaults);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg', 'Delta'];\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\n\t\tthis.displayAliasTypes = ['Warning / Critical', 'Always'];\n\t\tthis.displayValueTypes = ['Never', 'When Alias Displayed', 'Warning / Critical', 'Critical Only'];\n\t\tthis.colorModes = ['Panel', 'Metric', 'Disabled'];\n\t\tthis.fontFormats = ['Regular', 'Bold', 'Italic'];\n\n\t\t// Dates get stored as strings and will need to be converted back to a Date objects\n\t\t_.each(this.panel.targets, (t) => {\n\t\t\tif (t.valueHandler === \"Date Threshold\") {\n\t\t\t\tif (typeof t.crit != \"undefined\") t.crit = new Date(t.crit);\n\t\t\t\tif (typeof t.warn != \"undefined\") t.warn = new Date(t.warn);\n\t\t\t}\n\t\t});\n\n\t\tthis.panel.flipTime = this.panel.flipTime || 5;\n\n\t\t/** Bind events to functions **/\n\t\tthis.events.on('render', this.onRender.bind(this));\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n\n\t\tthis.onColorChange = this.onColorChange.bind(this);\n\n\t\tthis.addFilters()\n\t}\n\n\taddFilters() {\n\t\tcoreModule.filter('numberOrText', () => {\n\t\t\tlet numberOrTextFilter = (input) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\treturn input;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet regex;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!input) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet matchResults = input.match(regex);\n\t\t\t\t\t\tif (matchResults == null) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn matchResults[0];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\t}\n\n\tpostRefresh() {\n\t\tif (this.panel.fixedSpan) {\n\t\t\tthis.panel.span = this.panel.fixedSpan;\n\t\t}\n\n\t\tthis.measurements = this.panel.targets;\n\n\t\t/** Duplicate alias validation **/\n\t\tthis.duplicates = false;\n\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\n\t\t\treturn !measurement.hide;\n\t\t});\n\n\t\t_.each(this.measurements, (m) => {\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\n\t\t\t});\n\n\t\t\tif (res.length > 1) {\n\t\t\t\tthis.duplicates = true;\n\t\t\t}\n\t\t});\n\t}\n\n\tonInitEditMode() {\n\t\tthis.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\n\t\t// Load in the supported units-of-measure formats so they can be displayed in the editor\n\t\tthis.unitFormats = kbn.getUnitFormats();\n\t}\n\n\tsetUnitFormat(measurement, subItem) {\n\t\tmeasurement.units = subItem.value;\n\t\tthis.render();\n\t}\n\n\tfixPanelHeader() {\n\t\t// Handle the panel top menu height, since it's display doesn't look good with the panel\n\t\tlet panelHeaderHeight = '';\n\t\tif(this.panel.title.length === 0) {\n\t\t\tpanelHeaderHeight = '10px';\n\t\t}\n\t\tthis.$panelContainer.find('.panel-header').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.panel-menu-container').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.fa-caret-down').css('display', 'none');\n\t}\n\n\tsetElementHeight() {\n\t\t// Handle the panel height\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\n\t\tthis.minHeight = this.$panelContoller.height-10;\n\t}\n\n\tsetTextMaxWidth() {\n\t\tlet tail = ' …';\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\n\t\tif (isNaN(panelWidth))\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\n\t\tpanelWidth = panelWidth - 20;\n\t\tthis.maxWidth = panelWidth;\n\t}\n\n\tisAutoScrollAlerts() {\n\t\tif(!this.panel.isAutoScrollOnOverflow) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet element = this.$panelContainer.find('.status-panel')[0];\n\t\tlet overflowY = element.offsetHeight < element.scrollHeight;\n\t\treturn overflowY;\n\t}\n\n\tonHandlerChange(measurement) {\n\t\t// If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent\n\t\tif (measurement.valueHandler === \"Number Threshold\") {\n\t\t\tmeasurement.crit = (isNaN(Number(measurement.crit))) ? undefined : Number(measurement.crit);\n\t\t\tmeasurement.warn = (isNaN(Number(measurement.warn))) ? undefined : Number(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"String Threshold\") {\n\t\t\tif (typeof measurement.crit != \"undefined\") measurement.crit = String(measurement.crit);\n\t\t\tif (typeof measurement.warn != \"undefined\") measurement.warn = String(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"Date Threshold\") {\n\t\t\tlet c = new Date(measurement.crit), w = new Date(measurement.warn);\n\t\t\tmeasurement.crit = (isNaN(c.getTime())) ? undefined : c;\n\t\t\tmeasurement.warn = (isNaN(w.getTime())) ? undefined : w;\n\t\t}\n\t\tthis.onRender();\n\t}\n\n\tonColorChange(item) {\n\t\treturn (color) => {\n\t\t\tthis.panel.colors[item] = color;\n\t\t\tthis.render();\n\t\t};\n\t}\n\n\tonRender() {\n\t\tthis.fixPanelHeader();\n\t\tthis.setElementHeight();\n\t\tthis.setTextMaxWidth();\n\t\tthis.upgradeOldVersion();\n\n\t\tif (this.panel.clusterName) {\n\t\t\tthis.panel.displayName =\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\n\t\t} else {\n\t\t\tthis.panel.displayName = \"\";\n\t\t}\n\n\t\tif(this.panel.flipCard){\n\t\t\tthis.$panelContainer.addClass(\"effect-hover\");\n\t\t} else {\n\t\t\tthis.$panelContainer.removeClass(\"effect-hover\");\n\t\t}\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.disabled = [];\n\t\tthis.display = [];\n\t\tthis.annotation = [];\n\t\tthis.extraMoreAlerts = null;\n\n\t\t_.each(this.series, (s) => {\n\t\t\tlet target = _.find(targets, (target) => {\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\n\t\t\t});\n\n\t\t\tif (!target) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts.alias = target.alias;\n\t\t\ts.url = target.url;\n\t\t\ts.isDisplayValue = true;\n\t\t\ts.displayType = target.displayType;\n\t\t\ts.valueDisplayRegex = \"\";\n\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\n\t\t\t}\n\n\t\t\tlet value;\n\t\t\tswitch (target.aggregation) {\n\t\t\t\tcase 'Max':\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.max;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Min':\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.min;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Delta':\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0] - s.datapoints[0][0];\n\t\t\t\t\tvalue = s.stats.diff;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Sum':\n\t\t\t\t\tvalue = 0;\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\n\t\t\t\t\tvalue = s.stats.total;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Avg':\n\t\t\t\t\tvalue = s.stats.avg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'First':\n\t\t\t\t\tvalue = s.datapoints[0][0];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\n\t\t\t}\n\n\t\t\ts.display_value = value;\n\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Text Only\") {\n\t\t\t\tthis.handleTextOnly(s, target);\n\t\t\t}\n\t\t});\n\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\n\t\t\tthis.crit = [];\n\t\t\tthis.warn = [];\n\t\t\tthis.display = [];\n\t\t}\n\n\t\tthis.autoFlip();\n\t\tthis.updatePanelState();\n\t\tthis.handleCssDisplay();\n\t\tthis.parseUri();\n\n\t\t//This must appear after handling the css style of the panel\n\t\tthis.handleMaxAlertsToShow();\n\t}\n\n\tupgradeOldVersion() {\n\t\tlet targets = this.panel.targets;\n\n\t\t//Handle legacy code\n\t\t_.each(targets, (target) => {\n\t\t\tif(target.valueHandler == null) {\n\t\t\t\tif(target.displayType != null) {\n\t\t\t\t\ttarget.valueHandler = target.displayType;\n\t\t\t\t\tif (target.valueHandler == \"Annotation\") {\n\t\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = this.valueHandlers[0]\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\n\t\t\t}\n\n\t\t\tif(target.display != null){\n\t\t\t\ttarget.displayAliasType = target.display ? \"Always\" : this.displayAliasTypes[0];\n\t\t\t\ttarget.displayValueWithAlias = target.display ? 'When Alias Displayed' : this.displayValueTypes[0];\n\t\t\t\tdelete target.display;\n\n\t\t\t}\n\t\t});\n\n\t\t// Depreciate Threshold in favour of Type specific versions\n\t\t_.each(targets, (target) => {\n\t\t\tif (target.valueHandler === \"Threshold\") {\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\n\t\t\t\t// i.e. map to Number Threshold if two floats (i.e. range check) otherwise map to String Threshold (i.e. exact match)\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\n\t\t\t\t\ttarget.crit = Number(target.crit);\n\t\t\t\t\ttarget.warn = Number(target.warn);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\n\t\tlet isCritical = false;\n\t\tlet isWarning = false;\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\n\t\tif (isCheckRanges) {\n\t\t\tif (!series.inverted) {\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value == series.thresholds.crit) {\n\t\t\t\tisCritical = true\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\n\t\t\t\tisWarning = true\n\t\t\t}\n\t\t}\n\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\n\n\t\tlet displayValueWhenAliasDisplayed = 'When Alias Displayed' === target.displayValueWithAlias;\n\t\tlet displayValueFromWarning = 'Warning / Critical' === target.displayValueWithAlias;\n\t\tlet displayValueFromCritical = 'Critical Only' === target.displayValueWithAlias;\n\n\t\tif(isCritical) {\n\t\t\t//In critical state we don't show the error as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning || displayValueFromCritical;\n\t\t\tthis.crit.push(series);\n\t\t} else if(isWarning) {\n\t\t\t//In warning state we don't show the warning as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning;\n\t\t\tthis.warn.push(series);\n\t\t} else if (\"Always\" == target.displayAliasType) {\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed;\n\t\t\tif(series.displayType == \"Annotation\") {\n\t\t\t\tthis.annotation.push(series);\n\t\t\t} else {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\tformatDisplayValue(value, target) {\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\n\t\tif (target.valueHandler === \"Number Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\n\t\t\t\tlet decimals = this.decimalPlaces(value);\n\t\t\t\t// We define the decimal percision by the minimal decimal needed\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? Math.min(target.decimals, decimals) : decimals;\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Number\";\n\t\t\t}\n\t\t} else if (target.valueHandler === \"String Threshold\") {\n\t\t\tif (value === undefined || value === null || value !== value)\n\t\t\t\tvalue = \"Invalid String\";\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet date = moment(new Date(value));\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\n\t\t\t\tvalue = date.format(target.dateFormat);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Date\";\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\n\tdecimalPlaces(num) {\n\t\tvar match = (''+num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\t\tif (!match) { return 0; }\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t// Number of digits right of decimal point.\n\t\t\t(match[1] ? match[1].length : 0)\n\t\t\t// Adjust for scientific notation.\n\t\t\t- (match[2] ? +match[2] : 0));\n\t}\n\n\thandleDisabledStatus(series, target) {\n\t\tseries.displayType = this.displayTypes[0];\n\t\tseries.disabledValue = target.disabledValue;\n\n\t\tif (series.display_value == series.disabledValue) {\n\t\t\tthis.disabled.push(series);\n\t\t}\n\t}\n\n\thandleTextOnly(series, target) {\n\t\tif(series.displayType == \"Annotation\") {\n\t\t\tthis.annotation.push(series);\n\t\t} else {\n\t\t\tthis.display.push(series);\n\t\t}\n\t}\n\n\tupdatePanelState() {\n\t\tif(this.duplicates) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.panelState = 'disabled-state';\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.panelState = 'warn-state';\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.panelState = 'no-data-state';\n\t\t} else {\n\t\t\tthis.panelState = 'ok-state';\n\t\t}\n\t}\n\n\thandleCssDisplay() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\t\tthis.$panelContainer.addClass(this.panelState);\n\n\t\tlet radius = _.isNumber(this.panel.cornerRadius) ? this.panel.cornerRadius : 0\n\t\tthis.$panelContainer.css('border-radius', radius + '%');\n\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\n\n\t\tif (this.panel.colorMode === \"Panel\") {\n\t\t\tswitch(this.panelState) {\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.$panelContainer.css('background-color', '');\n\t\t}\n\t}\n\n\thandleMaxAlertsToShow() {\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\n\t\t\tlet filteredOutAlerts = 0;\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\n\t\t\t\tlet originAlertCount = this[arrayName].length;\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\n\t\t\t});\n\n\t\t\tif(filteredOutAlerts > 0) {\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\n\t\t\t}\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tlet link = this.panel.links[0];\n\n\t\t\tif (link.type == \"absolute\") {\n\t\t\t\tthis.uri = link.url;\n\t\t\t} else {\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\n\t\t\t}\n\n\t\t\tif (link.params) {\n\t\t\t\tthis.uri += \"?\" + link.params;\n\t\t\t}\n\n\t\t\tthis.targetBlank = link.targetBlank;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tvalidateRegex(textRegex) {\n\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\treturn true\n\t\t}\n\t\ttry {\n\t\t\tlet regex = new RegExp(textRegex);\n\t\t\treturn true\n\t\t} catch(e) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\n\t\t\tres.warn = parseFloat(metricOptions.warn);\n\t\t\tres.warnIsNumber = true;\n\t\t} else if (metricOptions.warn instanceof Date) {\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\n\t\t\tres.warn = metricOptions.warn.valueOf();\n\t\t\tres.warnIsNumber = true;\n\t\t} else {\n\t\t\tres.warn = metricOptions.warn;\n\t\t\tres.warnIsNumber = false;\n\t\t}\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\n\t\t\tres.crit = parseFloat(metricOptions.crit);\n\t\t\tres.critIsNumber = true;\n\t\t} else if (metricOptions.crit instanceof Date) {\n\t\t\tres.crit = metricOptions.crit.valueOf();\n\t\t\tres.critIsNumber = true;\n\t\t} else {\n\t\t\tres.crit = metricOptions.crit;\n\t\t\tres.critIsNumber = false;\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tstatic isFloat(val) {\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tstatic seriesHandler(seriesData) {\n\t\tvar series = new TimeSeries({\n\t\t\tdatapoints: seriesData.datapoints,\n\t\t\talias: seriesData.target\n\t\t});\n\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\n\n\t\treturn series;\n\t}\n\n\t$onDestroy() {\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\n\t}\n\n\tautoFlip() {\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\n\t\t\tthis.timeoutId = setInterval(() => {\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\n\t\t\t}, this.panel.flipTime * 1000);\n\t\t}\n\t}\n\n\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\n\t\tthis.$panelContainer.addClass(\"st-card\");\n\t\tthis.$panelContoller = ctrl;\n\t}\n}\n\nStatusPluginCtrl.templateUrl = 'module.html';\n"]} \ No newline at end of file +{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","kbn","moment","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","cornerRadius","isAutoScrollOnOverflow","titleFontSize","fontSize","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","displayAliasTypes","displayValueTypes","colorModes","fontFormats","each","targets","t","valueHandler","Date","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","onColorChange","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","duplicates","measurement","hide","m","res","alias","target","addEditorTab","unitFormats","getUnitFormats","subItem","units","value","render","panelHeaderHeight","title","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","element","overflowY","offsetHeight","scrollHeight","Number","undefined","String","c","w","getTime","item","color","fixPanelHeader","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","datapoints","point","stats","min","diff","total","avg","display_value","handleThresholdStatus","handleDisabledStatus","handleTextOnly","autoFlip","updatePanelState","handleCssDisplay","parseUri","handleMaxAlertsToShow","displayAliasType","displayValueWithAlias","isFloat","thresholds","parseThresholds","inverted","isCritical","isWarning","isCheckRanges","warnIsNumber","critIsNumber","formatDisplayValue","displayValueWhenAliasDisplayed","displayValueFromWarning","displayValueFromCritical","push","isFinite","decimals","decimalPlaces","Math","valueFormats","date","dashboard","isTimezoneUtc","utc","format","dateFormat","num","disabledValue","panelState","radius","okColor","maxAlertNumber","currentMaxAllowedAlerts","filteredOutAlerts","arrayNamesToSlice","forEach","originAlertCount","arrayName","links","link","type","uri","dashUri","params","targetBlank","dataList","map","seriesHandler","timeoutId","clearInterval","setInterval","toggleClass","scope","elem","attrs","ctrl","metricOptions","parseFloat","valueOf","val","toString","toLowerCase","indexOf","seriesData","flotpairs","getFlotPairs","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AACDC,I;;AACAC,a;;AACAC,a;;AACAC,M;;AACAC,S;;;;;;;;;;;;;;;;;;;;;AAKDC,gB,GAAgB;AACrBC,cAAU,KADW;AAErBC,cAAU,CAFW;AAGrBC,eAAW,OAHU;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Ad,YAA8B+B,IAAlC,EAAwC;AAC9C8B,WAAI7D,IAAJ,GAAWkM,cAAclM,IAAd,CAAmBoM,OAAnB,EAAX;AACAvI,WAAIsF,YAAJ,GAAmB,IAAnB;AACA,OAHM,MAGA;AACNtF,WAAI7D,IAAJ,GAAWkM,cAAclM,IAAzB;AACA6D,WAAIsF,YAAJ,GAAmB,KAAnB;AACA;;AAED,aAAOtF,GAAP;AACA;;;6BAEcwI,G,EAAK;AACnB,UAAI,CAACnH,MAAMmH,GAAN,CAAD,IAAeA,IAAIC,QAAJ,GAAeC,WAAf,GAA6BC,OAA7B,CAAqC,GAArC,KAA6C,CAAC,CAAjE,EAAoE;AACnE,cAAO,IAAP;AACA;AACD,aAAO,KAAP;AACA;;;mCAYoBC,U,EAAY;AAChC,UAAIzF,SAAS,IAAIzH,UAAJ,CAAe;AAC3BkI,mBAAYgF,WAAWhF,UADI;AAE3B3D,cAAO2I,WAAW1I;AAFS,OAAf,CAAb;;AAKAiD,aAAO0F,SAAP,GAAmB1F,OAAO2F,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO3F,MAAP;AACA;;;;KA5kBoC3H,gB;;;;AAkmBtCsB,oBAAiBiM,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\";\nimport kbn from \"app/core/utils/kbn\";\nimport moment from \"moment\";\n\nimport './css/status_panel.css!';\n\n// Set and populate panel defaults\nconst panelDefaults = {\n\tflipCard: false,\n\tflipTime: 5,\n\tcolorMode: 'Panel',\n\t// Changed colors to match Table Panel so colorised text is easier to read\n\tcolors: {\n\t\tcrit: 'rgba(245, 54, 54, 0.9)',\n\t\twarn: 'rgba(237, 129, 40, 0.9)',\n\t\tok: 'rgba(50, 128, 45, 0.9)',\n\t\tdisable: 'rgba(128, 128, 128, 0.9)'\n\t},\n\tisGrayOnNoData: false,\n\tisIgnoreOKColors: false,\n\tisHideAlertsOnDisable: false,\n\tcornerRadius: 0,\n\tisAutoScrollOnOverflow: false,\n\ttitleFontSize: 1,\n\tfontSize: 1\n};\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\t\t_.defaultsDeep(this.panel, panelDefaults);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.valueHandlers = ['Number Threshold', 'String Threshold', 'Date Threshold', 'Disable Criteria', 'Text Only'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg', 'Delta'];\n\t\tthis.displayTypes = ['Regular', 'Annotation'];\n\t\tthis.displayAliasTypes = ['Warning / Critical', 'Always'];\n\t\tthis.displayValueTypes = ['Never', 'When Alias Displayed', 'Warning / Critical', 'Critical Only'];\n\t\tthis.colorModes = ['Panel', 'Metric', 'Disabled'];\n\t\tthis.fontFormats = ['Regular', 'Bold', 'Italic'];\n\n\t\t// Dates get stored as strings and will need to be converted back to a Date objects\n\t\t_.each(this.panel.targets, (t) => {\n\t\t\tif (t.valueHandler === \"Date Threshold\") {\n\t\t\t\tif (typeof t.crit != \"undefined\") t.crit = new Date(t.crit);\n\t\t\t\tif (typeof t.warn != \"undefined\") t.warn = new Date(t.warn);\n\t\t\t}\n\t\t});\n\n\t\tthis.panel.flipTime = this.panel.flipTime || 5;\n\n\t\t/** Bind events to functions **/\n\t\tthis.events.on('render', this.onRender.bind(this));\n\t\tthis.events.on('refresh', this.postRefresh.bind(this));\n\t\tthis.events.on('data-error', this.onDataError.bind(this));\n\t\tthis.events.on('data-received', this.onDataReceived.bind(this));\n\t\tthis.events.on('data-snapshot-load', this.onDataReceived.bind(this));\n\t\tthis.events.on('init-edit-mode', this.onInitEditMode.bind(this));\n\n\t\tthis.onColorChange = this.onColorChange.bind(this);\n\n\t\tthis.addFilters()\n\t}\n\n\taddFilters() {\n\t\tcoreModule.filter('numberOrText', () => {\n\t\t\tlet numberOrTextFilter = (input) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\treturn input;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\n\t\tcoreModule.filter('numberOrTextWithRegex', () => {\n\t\t\tlet numberOrTextFilter = (input, textRegex) => {\n\t\t\t\tif(angular.isNumber(input)) {\n\t\t\t\t\treturn this.filter('number')(input);\n\t\t\t\t} else {\n\t\t\t\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet regex;\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tregex = new RegExp(textRegex);\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!input) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet matchResults = input.match(regex);\n\t\t\t\t\t\tif (matchResults == null) {\n\t\t\t\t\t\t\treturn input;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn matchResults[0];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tnumberOrTextFilter.$stateful = true;\n\t\t\treturn numberOrTextFilter;\n\t\t});\n\t}\n\n\tpostRefresh() {\n\t\tif (this.panel.fixedSpan) {\n\t\t\tthis.panel.span = this.panel.fixedSpan;\n\t\t}\n\n\t\tthis.measurements = this.panel.targets;\n\n\t\t/** Duplicate alias validation **/\n\t\tthis.duplicates = false;\n\n\t\tthis.measurements = _.filter(this.measurements, (measurement) => {\n\t\t\treturn !measurement.hide;\n\t\t});\n\n\t\t_.each(this.measurements, (m) => {\n\t\t\tlet res = _.filter(this.measurements, (measurement) => {\n\t\t\t\treturn (m.alias == measurement.alias || (m.target == measurement.target && m.target)) && !m.hide;\n\t\t\t});\n\n\t\t\tif (res.length > 1) {\n\t\t\t\tthis.duplicates = true;\n\t\t\t}\n\t\t});\n\t}\n\n\tonInitEditMode() {\n\t\tthis.addEditorTab('Options', 'public/plugins/vonage-status-panel/editor.html', 2);\n\t\t// Load in the supported units-of-measure formats so they can be displayed in the editor\n\t\tthis.unitFormats = kbn.getUnitFormats();\n\t}\n\n\tsetUnitFormat(measurement, subItem) {\n\t\tmeasurement.units = subItem.value;\n\t\tthis.render();\n\t}\n\n\tfixPanelHeader() {\n\t\t// Handle the panel top menu height, since it's display doesn't look good with the panel\n\t\tlet panelHeaderHeight = '';\n\t\tif(this.panel.title.length === 0) {\n\t\t\tpanelHeaderHeight = '10px';\n\t\t}\n\t\tthis.$panelContainer.find('.panel-header').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.panel-menu-container').css('height', panelHeaderHeight);\n\t\tthis.$panelContainer.find('.fa-caret-down').css('display', 'none');\n\t}\n\n\tsetElementHeight() {\n\t\t// Handle the panel height\n\t\tthis.$panelContainer.find('.status-panel').css('min-height', this.$panelContoller.height + 'px');\n\t\tthis.minHeight = this.$panelContoller.height-10;\n\t}\n\n\tsetTextMaxWidth() {\n\t\tlet tail = ' …';\n\t\tlet panelWidth = this.$panelContainer.innerWidth();\n\t\tif (isNaN(panelWidth))\n\t\t\tpanelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;\n\t\tpanelWidth = panelWidth - 20;\n\t\tthis.maxWidth = panelWidth;\n\t}\n\n\tisAutoScrollAlerts() {\n\t\tif(!this.panel.isAutoScrollOnOverflow) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet element = this.$panelContainer.find('.status-panel')[0];\n\t\tlet overflowY = element.offsetHeight < element.scrollHeight;\n\t\treturn overflowY;\n\t}\n\n\tonHandlerChange(measurement) {\n\t\t// If the Threshold type changes between Number/String/Date then try and recast the thresholds to keep consistent\n\t\tif (measurement.valueHandler === \"Number Threshold\") {\n\t\t\tmeasurement.crit = (isNaN(Number(measurement.crit))) ? undefined : Number(measurement.crit);\n\t\t\tmeasurement.warn = (isNaN(Number(measurement.warn))) ? undefined : Number(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"String Threshold\") {\n\t\t\tif (typeof measurement.crit != \"undefined\") measurement.crit = String(measurement.crit);\n\t\t\tif (typeof measurement.warn != \"undefined\") measurement.warn = String(measurement.warn);\n\t\t} else if (measurement.valueHandler === \"Date Threshold\") {\n\t\t\tlet c = new Date(measurement.crit), w = new Date(measurement.warn);\n\t\t\tmeasurement.crit = (isNaN(c.getTime())) ? undefined : c;\n\t\t\tmeasurement.warn = (isNaN(w.getTime())) ? undefined : w;\n\t\t}\n\t\tthis.onRender();\n\t}\n\n\tonColorChange(item) {\n\t\treturn (color) => {\n\t\t\tthis.panel.colors[item] = color;\n\t\t\tthis.render();\n\t\t};\n\t}\n\n\tonRender() {\n\t\tthis.fixPanelHeader();\n\t\tthis.setElementHeight();\n\t\tthis.setTextMaxWidth();\n\t\tthis.upgradeOldVersion();\n\n\t\tif (this.panel.clusterName) {\n\t\t\tthis.panel.displayName =\n\t\t\t\tthis.filter('interpolateTemplateVars')(this.panel.clusterName, this.$scope)\n\t\t\t\t\t.replace(new RegExp(this.panel.namePrefix, 'i'), '');\n\t\t} else {\n\t\t\tthis.panel.displayName = \"\";\n\t\t}\n\n\t\tif(this.panel.flipCard){\n\t\t\tthis.$panelContainer.addClass(\"effect-hover\");\n\t\t} else {\n\t\t\tthis.$panelContainer.removeClass(\"effect-hover\");\n\t\t}\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.disabled = [];\n\t\tthis.display = [];\n\t\tthis.annotation = [];\n\t\tthis.extraMoreAlerts = null;\n\n\t\t_.each(this.series, (s) => {\n\t\t\tlet target = _.find(targets, (target) => {\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\n\t\t\t});\n\n\t\t\tif (!target) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts.alias = target.alias;\n\t\t\ts.url = target.url;\n\t\t\ts.isDisplayValue = true;\n\t\t\ts.displayType = target.displayType;\n\t\t\ts.valueDisplayRegex = \"\";\n\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\n\t\t\t}\n\n\t\t\tlet value;\n\t\t\tswitch (target.aggregation) {\n\t\t\t\tcase 'Max':\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.max;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Min':\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.min;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Delta':\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0] - s.datapoints[0][0];\n\t\t\t\t\tvalue = s.stats.diff;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Sum':\n\t\t\t\t\tvalue = 0;\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\n\t\t\t\t\tvalue = s.stats.total;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Avg':\n\t\t\t\t\tvalue = s.stats.avg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'First':\n\t\t\t\t\tvalue = s.datapoints[0][0];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\n\t\t\t}\n\n\t\t\ts.display_value = value;\n\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Text Only\") {\n\t\t\t\tthis.handleTextOnly(s, target);\n\t\t\t}\n\t\t});\n\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\n\t\t\tthis.crit = [];\n\t\t\tthis.warn = [];\n\t\t\tthis.display = [];\n\t\t}\n\n\t\tthis.autoFlip();\n\t\tthis.updatePanelState();\n\t\tthis.handleCssDisplay();\n\t\tthis.parseUri();\n\n\t\t//This must appear after handling the css style of the panel\n\t\tthis.handleMaxAlertsToShow();\n\t}\n\n\tupgradeOldVersion() {\n\t\tlet targets = this.panel.targets;\n\n\t\t//Handle legacy code\n\t\t_.each(targets, (target) => {\n\t\t\tif(target.valueHandler == null) {\n\t\t\t\tif(target.displayType != null) {\n\t\t\t\t\ttarget.valueHandler = target.displayType;\n\t\t\t\t\tif (target.valueHandler == \"Annotation\") {\n\t\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = this.valueHandlers[0]\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\n\t\t\t}\n\n\t\t\tif(target.display != null){\n\t\t\t\ttarget.displayAliasType = target.display ? \"Always\" : this.displayAliasTypes[0];\n\t\t\t\ttarget.displayValueWithAlias = target.display ? 'When Alias Displayed' : this.displayValueTypes[0];\n\t\t\t\tdelete target.display;\n\n\t\t\t}\n\t\t});\n\n\t\t// Depreciate Threshold in favour of Type specific versions\n\t\t_.each(targets, (target) => {\n\t\t\tif (target.valueHandler === \"Threshold\") {\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\n\t\t\t\t// i.e. map to Number Threshold if two floats (i.e. range check) otherwise map to String Threshold (i.e. exact match)\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\n\t\t\t\t\ttarget.crit = Number(target.crit);\n\t\t\t\t\ttarget.warn = Number(target.warn);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\n\t\tlet isCritical = false;\n\t\tlet isWarning = false;\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\n\t\tif (isCheckRanges) {\n\t\t\tif (!series.inverted) {\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value == series.thresholds.crit) {\n\t\t\t\tisCritical = true\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\n\t\t\t\tisWarning = true\n\t\t\t}\n\t\t}\n\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\n\n\t\tlet displayValueWhenAliasDisplayed = 'When Alias Displayed' === target.displayValueWithAlias;\n\t\tlet displayValueFromWarning = 'Warning / Critical' === target.displayValueWithAlias;\n\t\tlet displayValueFromCritical = 'Critical Only' === target.displayValueWithAlias;\n\n\t\tif(isCritical) {\n\t\t\t//In critical state we don't show the error as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning || displayValueFromCritical;\n\t\t\tthis.crit.push(series);\n\t\t} else if(isWarning) {\n\t\t\t//In warning state we don't show the warning as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning;\n\t\t\tthis.warn.push(series);\n\t\t} else if (\"Always\" == target.displayAliasType) {\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed;\n\t\t\tif(series.displayType == \"Annotation\") {\n\t\t\t\tthis.annotation.push(series);\n\t\t\t} else {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\tformatDisplayValue(value, target) {\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\n\t\tif (target.valueHandler === \"Number Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\n\t\t\t\tlet decimals = this.decimalPlaces(value);\n\t\t\t\t// We define the decimal percision by the minimal decimal needed\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? Math.min(target.decimals, decimals) : decimals;\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Number\";\n\t\t\t}\n\t\t} else if (target.valueHandler === \"String Threshold\") {\n\t\t\tif (value === undefined || value === null || value !== value)\n\t\t\t\tvalue = \"Invalid String\";\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet date = moment(new Date(value));\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\n\t\t\t\tvalue = date.format(target.dateFormat);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Date\";\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\n\tdecimalPlaces(num) {\n\t\tvar match = (''+num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\t\tif (!match) { return 0; }\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t// Number of digits right of decimal point.\n\t\t\t(match[1] ? match[1].length : 0)\n\t\t\t// Adjust for scientific notation.\n\t\t\t- (match[2] ? +match[2] : 0));\n\t}\n\n\thandleDisabledStatus(series, target) {\n\t\tseries.displayType = this.displayTypes[0];\n\t\tseries.disabledValue = target.disabledValue;\n\n\t\tif (series.display_value == series.disabledValue) {\n\t\t\tthis.disabled.push(series);\n\t\t}\n\t}\n\n\thandleTextOnly(series, target) {\n\t\tif(series.displayType == \"Annotation\") {\n\t\t\tthis.annotation.push(series);\n\t\t} else {\n\t\t\tthis.display.push(series);\n\t\t}\n\t}\n\n\tupdatePanelState() {\n\t\tif(this.duplicates) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.panelState = 'disabled-state';\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.panelState = 'warn-state';\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.panelState = 'no-data-state';\n\t\t} else {\n\t\t\tthis.panelState = 'ok-state';\n\t\t}\n\t}\n\n\thandleCssDisplay() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\t\tthis.$panelContainer.addClass(this.panelState);\n\n\t\tlet radius = _.isNumber(this.panel.cornerRadius) ? this.panel.cornerRadius : 0\n\t\tthis.$panelContainer.css('border-radius', radius + '%');\n\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\n\n\t\tif (this.panel.colorMode === \"Panel\") {\n\t\t\tswitch(this.panelState) {\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.$panelContainer.css('background-color', '');\n\t\t}\n\t}\n\n\thandleMaxAlertsToShow() {\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\n\t\t\tlet filteredOutAlerts = 0;\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\n\t\t\t\tlet originAlertCount = this[arrayName].length;\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\n\t\t\t});\n\n\t\t\tif(filteredOutAlerts > 0) {\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\n\t\t\t}\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tlet link = this.panel.links[0];\n\n\t\t\tif (link.type == \"absolute\") {\n\t\t\t\tthis.uri = link.url;\n\t\t\t} else {\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\n\t\t\t}\n\n\t\t\tif (link.params) {\n\t\t\t\tthis.uri += \"?\" + link.params;\n\t\t\t}\n\n\t\t\tthis.targetBlank = link.targetBlank;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tvalidateRegex(textRegex) {\n\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\treturn true\n\t\t}\n\t\ttry {\n\t\t\tlet regex = new RegExp(textRegex);\n\t\t\treturn true\n\t\t} catch(e) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\n\t\t\tres.warn = parseFloat(metricOptions.warn);\n\t\t\tres.warnIsNumber = true;\n\t\t} else if (metricOptions.warn instanceof Date) {\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\n\t\t\tres.warn = metricOptions.warn.valueOf();\n\t\t\tres.warnIsNumber = true;\n\t\t} else {\n\t\t\tres.warn = metricOptions.warn;\n\t\t\tres.warnIsNumber = false;\n\t\t}\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\n\t\t\tres.crit = parseFloat(metricOptions.crit);\n\t\t\tres.critIsNumber = true;\n\t\t} else if (metricOptions.crit instanceof Date) {\n\t\t\tres.crit = metricOptions.crit.valueOf();\n\t\t\tres.critIsNumber = true;\n\t\t} else {\n\t\t\tres.crit = metricOptions.crit;\n\t\t\tres.critIsNumber = false;\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tstatic isFloat(val) {\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tstatic seriesHandler(seriesData) {\n\t\tvar series = new TimeSeries({\n\t\t\tdatapoints: seriesData.datapoints,\n\t\t\talias: seriesData.target\n\t\t});\n\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\n\n\t\treturn series;\n\t}\n\n\t$onDestroy() {\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\n\t}\n\n\tautoFlip() {\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\n\t\t\tthis.timeoutId = setInterval(() => {\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\n\t\t\t}, this.panel.flipTime * 1000);\n\t\t}\n\t}\n\n\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\n\t\tthis.$panelContainer.addClass(\"st-card\");\n\t\tthis.$panelContoller = ctrl;\n\t}\n}\n\nStatusPluginCtrl.templateUrl = 'module.html';\n"]} \ No newline at end of file diff --git a/src/editor.html b/src/editor.html index 0c65b525..da744386 100644 --- a/src/editor.html +++ b/src/editor.html @@ -14,6 +14,15 @@

Panel Options
Panel Title
+
+ + Title Font Size + + The title font font size expressed in rem + + + +
Remove Prefix @@ -45,9 +54,9 @@
Panel Options
- Text Size + Metric font Size - The metric text font size expressed in rem + The metric font font size expressed in rem diff --git a/src/module.html b/src/module.html index 638db94c..ac5cc900 100644 --- a/src/module.html +++ b/src/module.html @@ -26,7 +26,7 @@
-

+

{{ ctrl.panel.displayName | interpolateTemplateVars:this }} diff --git a/src/status_ctrl.js b/src/status_ctrl.js index 88028647..94805abb 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -24,7 +24,8 @@ const panelDefaults = { isHideAlertsOnDisable: false, cornerRadius: 0, isAutoScrollOnOverflow: false, - fontSize: 3 + titleFontSize: 1, + fontSize: 1 }; export class StatusPluginCtrl extends MetricsPanelCtrl {