diff --git a/dist/module.html b/dist/module.html index b882d6fa..cf5ab796 100644 --- a/dist/module.html +++ b/dist/module.html @@ -27,12 +27,12 @@

- + {{ ctrl.panel.displayName | interpolateTemplateVars:this }} - {{ ctrl.panel.displayName | interpolateTemplateVars:this }} - + {{ ctrl.panel.displayName | interpolateTemplateVars:this }} +

diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js index ac82e7ac..3b2b3db8 100644 --- a/dist/status_ctrl.js +++ b/dist/status_ctrl.js @@ -638,18 +638,10 @@ System.register(["app/plugins/sdk", "lodash", "app/core/time_series2", "app/core value: function parseUri() { if (this.panel.links && this.panel.links.length > 0) { var link = this.panel.links[0]; - - if (link.type == "absolute") { - this.uri = link.url; - } else { - this.uri = 'dashboard/' + link.dashUri; - } - - if (link.params) { - this.uri += "?" + link.params; - } - - this.targetBlank = link.targetBlank; + var linkSrv = this.$injector.get('linkSrv'); + var info = linkSrv.getPanelLinkAnchorInfo(link, this.panel.scopedVars); + this.uri = info.href; + this.target = info.target; } else { this.uri = undefined; } diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map index 3deb37a7..6c575d6a 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","datapoints","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","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;AAWrB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;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;AAC3ByH,mBAAYuF,WAAWvF,UADI;AAE3BpD,cAAO2I,WAAW1I;AAFS,OAAf,CAAb;;AAKAiD,aAAO0F,SAAP,GAAmB1F,OAAO2F,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO3F,MAAP;AACA;;;;KAhlBoCzH,gB;;;;AAsmBtCoB,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\tif (s.datapoints.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet target = _.find(targets, (target) => {\n\t\t\t\treturn target.alias == s.alias || target.target == s.alias;\n\t\t\t});\n\n\t\t\tif (!target) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ts.alias = target.alias;\n\t\t\ts.url = target.url;\n\t\t\ts.isDisplayValue = true;\n\t\t\ts.displayType = target.displayType;\n\t\t\ts.valueDisplayRegex = \"\";\n\n\t\t\tif(this.validateRegex(target.valueDisplayRegex)) {\n\t\t\t\ts.valueDisplayRegex = target.valueDisplayRegex;\n\t\t\t}\n\n\t\t\tlet value;\n\t\t\tswitch (target.aggregation) {\n\t\t\t\tcase 'Max':\n\t\t\t\t\tvalue = _.max(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.max;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Min':\n\t\t\t\t\tvalue = _.min(s.datapoints, (point) => { return point[0]; })[0];\n\t\t\t\t\tvalue = s.stats.min;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Delta':\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0] - s.datapoints[0][0];\n\t\t\t\t\tvalue = s.stats.diff;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Sum':\n\t\t\t\t\tvalue = 0;\n\t\t\t\t\t_.each(s.datapoints, (point) => { value += point[0] });\n\t\t\t\t\tvalue = s.stats.total;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Avg':\n\t\t\t\t\tvalue = s.stats.avg;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'First':\n\t\t\t\t\tvalue = s.datapoints[0][0];\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tvalue = s.datapoints[s.datapoints.length - 1][0];\n\t\t\t}\n\n\t\t\ts.display_value = value;\n\n\t\t\tif (target.valueHandler == \"Number Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"String Threshold\" ||\n\t\t\t\ttarget.valueHandler == \"Date Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.valueHandler == \"Text Only\") {\n\t\t\t\tthis.handleTextOnly(s, target);\n\t\t\t}\n\t\t});\n\n\t\tif(this.panel.isHideAlertsOnDisable && this.disabled.length > 0) {\n\t\t\tthis.crit = [];\n\t\t\tthis.warn = [];\n\t\t\tthis.display = [];\n\t\t}\n\n\t\tthis.autoFlip();\n\t\tthis.updatePanelState();\n\t\tthis.handleCssDisplay();\n\t\tthis.parseUri();\n\n\t\t//This must appear after handling the css style of the panel\n\t\tthis.handleMaxAlertsToShow();\n\t}\n\n\tupgradeOldVersion() {\n\t\tlet targets = this.panel.targets;\n\n\t\t//Handle legacy code\n\t\t_.each(targets, (target) => {\n\t\t\tif(target.valueHandler == null) {\n\t\t\t\tif(target.displayType != null) {\n\t\t\t\t\ttarget.valueHandler = target.displayType;\n\t\t\t\t\tif (target.valueHandler == \"Annotation\") {\n\t\t\t\t\t\ttarget.valueHandler = \"Text Only\"\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = this.valueHandlers[0]\n\t\t\t\t}\n\t\t\t\ttarget.displayType = this.displayTypes[0];\n\t\t\t}\n\n\t\t\tif(target.display != null){\n\t\t\t\ttarget.displayAliasType = target.display ? \"Always\" : this.displayAliasTypes[0];\n\t\t\t\ttarget.displayValueWithAlias = target.display ? 'When Alias Displayed' : this.displayValueTypes[0];\n\t\t\t\tdelete target.display;\n\n\t\t\t}\n\t\t});\n\n\t\t// Depreciate Threshold in favour of Type specific versions\n\t\t_.each(targets, (target) => {\n\t\t\tif (target.valueHandler === \"Threshold\") {\n\t\t\t\t// Use the same logic as Threshold Parsing to ensure we retain same behaviour\n\t\t\t\t// i.e. map to Number Threshold if two floats (i.e. range check) otherwise map to String Threshold (i.e. exact match)\n\t\t\t\tif (StatusPluginCtrl.isFloat(target.crit) && StatusPluginCtrl.isFloat(target.warn)) {\n\t\t\t\t\ttarget.valueHandler = \"Number Threshold\"\n\t\t\t\t\ttarget.crit = Number(target.crit);\n\t\t\t\t\ttarget.warn = Number(target.warn);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.valueHandler = \"String Threshold\"\n\t\t\t\t\tif (typeof target.crit != \"undefined\") target.crit = String(target.crit);\n\t\t\t\t\tif (typeof target.warn != \"undefined\") target.warn = String(target.warn);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\n\t\tlet isCritical = false;\n\t\tlet isWarning = false;\n\t\tlet isCheckRanges = series.thresholds.warnIsNumber && series.thresholds.critIsNumber;\n\t\tif (isCheckRanges) {\n\t\t\tif (!series.inverted) {\n\t\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\t\tisCritical = true\n\t\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\t\tisWarning = true\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value == series.thresholds.crit) {\n\t\t\t\tisCritical = true\n\t\t\t} else if (series.display_value == series.thresholds.warn) {\n\t\t\t\tisWarning = true\n\t\t\t}\n\t\t}\n\n\t\t// Add units-of-measure and decimal formatting or date formatting as needed\n\t\tseries.display_value = this.formatDisplayValue(series.display_value, target);\n\n\t\tlet displayValueWhenAliasDisplayed = 'When Alias Displayed' === target.displayValueWithAlias;\n\t\tlet displayValueFromWarning = 'Warning / Critical' === target.displayValueWithAlias;\n\t\tlet displayValueFromCritical = 'Critical Only' === target.displayValueWithAlias;\n\n\t\tif(isCritical) {\n\t\t\t//In critical state we don't show the error as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning || displayValueFromCritical;\n\t\t\tthis.crit.push(series);\n\t\t} else if(isWarning) {\n\t\t\t//In warning state we don't show the warning as annotation\n\t\t\tseries.displayType = this.displayTypes[0];\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed || displayValueFromWarning;\n\t\t\tthis.warn.push(series);\n\t\t} else if (\"Always\" == target.displayAliasType) {\n\t\t\tseries.isDisplayValue = displayValueWhenAliasDisplayed;\n\t\t\tif(series.displayType == \"Annotation\") {\n\t\t\t\tthis.annotation.push(series);\n\t\t\t} else {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\tformatDisplayValue(value, target) {\n\t\t// Format the display value. Set to \"Invalid\" if value is out-of-bounds or a type mismatch with the handler\n\t\tif (target.valueHandler === \"Number Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet units = (typeof target.units === \"string\") ? target.units : 'none';\n\t\t\t\tlet decimals = this.decimalPlaces(value);\n\t\t\t\t// We define the decimal percision by the minimal decimal needed\n\t\t\t\tdecimals = (typeof target.decimals === \"number\") ? Math.min(target.decimals, decimals) : decimals;\n\t\t\t\tvalue = kbn.valueFormats[units](value, decimals, null);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Number\";\n\t\t\t}\n\t\t} else if (target.valueHandler === \"String Threshold\") {\n\t\t\tif (value === undefined || value === null || value !== value)\n\t\t\t\tvalue = \"Invalid String\";\n\t\t} else if (target.valueHandler === \"Date Threshold\") {\n\t\t\tif (_.isFinite(value)) {\n\t\t\t\tlet date = moment(new Date(value));\n\t\t\t\tif (this.dashboard.isTimezoneUtc()) date = date.utc();\n\t\t\t\tvalue = date.format(target.dateFormat);\n\t\t\t} else {\n\t\t\t\tvalue = \"Invalid Date\";\n\t\t\t}\n\t\t}\n\t\treturn value;\n\t}\n\n\tdecimalPlaces(num) {\n\t\tvar match = (''+num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\t\tif (!match) { return 0; }\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t// Number of digits right of decimal point.\n\t\t\t(match[1] ? match[1].length : 0)\n\t\t\t// Adjust for scientific notation.\n\t\t\t- (match[2] ? +match[2] : 0));\n\t}\n\n\thandleDisabledStatus(series, target) {\n\t\tseries.displayType = this.displayTypes[0];\n\t\tseries.disabledValue = target.disabledValue;\n\n\t\tif (series.display_value == series.disabledValue) {\n\t\t\tthis.disabled.push(series);\n\t\t}\n\t}\n\n\thandleTextOnly(series, target) {\n\t\tif(series.displayType == \"Annotation\") {\n\t\t\tthis.annotation.push(series);\n\t\t} else {\n\t\t\tthis.display.push(series);\n\t\t}\n\t}\n\n\tupdatePanelState() {\n\t\tif(this.duplicates) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.panelState = 'disabled-state';\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.panelState = 'error-state';\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.panelState = 'warn-state';\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.panelState = 'no-data-state';\n\t\t} else {\n\t\t\tthis.panelState = 'ok-state';\n\t\t}\n\t}\n\n\thandleCssDisplay() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\t\tthis.$panelContainer.addClass(this.panelState);\n\n\t\tlet radius = _.isNumber(this.panel.cornerRadius) ? this.panel.cornerRadius : 0\n\t\tthis.$panelContainer.css('border-radius', radius + '%');\n\n\t\tlet okColor = (this.panel.isIgnoreOKColors) ? '' : this.panel.colors.ok;\n\n\t\tif (this.panel.colorMode === \"Panel\") {\n\t\t\tswitch(this.panelState) {\n\t\t\t\tcase 'disabled-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tcase 'error-state': this.$panelContainer.css('background-color', this.panel.colors.crit); break;\n\t\t\t\tcase 'warn-state': this.$panelContainer.css('background-color', this.panel.colors.warn); break;\n\t\t\t\tcase 'no-data-state': this.$panelContainer.css('background-color', this.panel.colors.disable); break;\n\t\t\t\tdefault: this.$panelContainer.css('background-color', okColor); break;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.$panelContainer.css('background-color', '');\n\t\t}\n\t}\n\n\thandleMaxAlertsToShow() {\n\t\tif(this.panel.maxAlertNumber != null && this.panel.maxAlertNumber >= 0) {\n\t\t\tlet currentMaxAllowedAlerts = this.panel.maxAlertNumber;\n\t\t\tlet filteredOutAlerts = 0;\n\t\t\tlet arrayNamesToSlice = [\"disabled\", \"crit\", \"warn\", \"display\"];\n\t\t\tarrayNamesToSlice.forEach( arrayName => {\n\t\t\t\tlet originAlertCount = this[arrayName].length;\n\t\t\t\tthis[arrayName] = this[arrayName].slice(0,currentMaxAllowedAlerts);\n\t\t\t\tcurrentMaxAllowedAlerts = Math.max(currentMaxAllowedAlerts - this[arrayName].length, 0);\n\t\t\t\tfilteredOutAlerts += (originAlertCount - this[arrayName].length);\n\t\t\t});\n\n\t\t\tif(filteredOutAlerts > 0) {\n\t\t\t\tthis.extraMoreAlerts = \"+ \" + filteredOutAlerts + \" more\"\n\t\t\t}\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tlet link = this.panel.links[0];\n\n\t\t\tif (link.type == \"absolute\") {\n\t\t\t\tthis.uri = link.url;\n\t\t\t} else {\n\t\t\t\tthis.uri = 'dashboard/' + link.dashUri;\n\t\t\t}\n\n\t\t\tif (link.params) {\n\t\t\t\tthis.uri += \"?\" + link.params;\n\t\t\t}\n\n\t\t\tthis.targetBlank = link.targetBlank;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tvalidateRegex(textRegex) {\n\t\tif(textRegex == null || textRegex.length == 0) {\n\t\t\treturn true\n\t\t}\n\t\ttry {\n\t\t\tlet regex = new RegExp(textRegex);\n\t\t\treturn true\n\t\t} catch(e) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.warn)) {\n\t\t\tres.warn = parseFloat(metricOptions.warn);\n\t\t\tres.warnIsNumber = true;\n\t\t} else if (metricOptions.warn instanceof Date) {\n\t\t\t// Convert Dates to Numbers and leverage existing threshold logic\n\t\t\tres.warn = metricOptions.warn.valueOf();\n\t\t\tres.warnIsNumber = true;\n\t\t} else {\n\t\t\tres.warn = metricOptions.warn;\n\t\t\tres.warnIsNumber = false;\n\t\t}\n\n\t\tif (StatusPluginCtrl.isFloat(metricOptions.crit)) {\n\t\t\tres.crit = parseFloat(metricOptions.crit);\n\t\t\tres.critIsNumber = true;\n\t\t} else if (metricOptions.crit instanceof Date) {\n\t\t\tres.crit = metricOptions.crit.valueOf();\n\t\t\tres.critIsNumber = true;\n\t\t} else {\n\t\t\tres.crit = metricOptions.crit;\n\t\t\tres.critIsNumber = false;\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tstatic isFloat(val) {\n\t\tif (!isNaN(val) && val.toString().toLowerCase().indexOf('e') == -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(StatusPluginCtrl.seriesHandler.bind(this));\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tstatic seriesHandler(seriesData) {\n\t\tvar series = new TimeSeries({\n\t\t\tdatapoints: seriesData.datapoints,\n\t\t\talias: seriesData.target\n\t\t});\n\n\t\tseries.flotpairs = series.getFlotPairs(\"connected\");\n\n\t\treturn series;\n\t}\n\n\t$onDestroy() {\n\t\tif(this.timeoutId) clearInterval(this.timeoutId);\n\t}\n\n\tautoFlip() {\n\t\tif (this.timeoutId) clearInterval(this.timeoutId);\n\t\tif (this.panel.flipCard && (this.crit.length > 0 || this.warn.length > 0 || this.disabled.length > 0)) {\n\t\t\tthis.timeoutId = setInterval(() => {\n\t\t\t\tthis.$panelContainer.toggleClass(\"flipped\");\n\t\t\t}, this.panel.flipTime * 1000);\n\t\t}\n\t}\n\n\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\n\t\tthis.$panelContainer.addClass(\"st-card\");\n\t\tthis.$panelContoller = ctrl;\n\t}\n}\n\nStatusPluginCtrl.templateUrl = 'module.html';\n"]} \ No newline at end of file +{"version":3,"sources":["../src/status_ctrl.js"],"names":["MetricsPanelCtrl","_","TimeSeries","coreModule","kbn","moment","panelDefaults","flipCard","flipTime","colorMode","colors","crit","warn","ok","disable","isGrayOnNoData","isIgnoreOKColors","isHideAlertsOnDisable","cornerRadius","isAutoScrollOnOverflow","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","defaultsDeep","panel","filter","valueHandlers","aggregations","displayTypes","displayAliasTypes","displayValueTypes","colorModes","fontFormats","each","targets","t","valueHandler","Date","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","onColorChange","addFilters","numberOrTextFilter","input","angular","isNumber","$stateful","textRegex","length","regex","RegExp","e","matchResults","match","fixedSpan","span","measurements","duplicates","measurement","hide","m","res","alias","target","addEditorTab","unitFormats","getUnitFormats","subItem","units","value","render","panelHeaderHeight","title","$panelContainer","find","css","$panelContoller","height","minHeight","tail","panelWidth","innerWidth","isNaN","parseInt","slice","maxWidth","element","overflowY","offsetHeight","scrollHeight","Number","undefined","String","c","w","getTime","item","color","fixPanelHeader","setElementHeight","setTextMaxWidth","upgradeOldVersion","clusterName","displayName","replace","namePrefix","addClass","removeClass","disabled","display","annotation","extraMoreAlerts","series","s","datapoints","url","isDisplayValue","displayType","valueDisplayRegex","validateRegex","aggregation","max","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","linkSrv","get","info","getPanelLinkAnchorInfo","scopedVars","uri","href","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;AAfH,I;;+BAkBTC,gB;;;AACZ;AACA,8BAAYC,MAAZ,EAAoBC,SAApB,EAA+BC,IAA/B,EAAqCC,OAArC,EAA8CC,cAA9C,EAA8D;AAAA;;AAAA,qIACvDJ,MADuD,EAC/CC,SAD+C;;AAE7DrB,OAAEyB,YAAF,CAAe,MAAKC,KAApB,EAA2BrB,aAA3B;;AAEA;AACA,WAAKsB,MAAL,GAAcJ,OAAd;;AAEA,WAAKK,aAAL,GAAqB,CAAC,kBAAD,EAAqB,kBAArB,EAAyC,gBAAzC,EAA2D,kB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OAAf,CAAb;;AAKAiD,aAAO4F,SAAP,GAAmB5F,OAAO6F,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAO7F,MAAP;AACA;;;;KAxkBoCzH,gB;;;;AA8lBtCoB,oBAAiBmM,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\tif (s.datapoints.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\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\t\t\tconst linkSrv = this.$injector.get('linkSrv');\n\t\t\tconst info = linkSrv.getPanelLinkAnchorInfo(link, this.panel.scopedVars);\n\t\t\tthis.uri = info.href;\n\t\t\tthis.target = info.target;\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/module.html b/src/module.html index b882d6fa..cf5ab796 100644 --- a/src/module.html +++ b/src/module.html @@ -27,12 +27,12 @@

- + {{ ctrl.panel.displayName | interpolateTemplateVars:this }} - {{ ctrl.panel.displayName | interpolateTemplateVars:this }} - + {{ ctrl.panel.displayName | interpolateTemplateVars:this }} +

diff --git a/src/status_ctrl.js b/src/status_ctrl.js index d8209940..68a79f5b 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -534,18 +534,10 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { parseUri() { if (this.panel.links && this.panel.links.length > 0) { let link = this.panel.links[0]; - - if (link.type == "absolute") { - this.uri = link.url; - } else { - this.uri = 'dashboard/' + link.dashUri; - } - - if (link.params) { - this.uri += "?" + link.params; - } - - this.targetBlank = link.targetBlank; + const linkSrv = this.$injector.get('linkSrv'); + const info = linkSrv.getPanelLinkAnchorInfo(link, this.panel.scopedVars); + this.uri = info.href; + this.target = info.target; } else { this.uri = undefined; }