From 24289f88e09fd866b44c41344a43c6d6aa6c7374 Mon Sep 17 00:00:00 2001 From: Yochpaz Yehonatan Date: Tue, 14 Mar 2017 19:28:08 +0200 Subject: [PATCH] * change the "Disable State" phrase to "Disable Criteria" --- README.md | 2 +- dist/README.md | 2 +- dist/editor.html | 8 ++++---- dist/plugin.json | 4 ++-- dist/status_ctrl.js | 4 ++-- dist/status_ctrl.js.map | 2 +- src/editor.html | 8 ++++---- src/status_ctrl.js | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0d977aaf..7d0bcfd5 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ You can also repeat the panel on a template if you have multiple instances that 1. For severity disply, select the `Threshold` option type under `Status Type`. Enter the `Warning` and `Critical` thresholds for each of your queries. * If you want the result to always be displayed with it's value (regardless to the thresholds), check the box titled `Show Value` * The plugin automatically detects if higher values are good, or lower values are good by checking which threshold is higher/lower. i.e. if in your metric higher values are better, put a lower value in the "critical" threshold than the "warning" threshold. - 2. For disable display, select the "Disable State" option type under "Status Type". Enter the `Disable Value` for each of your queries. + 2. For disable display, select the `Disable Criteria` option type under "Status Type". Enter the `Disable Value` for each of your queries. 3. For annotation, select the "Annotation" option type under "Status Type". The alias + the value of the metric will be shown on the top left. 4. If the query returns multiple values, choose the type of aggregation you want to be used (`None` will just use the most first result) diff --git a/dist/README.md b/dist/README.md index 0d977aaf..7d0bcfd5 100644 --- a/dist/README.md +++ b/dist/README.md @@ -32,7 +32,7 @@ You can also repeat the panel on a template if you have multiple instances that 1. For severity disply, select the `Threshold` option type under `Status Type`. Enter the `Warning` and `Critical` thresholds for each of your queries. * If you want the result to always be displayed with it's value (regardless to the thresholds), check the box titled `Show Value` * The plugin automatically detects if higher values are good, or lower values are good by checking which threshold is higher/lower. i.e. if in your metric higher values are better, put a lower value in the "critical" threshold than the "warning" threshold. - 2. For disable display, select the "Disable State" option type under "Status Type". Enter the `Disable Value` for each of your queries. + 2. For disable display, select the `Disable Criteria` option type under "Status Type". Enter the `Disable Value` for each of your queries. 3. For annotation, select the "Annotation" option type under "Status Type". The alias + the value of the metric will be shown on the top left. 4. If the query returns multiple values, choose the type of aggregation you want to be used (`None` will just use the most first result) diff --git a/dist/editor.html b/dist/editor.html index 680ffb9f..3f961162 100644 --- a/dist/editor.html +++ b/dist/editor.html @@ -92,7 +92,7 @@
Metric display type
The type of data to show to the panel
Note: 'Threshold' will select the first value.

Threshold - Change background color of the panel if got warning / error + show the alias of the problematic metrics.
- Disabled state - Change background color of the panel if disabled.
+ Disable Criteria - Change background color of the panel if disabled.
Annotation - Show extra info on the panel on top right. @@ -137,10 +137,10 @@
Threshold
-
-
Disable State
+
+
Disable Criteria
- +
Disable Value diff --git a/dist/plugin.json b/dist/plugin.json index c1c0abce..0d94275e 100644 --- a/dist/plugin.json +++ b/dist/plugin.json @@ -23,8 +23,8 @@ {"name": "Warning State", "path": "img/warning.png"}, {"name": "Critical State", "path": "img/error.png"} ], - "version": "1.0.1", - "updated": "2017-2-6" + "version": "1.0.2", + "updated": "2017-3-14" }, "dependencies": { diff --git a/dist/status_ctrl.js b/dist/status_ctrl.js index 68d01139..d660fc59 100644 --- a/dist/status_ctrl.js +++ b/dist/status_ctrl.js @@ -76,7 +76,7 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi //this.log = $log.debug; _this.filter = $filter; - _this.displayTypes = ['Threshold', 'Disable State', 'Annotation']; + _this.displayTypes = ['Threshold', 'Disable Criteria', 'Annotation']; _this.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg']; /** Bind events to functions **/ @@ -191,7 +191,7 @@ System.register(["app/plugins/sdk", "app/plugins/panel/graph/legend", "app/plugi if (target.displayType == "Threshold") { _this3.handleThresholdStatus(s, target); - } else if (target.displayType == "Disable State") { + } else if (target.displayType == "Disable Criteria") { _this3.handleDisabledStatus(s, target); } else if (target.displayType == "Annotation") { _this3.handleAnnotations(s, target); diff --git a/dist/status_ctrl.js.map b/dist/status_ctrl.js.map index 2bc5c823..96ce5de8 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","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","filter","displayTypes","aggregations","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","measurements","panel","targets","duplicates","measurement","hide","each","m","res","alias","target","length","addEditorTab","$panelContainer","find","css","$panelContoller","height","setElementHeight","clusterName","displayName","replace","RegExp","namePrefix","crit","warn","display","disabled","annotation","series","s","url","value","aggregation","max","datapoints","point","stats","min","total","avg","display_value","displayType","handleThresholdStatus","handleDisabledStatus","handleAnnotations","handle_css_display","parseUri","thresholds","parseThresholds","inverted","push","disabledValue","removeClass","addClass","undefined","isGrayOnNoData","links","uri","dashUri","params","dataList","map","seriesHandler","render","seriesData","flotpairs","getFlotPairs","scope","elem","attrs","ctrl","metricOptions","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AAGDC,I;;AACAC,a;;AACAC,a;;;;;;;;;;;;;;;;;;;;;+BAIMC,gB;;;AACZ;AACA,8BAAYC,MAAZ,EAAoBC,SAApB,EAA+BC,IAA/B,EAAqCC,OAArC,EAA8CC,cAA9C,EAA8D;AAAA;;AAAA,qIACvDJ,MADuD,EAC/CC,SAD+C;;AAG7D;AACA,WAAKI,MAAL,GAAcF,OAAd;;AAEA,WAAKG,YAAL,GAAoB,CAAC,WAAD,EAAc,eAAd,EAA+B,YAA/B,CAApB;AACA,WAAKC,YAAL,GAAoB,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,KAAzB,EAAgC,KAAhC,EAAuC,KAAvC,CAApB;;AAEA;AACA,WAAKC,MAAL,CAAYC,EAAZ,CAAe,QAAf,EAAyB,MAAKC,QAAL,CAAcC,IAAd,O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Q,EAAU;AACxB,WAAKhC,MAAL,GAAcgC,SAASC,GAAT,CAAa,KAAKC,aAAL,CAAmBpE,IAAnB,CAAwB,IAAxB,CAAb,CAAd;;AAEA,WAAKqE,MAAL;AACA;;;mCAEa;AACb,WAAKxC,IAAL,GAAY,EAAZ;AACA,WAAKC,IAAL,GAAY,EAAZ;AACA;;;mCAEawC,U,EAAY;AACzB,UAAIpC,SAAS,IAAIhD,UAAJ,CAAe;AAC3BsD,mBAAY8B,WAAW9B,UADI;AAE3B1B,cAAOwD,WAAWvD;AAFS,OAAf,CAAb;;AAKAmB,aAAOqC,SAAP,GAAmBrC,OAAOsC,YAAP,CAAoB,WAApB,CAAnB;;AAEA,aAAOtC,MAAP;AACA;;;0BAEIuC,K,EAAOC,I,EAAMC,K,EAAOC,I,EAAM;AAC9B,WAAK1D,eAAL,GAAuBwD,KAAKvD,IAAL,CAAU,kBAAV,CAAvB;AACA,WAAKE,eAAL,GAAuBuD,IAAvB;AACA;;;qCAlCsBC,a,EAAe;AACrC,UAAIhE,MAAM,EAAV;;AAEAA,UAAIiB,IAAJ,GAAW+C,cAAc/C,IAAzB;AACAjB,UAAIgB,IAAJ,GAAWgD,cAAchD,IAAzB;;AAEA,aAAOhB,GAAP;AACA;;;;KAlMoC7B,gB;;;;AAgOtCI,oBAAiB0F,WAAjB,GAA+B,aAA/B","file":"status_ctrl.js","sourcesContent":["import {MetricsPanelCtrl} from \"app/plugins/sdk\";\nimport \"app/plugins/panel/graph/legend\";\nimport \"app/plugins/panel/graph/series_overrides_ctrl\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\"\n\nimport './css/status_panel.css!';\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.displayTypes = ['Threshold', 'Disable State', 'Annotation'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];\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\t}\n\n\tpostRefresh() {\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}\n\n\tsetElementHeight() {\n\t\tthis.$panelContainer.find('.status-panel').css('height', this.$panelContoller.height + 'px');\n\t}\n\n\tonRender() {\n\t\tthis.setElementHeight();\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\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.display = [];\n\t\tthis.disabled = [];\n\t\tthis.annotation = [];\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\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 '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.displayType == \"Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.displayType == \"Disable State\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.displayType == \"Annotation\") {\n\t\t\t\tthis.handleAnnotations(s, target);\n\t\t\t}\n\t\t});\n\n\t\tthis.handle_css_display();\n\t\tthis.parseUri();\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\t\tseries.display = target.display;\n\n\t\tif (!series.inverted) {\n\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\tthis.crit.push(series);\n\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\tthis.warn.push(series);\n\t\t\t} else if (series.display) {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\tthis.crit.push(series);\n\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\tthis.warn.push(series);\n\t\t\t} else if (series.display) {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\thandleDisabledStatus(series, target) {\n\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\thandleAnnotations(series, target) {\n\t\tthis.annotation.push(series);\n\t}\n\n\thandle_css_display() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\n\t\tif(this.duplicates) {\n\t\t\tthis.$panelContainer.addClass('error-state');\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.$panelContainer.addClass('disabled-state');\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.$panelContainer.addClass('error-state');\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.$panelContainer.addClass('warn-state');\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.$panelContainer.addClass('no-data-state');\n\t\t} else {\n\t\t\tthis.$panelContainer.addClass('ok-state');\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tthis.uri = this.panel.links[0].dashUri + \"?\" + this.panel.links[0].params;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tres.warn = metricOptions.warn;\n\t\tres.crit = metricOptions.crit;\n\n\t\treturn res;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(this.seriesHandler.bind(this));\n\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tseriesHandler(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\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\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","StatusPluginCtrl","$scope","$injector","$log","$filter","annotationsSrv","filter","displayTypes","aggregations","events","on","onRender","bind","postRefresh","onDataError","onDataReceived","onInitEditMode","measurements","panel","targets","duplicates","measurement","hide","each","m","res","alias","target","length","addEditorTab","$panelContainer","find","css","$panelContoller","height","setElementHeight","clusterName","displayName","replace","RegExp","namePrefix","crit","warn","display","disabled","annotation","series","s","url","value","aggregation","max","datapoints","point","stats","min","total","avg","display_value","displayType","handleThresholdStatus","handleDisabledStatus","handleAnnotations","handle_css_display","parseUri","thresholds","parseThresholds","inverted","push","disabledValue","removeClass","addClass","undefined","isGrayOnNoData","links","uri","dashUri","params","dataList","map","seriesHandler","render","seriesData","flotpairs","getFlotPairs","scope","elem","attrs","ctrl","metricOptions","templateUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAQA,mB,kBAAAA,gB;;AAGDC,I;;AACAC,a;;AACAC,a;;;;;;;;;;;;;;;;;;;;;+BAIMC,gB;;;AACZ;AACA,8BAAYC,MAAZ,EAAoBC,SAApB,EAA+BC,IAA/B,EAAqCC,OAArC,EAA8CC,cAA9C,EAA8D;AAAA;;AAAA,qIACvDJ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";\nimport \"app/plugins/panel/graph/legend\";\nimport \"app/plugins/panel/graph/series_overrides_ctrl\";\nimport _ from \"lodash\";\nimport TimeSeries from \"app/core/time_series2\";\nimport coreModule from \"app/core/core_module\"\n\nimport './css/status_panel.css!';\n\nexport class StatusPluginCtrl extends MetricsPanelCtrl {\n\t/** @ngInject */\n\tconstructor($scope, $injector, $log, $filter, annotationsSrv) {\n\t\tsuper($scope, $injector);\n\n\t\t//this.log = $log.debug;\n\t\tthis.filter = $filter;\n\n\t\tthis.displayTypes = ['Threshold', 'Disable Criteria', 'Annotation'];\n\t\tthis.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg'];\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\t}\n\n\tpostRefresh() {\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}\n\n\tsetElementHeight() {\n\t\tthis.$panelContainer.find('.status-panel').css('height', this.$panelContoller.height + 'px');\n\t}\n\n\tonRender() {\n\t\tthis.setElementHeight();\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\n\n\t\tlet targets = this.panel.targets;\n\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t\tthis.display = [];\n\t\tthis.disabled = [];\n\t\tthis.annotation = [];\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\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 '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.displayType == \"Threshold\") {\n\t\t\t\tthis.handleThresholdStatus(s, target);\n\t\t\t}\n\t\t\telse if (target.displayType == \"Disable Criteria\") {\n\t\t\t\tthis.handleDisabledStatus(s,target);\n\t\t\t}\n\t\t\telse if (target.displayType == \"Annotation\") {\n\t\t\t\tthis.handleAnnotations(s, target);\n\t\t\t}\n\t\t});\n\n\t\tthis.handle_css_display();\n\t\tthis.parseUri();\n\t}\n\n\thandleThresholdStatus(series, target) {\n\t\tseries.thresholds = StatusPluginCtrl.parseThresholds(target);\n\t\tseries.inverted = series.thresholds.crit < series.thresholds.warn;\n\t\tseries.display = target.display;\n\n\t\tif (!series.inverted) {\n\t\t\tif (series.display_value >= series.thresholds.crit) {\n\t\t\t\tthis.crit.push(series);\n\t\t\t} else if (series.display_value >= series.thresholds.warn) {\n\t\t\t\tthis.warn.push(series);\n\t\t\t} else if (series.display) {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t} else {\n\t\t\tif (series.display_value <= series.thresholds.crit) {\n\t\t\t\tthis.crit.push(series);\n\t\t\t} else if (series.display_value <= series.thresholds.warn) {\n\t\t\t\tthis.warn.push(series);\n\t\t\t} else if (series.display) {\n\t\t\t\tthis.display.push(series);\n\t\t\t}\n\t\t}\n\t}\n\n\thandleDisabledStatus(series, target) {\n\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\thandleAnnotations(series, target) {\n\t\tthis.annotation.push(series);\n\t}\n\n\thandle_css_display() {\n\t\tthis.$panelContainer.removeClass('error-state warn-state disabled-state ok-state no-data-state');\n\n\t\tif(this.duplicates) {\n\t\t\tthis.$panelContainer.addClass('error-state');\n\t\t} else if (this.disabled.length > 0) {\n\t\t\tthis.$panelContainer.addClass('disabled-state');\n\t\t} else if (this.crit.length > 0) {\n\t\t\tthis.$panelContainer.addClass('error-state');\n\t\t} else if (this.warn.length > 0) {\n\t\t\tthis.$panelContainer.addClass('warn-state');\n\t\t} else if((this.series == undefined || this.series.length == 0) && this.panel.isGrayOnNoData) {\n\t\t\tthis.$panelContainer.addClass('no-data-state');\n\t\t} else {\n\t\t\tthis.$panelContainer.addClass('ok-state');\n\t\t}\n\t}\n\n\tparseUri() {\n\t\tif (this.panel.links && this.panel.links.length > 0) {\n\t\t\tthis.uri = this.panel.links[0].dashUri + \"?\" + this.panel.links[0].params;\n\t\t} else {\n\t\t\tthis.uri = undefined;\n\t\t}\n\t}\n\n\tstatic parseThresholds(metricOptions) {\n\t\tlet res = {};\n\n\t\tres.warn = metricOptions.warn;\n\t\tres.crit = metricOptions.crit;\n\n\t\treturn res;\n\t}\n\n\tonDataReceived(dataList) {\n\t\tthis.series = dataList.map(this.seriesHandler.bind(this));\n\n\t\tthis.render();\n\t}\n\n\tonDataError() {\n\t\tthis.crit = [];\n\t\tthis.warn = [];\n\t}\n\n\tseriesHandler(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\tlink(scope, elem, attrs, ctrl) {\n\t\tthis.$panelContainer = elem.find('.panel-container');\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 680ffb9f..3f961162 100644 --- a/src/editor.html +++ b/src/editor.html @@ -92,7 +92,7 @@
Metric display type
The type of data to show to the panel
Note: 'Threshold' will select the first value.

Threshold - Change background color of the panel if got warning / error + show the alias of the problematic metrics.
- Disabled state - Change background color of the panel if disabled.
+ Disable Criteria - Change background color of the panel if disabled.
Annotation - Show extra info on the panel on top right.
@@ -137,10 +137,10 @@
Threshold
-
-
Disable State
+
+
Disable Criteria
- +
Disable Value diff --git a/src/status_ctrl.js b/src/status_ctrl.js index 123f177b..4c46c742 100644 --- a/src/status_ctrl.js +++ b/src/status_ctrl.js @@ -15,7 +15,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { //this.log = $log.debug; this.filter = $filter; - this.displayTypes = ['Threshold', 'Disable State', 'Annotation']; + this.displayTypes = ['Threshold', 'Disable Criteria', 'Annotation']; this.aggregations = ['Last', 'First', 'Max', 'Min', 'Sum', 'Avg']; /** Bind events to functions **/ @@ -119,7 +119,7 @@ export class StatusPluginCtrl extends MetricsPanelCtrl { if (target.displayType == "Threshold") { this.handleThresholdStatus(s, target); } - else if (target.displayType == "Disable State") { + else if (target.displayType == "Disable Criteria") { this.handleDisabledStatus(s,target); } else if (target.displayType == "Annotation") {