From 1cce5fdfe11176e3969586ef0af819dad25fa453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 16 Apr 2016 12:03:29 -0400 Subject: [PATCH 01/25] feat(templating): polished variable template edit forms, added new template variable type: datasource --- public/app/core/components/info_popover.ts | 7 +- public/app/features/templating/editorCtrl.js | 20 +++ .../features/templating/partials/editor.html | 147 +++++++++++------- .../features/templating/templateValuesSrv.js | 35 +++++ public/sass/base/_code.scss | 6 +- public/test/core/utils/emitter_specs.ts | 2 +- public/test/specs/templateValuesSrv-specs.js | 23 ++- 7 files changed, 171 insertions(+), 69 deletions(-) diff --git a/public/app/core/components/info_popover.ts b/public/app/core/components/info_popover.ts index 8bc28b8a57d..d370aab9d6d 100644 --- a/public/app/core/components/info_popover.ts +++ b/public/app/core/components/info_popover.ts @@ -11,12 +11,6 @@ export function infoPopover() { template: '', transclude: true, link: function(scope, elem, attrs, ctrl, transclude) { - // var inputElem = elem.prev(); - // if (inputElem.length === 0) { - // console.log('Failed to find input element for popover'); - // return; - // } - var offset = attrs.offset || '0 -10px'; var position = attrs.position || 'right middle'; var classes = 'drop-help drop-hide-out-of-bounds'; @@ -44,6 +38,7 @@ export function infoPopover() { position: position, classes: classes, openOn: openOn, + hoverOpenDelay: 400, tetherOptions: { offset: offset } diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index 291915ee99f..9ec4f57eb20 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -20,6 +20,13 @@ function (angular, _) { multi: false, }; + $scope.variableTypes = [ + {value: "query", text: "Query"}, + {value: "interval", text: "Interval"}, + {value: "datasource", text: "Datasource"}, + {value: "custom", text: "Custom"}, + ]; + $scope.refreshOptions = [ {value: 0, text: "Never"}, {value: 1, text: "On Dashboard Load"}, @@ -35,10 +42,16 @@ function (angular, _) { $scope.init = function() { $scope.mode = 'list'; + $scope.datasourceTypes = {}; $scope.datasources = _.filter(datasourceSrv.getMetricSources(), function(ds) { + $scope.datasourceTypes[ds.meta.id] = {text: ds.meta.name, value: ds.meta.id}; return !ds.meta.builtIn; }); + $scope.datasourceTypes = _.map($scope.datasourceTypes, function(value) { + return value; + }); + $scope.variables = templateSrv.variables; $scope.reset(); @@ -132,9 +145,16 @@ function (angular, _) { if ($scope.current.type === 'interval') { $scope.current.query = '1m,10m,30m,1h,6h,12h,1d,7d,14d,30d'; } + if ($scope.current.type === 'query') { $scope.current.query = ''; } + + if ($scope.current.type === 'datasource') { + $scope.current.query = $scope.datasourceTypes[0].value; + $scope.current.regex = ''; + $scope.current.refresh = 1; + } }; $scope.removeVariable = function(variable) { diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index c7dfe61f2b4..3e8ecb4f3c5 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -75,39 +75,49 @@
- Name - -
-
- Type -
- -
+ Name +
- Data source -
- + + Type + +
+
Query
+
Variable values are fetched from a metric names query to a data source
+
Interval
+
Timespan variable type
+
Datasource
+
Dynamically switch data sources using this type of variable
+
Custom
+
Define variable values manually
+
+ Templating docs +
+
+
+
-
+
- Label - + Label +
-
- Hide -
- +
+ Hide +
+
-
Value Options
+
Interval Options
+
Values @@ -135,6 +145,7 @@
+
Custom Options
Values seperated by comma @@ -142,43 +153,69 @@
-
- Query - - - - - - - - - - - - - - - - - - -
-
- - Regex - Optional, if you want to extract part of a series name or metric node segment - - -
-
- Refresh - - When to update the values of this variable, will slow down dashboard load / time change -
-
+
Query Options
-
-
Selection Options
+
+
+ Data source +
+ +
+
+
+ + Refresh + + When to update the values of this variable. + + +
+ +
+
+
+
+ Query + +
+
+ + Regex + + Optional, if you want to extract part of a series name or metric node segment. + + + +
+
+ +
+
Datasource Options
+ +
+ +
+ +
+
+ +
+ + +
+
+ +
+
Selection Options
{ expect(sub2Called).to.be(true); }); - it.only('should handle errors', () => { + it('should handle errors', () => { var events = new Emitter(); var sub1Called = 0; var sub2Called = 0; diff --git a/public/test/specs/templateValuesSrv-specs.js b/public/test/specs/templateValuesSrv-specs.js index d81ce4fd059..af7da0b19cb 100644 --- a/public/test/specs/templateValuesSrv-specs.js +++ b/public/test/specs/templateValuesSrv-specs.js @@ -92,6 +92,7 @@ define([ var ds = {}; ds.metricFindQuery = sinon.stub().returns(ctx.$q.when(scenario.queryResult)); ctx.datasourceSrv.get = sinon.stub().returns(ctx.$q.when(ds)); + ctx.datasourceSrv.getMetricSources = sinon.stub().returns(scenario.metricSources); ctx.service.updateOptions(scenario.variable); ctx.$rootScope.$digest(); @@ -137,7 +138,6 @@ define([ }); }); - describeUpdateVariable('interval variable with auto', function(scenario) { scenario.setup(function() { scenario.variable = { type: 'interval', query: '1s,2h,5h,1d', name: 'test', auto: true, auto_count: 10 }; @@ -237,7 +237,7 @@ define([ }); }); - describeUpdateVariable('regex pattern without slashes', function(scenario) { + describeUpdateVariable('regex pattern without slashes', function(scenario) { scenario.setup(function() { scenario.variable = { type: 'query', query: 'apps.*', name: 'test' }; scenario.variable.regex = 'backend_01'; @@ -284,6 +284,23 @@ define([ }); }); - }); + describeUpdateVariable('datasource variable with regex filter', function(scenario) { + scenario.setup(function() { + scenario.variable = {type: 'datasource', query: 'graphite', name: 'test', current: {}, regex: '/pee$/' }; + scenario.metricSources = [ + {name: 'backend1', meta: {id: 'influx'}}, + {name: 'backend2_pee', meta: {id: 'graphite'}}, + {name: 'backend3', meta: {id: 'graphite'}}, + {name: 'backend4_pee', meta: {id: 'graphite'}}, + ]; + }); + it('should set only contain graphite ds and filtered using regex', function() { + expect(scenario.variable.options.length).to.be(2); + expect(scenario.variable.options[0].value).to.be('backend2_pee'); + expect(scenario.variable.options[1].value).to.be('backend4_pee'); + }); + }); + + }); }); From 13471ae2c4887e881238609e84fddd91b3e2c56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 16 Apr 2016 13:43:16 -0400 Subject: [PATCH 02/25] feat(templating): templated ds progress --- public/app/core/services/datasource_srv.js | 85 ++++++++++++------- .../app/features/panel/metrics_panel_ctrl.ts | 8 ++ .../features/templating/templateValuesSrv.js | 2 +- public/app/partials/metrics.html | 2 +- 4 files changed, 66 insertions(+), 31 deletions(-) diff --git a/public/app/core/services/datasource_srv.js b/public/app/core/services/datasource_srv.js index 07e3f004d45..e5fe9627bcc 100644 --- a/public/app/core/services/datasource_srv.js +++ b/public/app/core/services/datasource_srv.js @@ -7,36 +7,11 @@ define([ function (angular, _, coreModule, config) { 'use strict'; - coreModule.default.service('datasourceSrv', function($q, $injector, $rootScope) { + coreModule.default.service('datasourceSrv', function($q, $injector, $rootScope, templateSrv) { var self = this; this.init = function() { this.datasources = {}; - this.metricSources = []; - this.annotationSources = []; - - _.each(config.datasources, function(value, key) { - if (value.meta && value.meta.metrics) { - self.metricSources.push({ - value: key === config.defaultDatasource ? null : key, - name: key, - meta: value.meta, - }); - } - if (value.meta && value.meta.annotations) { - self.annotationSources.push(value); - } - }); - - this.metricSources.sort(function(a, b) { - if (a.meta.builtIn || a.name > b.name) { - return 1; - } - if (a.name < b.name) { - return -1; - } - return 0; - }); }; this.get = function(name) { @@ -44,6 +19,8 @@ function (angular, _, coreModule, config) { return this.get(config.defaultDatasource); } + name = templateSrv.replace(name); + if (this.datasources[name]) { return $q.when(this.datasources[name]); } @@ -89,11 +66,61 @@ function (angular, _, coreModule, config) { }; this.getAnnotationSources = function() { - return this.annotationSources; + return _.reduce(config.datasources, function(memo, key, value) { + + if (value.meta && value.meta.annotations) { + memo.push(value); + } + + return memo; + }, []); }; - this.getMetricSources = function() { - return this.metricSources; + this.getMetricSources = function(options) { + var metricSources = []; + + _.each(config.datasources, function(value, key) { + if (value.meta && value.meta.metrics) { + metricSources.push({ + value: key === config.defaultDatasource ? null : key, + name: key, + meta: value.meta, + }); + } + }); + + if (!options || !options.skipVariables) { + // look for data source variables + for (var i = 0; i < templateSrv.variables.length; i++) { + var variable = templateSrv.variables[i]; + if (variable.type !== 'datasource') { + continue; + } + + var first = variable.current.value; + var ds = config.datasources[first]; + + if (ds) { + metricSources.push({ + name: '[[' + variable.name + ']]', + value: '[[' + variable.name + ']]', + meta: ds.meta, + }); + } + } + } + + metricSources.sort(function(a, b) { + if (a.meta.builtIn || a.name > b.name) { + return 1; + } + if (a.name < b.name) { + return -1; + } + return 0; + }); + + return metricSources; }; this.init(); diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index e8c16fd9ab7..ea6a49a753c 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -15,6 +15,7 @@ class MetricsPanelCtrl extends PanelCtrl { error: boolean; loading: boolean; datasource: any; + datasourceName: any; $q: any; $timeout: any; datasourceSrv: any; @@ -53,6 +54,12 @@ class MetricsPanelCtrl extends PanelCtrl { this.addEditorTab('Metrics', 'public/app/partials/metrics.html'); this.addEditorTab('Time range', 'public/app/features/panel/partials/panelTime.html'); this.datasources = this.datasourceSrv.getMetricSources(); + + // find current + var current = _.findWhere(this.datasources, {value: this.panel.datasource}); + if (current) { + this.datasourceName = current.name; + } } private onMetricsPanelRefresh() { @@ -246,6 +253,7 @@ class MetricsPanelCtrl extends PanelCtrl { } this.panel.datasource = datasource.value; + this.datasourceName = datasource.name; this.datasource = null; this.refresh(); } diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 8cbaf306a11..97c3e9a4738 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -179,7 +179,7 @@ function (angular, _, kbn) { this.updateDataSourceVariable = function(variable) { var options = []; - var sources = datasourceSrv.getMetricSources(); + var sources = datasourceSrv.getMetricSources({skipVariables: true}); var regex; if (variable.regex) { diff --git a/public/app/partials/metrics.html b/public/app/partials/metrics.html index 7297d415c25..795183230cc 100644 --- a/public/app/partials/metrics.html +++ b/public/app/partials/metrics.html @@ -42,7 +42,7 @@
- -
-
-
-
    -
  • - Value to text mapping -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • - -
  • - - - -
  • - -
-
-
-
-
diff --git a/public/app/plugins/panel/singlestat/mappings.html b/public/app/plugins/panel/singlestat/mappings.html new file mode 100644 index 00000000000..eab9b0030b6 --- /dev/null +++ b/public/app/plugins/panel/singlestat/mappings.html @@ -0,0 +1,84 @@ +
+
+
+
    +
  • + Type +
  • +
  • + +
  • +
+
+
+
+
+
+
+
+
    +
  • + Value to text mapping +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + +
  • + + + +
  • + +
+
+
+
+
+
+
Set range mappings
+
+
+
+
    +
  • + +
  • +
  • + From +
  • +
  • + +
  • +
  • + To +
  • +
  • + +
  • +
  • + Text +
  • +
  • + +
  • +
+
+
+
+ + +
+
diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index 8033e73468d..84e89b48bc6 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -34,6 +34,14 @@ class SingleStatCtrl extends MetricsPanelCtrl { valueMaps: [ { value: 'null', op: '=', text: 'N/A' } ], + mappingTypes: [ + {name: 'value to text', value: 1}, + {name: 'range to text', value: 2}, + ], + rangeMaps: [ + { from: 'null', to: 'null', text: 'N/A' } + ], + mappingType: 1, nullPointMode: 'connected', valueName: 'avg', prefixFontSize: '50%', @@ -71,6 +79,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { onInitEditMode() { this.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; this.addEditorTab('Options', 'public/app/plugins/panel/singlestat/editor.html', 2); + this.addEditorTab('Mappings', 'public/app/plugins/panel/singlestat/mappings.html', 3); this.unitFormats = kbn.getUnitFormats(); } @@ -195,23 +204,45 @@ class SingleStatCtrl extends MetricsPanelCtrl { } } - // check value to text mappings - for (var i = 0; i < this.panel.valueMaps.length; i++) { - var map = this.panel.valueMaps[i]; - // special null case - if (map.value === 'null') { - if (data.value === null || data.value === void 0) { + // check value to text mappings if its enabled + if (this.panel.mappingType === 1) { + for (var i = 0; i < this.panel.valueMaps.length; i++) { + var map = this.panel.valueMaps[i]; + // special null case + if (map.value === 'null') { + if (data.value === null || data.value === void 0) { + data.valueFormated = map.text; + return; + } + continue; + } + + // value/number to text mapping + var value = parseFloat(map.value); + if (value === data.valueRounded) { data.valueFormated = map.text; return; } - continue; } + } else if (this.panel.mappingType === 2) { + for (var i = 0; i < this.panel.rangeMaps.length; i++) { + var map = this.panel.rangeMaps[i]; + // special null case + if (map.from === 'null' && map.to === 'null') { + if (data.value === null || data.value === void 0) { + data.valueFormated = map.text; + return; + } + continue; + } - // value/number to text mapping - var value = parseFloat(map.value); - if (value === data.valueRounded) { - data.valueFormated = map.text; - return; + // value/number to range mapping + var from = parseFloat(map.from); + var to = parseFloat(map.to); + if (to >= data.valueRounded && from <= data.valueRounded) { + data.valueFormated = map.text; + return; + } } } @@ -230,6 +261,16 @@ class SingleStatCtrl extends MetricsPanelCtrl { this.panel.valueMaps.push({value: '', op: '=', text: '' }); } + removeRangeMap(rangeMap) { + var index = _.indexOf(this.panel.rangeMaps, rangeMap); + this.panel.rangeMaps.splice(index, 1); + this.render(); + }; + + addRangeMap() { + this.panel.rangeMaps.push({from: '', to: '', text: ''}); + } + link(scope, elem, attrs, ctrl) { var $location = this.$location; var linkSrv = this.linkSrv; From 5defc2a3d23190526bdf0475e8aba6895f604ef1 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Sun, 10 Apr 2016 23:21:42 -0700 Subject: [PATCH 04/25] Fixed remove mapping function --- public/app/plugins/panel/singlestat/mappings.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/singlestat/mappings.html b/public/app/plugins/panel/singlestat/mappings.html index eab9b0030b6..5c3d604fa13 100644 --- a/public/app/plugins/panel/singlestat/mappings.html +++ b/public/app/plugins/panel/singlestat/mappings.html @@ -52,7 +52,7 @@
  • - +
  • From From c1cd1fedf42bd7bfdd599816dae0488f643a0533 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 26 Apr 2016 01:54:25 -0700 Subject: [PATCH 05/25] Added relevant tests --- .../singlestat/specs/singlestat-specs.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts index dc85454b64a..3d6c565443b 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts @@ -84,4 +84,29 @@ describe('SingleStatCtrl', function() { expect(ctx.data.valueFormated).to.be('OK'); }); }); + + singleStatScenario('When range to text mapping is specifiedfor first range', function(ctx) { + ctx.setup(function() { + ctx.datapoints = [[41,50]]; + ctx.ctrl.panel.mappingType = 2; + ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; + }); + + it('Should replace value with text OK', function() { + expect(ctx.data.valueFormated).to.be('OK'); + }); + }); + + singleStatScenario('When range to text mapping is specified for other ranges', function(ctx) { + ctx.setup(function() { + ctx.datapoints = [[65,75]]; + ctx.ctrl.panel.mappingType = 2; + ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; + }); + + it('Should replace value with text NOT OK', function() { + expect(ctx.data.valueFormated).to.be('NOT OK'); + }); + }); + }); From 89ea25ca0885768d0d2664724de42cbe308b1969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 28 Apr 2016 18:26:41 +0200 Subject: [PATCH 06/25] feat(templating): minor sort fix --- public/app/features/templating/templateValuesSrv.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index 4cda10ac406..bcb6fe00074 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -288,9 +288,7 @@ function (angular, _, kbn) { options[value] = {text: text, value: value}; } - return _.map(_.keys(options).sort(), function(key) { - return options[key]; - }); + return _.sortBy(options, 'text'); }; this.addAllOption = function(variable) { From c4440eab4c52b035060c4ec870c53bb694f7b8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 28 Apr 2016 19:15:54 +0200 Subject: [PATCH 07/25] fix(dashboard): fixed issue with render event after resize --- public/app/features/panel/panel_ctrl.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 76d348d9b1f..82e19f8681b 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -44,8 +44,8 @@ export class PanelCtrl { this.pluginName = plugin.name; } - $scope.$on("refresh", this.refresh.bind(this)); - $scope.$on("render", this.render.bind(this)); + $scope.$on("refresh", () => this.refresh()); + $scope.$on("render", () => this.render()); $scope.$on("$destroy", () => this.events.emit('panel-teardown')); } From 8b4c7c94b81c92b92102491ea4af8ab7c44d5657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 28 Apr 2016 19:31:43 +0200 Subject: [PATCH 08/25] feat(templating): completed work on templating as data source, closes #816 --- CHANGELOG.md | 1 + public/app/core/services/datasource_srv.js | 4 ++-- public/app/core/services/segment_srv.js | 2 +- public/app/features/templating/templateValuesSrv.js | 7 +++++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00957dc9a8..6b8cd4f7128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Enhancements * **Singlestat**: Support for gauges in singlestat panel. closes [#3688](https://github.com/grafana/grafana/pull/3688) +* **Templating**: Support for data source as variable, closes [#816](https://github.com/grafana/grafana/pull/816) ### Bug fixes * **InfluxDB 0.12**: Fixed issue templating and `show tag values` query only returning tags for first measurement, fixes [#4726](https://github.com/grafana/grafana/issues/4726) diff --git a/public/app/core/services/datasource_srv.js b/public/app/core/services/datasource_srv.js index e5fe9627bcc..2c3a043ac6c 100644 --- a/public/app/core/services/datasource_srv.js +++ b/public/app/core/services/datasource_srv.js @@ -102,8 +102,8 @@ function (angular, _, coreModule, config) { if (ds) { metricSources.push({ - name: '[[' + variable.name + ']]', - value: '[[' + variable.name + ']]', + name: '$' + variable.name, + value: '$' + variable.name, meta: ds.meta, }); } diff --git a/public/app/core/services/segment_srv.js b/public/app/core/services/segment_srv.js index a0b85a8bfb2..d05a2bb011f 100644 --- a/public/app/core/services/segment_srv.js +++ b/public/app/core/services/segment_srv.js @@ -19,7 +19,7 @@ function (angular, _, coreModule) { if (_.isString(options)) { this.value = options; - this.html = $sce.trustAsHtml(this.value); + this.html = $sce.trustAsHtml(templateSrv.highlightVariablesAsHtml(this.value)); return; } diff --git a/public/app/features/templating/templateValuesSrv.js b/public/app/features/templating/templateValuesSrv.js index d5d074f0c6d..dc878c19c08 100644 --- a/public/app/features/templating/templateValuesSrv.js +++ b/public/app/features/templating/templateValuesSrv.js @@ -63,7 +63,9 @@ function (angular, _, kbn) { // determine our dependencies. if (variable.type === "query") { _.forEach(this.variables, function(v) { - if (templateSrv.containsVariable(variable.query, v.name)) { + // both query and datasource can contain variable + if (templateSrv.containsVariable(variable.query, v.name) || + templateSrv.containsVariable(variable.datasource, v.name)) { dependencies.push(self.variableLock[v.name].promise); } }); @@ -149,7 +151,8 @@ function (angular, _, kbn) { if (otherVariable === updatedVariable) { return; } - if (templateSrv.containsVariable(otherVariable.query, updatedVariable.name)) { + if (templateSrv.containsVariable(otherVariable.query, updatedVariable.name) || + templateSrv.containsVariable(otherVariable.datasource, updatedVariable.name)) { return self.updateOptions(otherVariable); } }); From 5372bcc7a2d3f970596f85d095221f9dd490e021 Mon Sep 17 00:00:00 2001 From: Archit Sharma Date: Fri, 29 Apr 2016 10:51:52 +0530 Subject: [PATCH 09/25] fixes #4849 - minor fix for metric-segment-model (agg.field) --- .../plugins/datasource/elasticsearch/partials/bucket_agg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html index 198c8f5636a..4f2225e8cce 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html @@ -6,7 +6,7 @@ - +
From 6b467d5b3ee7f2cdc832857da0cd6e9ecf075d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Apr 2016 08:40:38 +0200 Subject: [PATCH 10/25] fix(): spelling fix in templating editor --- public/app/features/templating/editorCtrl.js | 2 +- public/app/features/templating/partials/editor.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index 9ec4f57eb20..43bda1db05f 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -23,7 +23,7 @@ function (angular, _) { $scope.variableTypes = [ {value: "query", text: "Query"}, {value: "interval", text: "Interval"}, - {value: "datasource", text: "Datasource"}, + {value: "datasource", text: "Data source"}, {value: "custom", text: "Custom"}, ]; diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 3e8ecb4f3c5..fc387ff44cf 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -190,7 +190,7 @@
-
Datasource Options
+
Data source options
From 6c340dcb6532a8bc00a130e4248ed51e94d93ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Apr 2016 11:24:43 +0200 Subject: [PATCH 11/25] docs(): updated download links --- docs/sources/installation/debian.md | 6 +++--- docs/sources/installation/rpm.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 231b4a601ac..bb870f026f3 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -11,7 +11,7 @@ page_keywords: grafana, installation, debian, ubuntu, guide Description | Download ------------ | ------------- Stable .deb for Debian-based Linux | [grafana_2.6.0_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb) -Beta .deb for Debian-based Linux | [grafana_3.0.0-beta51460725904_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta51460725904_amd64.deb) +Beta .deb for Debian-based Linux | [grafana_3.0.0-beta61461918338_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb) ## Install Stable @@ -21,9 +21,9 @@ Beta .deb for Debian-based Linux | [grafana_3.0.0-beta51460725904_amd64.deb](h ## Install 3.0 Beta - $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta51460725904_amd64.deb + $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb $ sudo apt-get install -y adduser libfontconfig - $ sudo dpkg -i grafana_3.0.0-beta51460725904_amd64.deb + $ sudo dpkg -i grafana_3.0.0-beta61461918338_amd64.deb ## APT Repository diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index d981a5c4b2c..f6a7ebb9c3a 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -11,7 +11,7 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- Stable .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.6.0-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm) -Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta51460725904.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta51460725904§.x86_64.rpm) +Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta61461918338.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338§.x86_64.rpm) ## Install Stable Release from package file @@ -34,18 +34,18 @@ Or install manually using `rpm`. You can install Grafana using Yum directly. - $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta51460725904.x86_64.rpm + $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338.x86_64.rpm Or install manually using `rpm`. #### On CentOS / Fedora / Redhat: $ sudo yum install initscripts fontconfig - $ sudo rpm -Uvh grafana-3.0.0-beta51460725904.x86_64.rpm + $ sudo rpm -Uvh grafana-3.0.0-beta61461918338.x86_64.rpm #### On OpenSuse: - $ sudo rpm -i --nodeps grafana-3.0.0-beta51460725904.x86_64.rpm + $ sudo rpm -i --nodeps grafana-3.0.0-beta61461918338.x86_64.rpm ## Install via YUM Repository From e3376136cab2d1f625d853cdcdc30fa260efd8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Apr 2016 23:07:37 +0200 Subject: [PATCH 12/25] fix(css): Fixed max dashboard title width (media query) for large screens, fixes #4859 --- CHANGELOG.md | 7 ++++++- public/sass/_old_responsive.scss | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8cd4f7128..83dbf0895e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -# 3.0.0-beta6 (unreleased) +# 3.0.0-beta7 (unreleased) + +### Bug fixes +* **Dashboard title**: Fixed max dashboard title width (media query) for large screens, fixes [#4859](https://github.com/grafana/grafana/issues/4859) + +# 3.0.0-beta6 (2016-04-29) ### Enhancements * **Singlestat**: Support for gauges in singlestat panel. closes [#3688](https://github.com/grafana/grafana/pull/3688) diff --git a/public/sass/_old_responsive.scss b/public/sass/_old_responsive.scss index a388f9ae26e..a86d65a01e8 100644 --- a/public/sass/_old_responsive.scss +++ b/public/sass/_old_responsive.scss @@ -78,7 +78,7 @@ } } - .dashnav-dashboards-btn a { + .page-dashboard .navbar-page-btn { max-width: none; } .gf-timepicker-nav-btn { From 0d85254a19885bcf6a0c9344e5e4305c2b1eaee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Apr 2016 23:14:39 +0200 Subject: [PATCH 13/25] fix(annotations): Fixed issue with entering annotation edit view, fixes #4857 --- CHANGELOG.md | 1 + public/app/core/services/datasource_srv.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83dbf0895e9..45ab19e8581 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Bug fixes * **Dashboard title**: Fixed max dashboard title width (media query) for large screens, fixes [#4859](https://github.com/grafana/grafana/issues/4859) +* **Annotations**: Fixed issue with entering annotation edit view, fixes [#4857](https://github.com/grafana/grafana/issues/4857) # 3.0.0-beta6 (2016-04-29) diff --git a/public/app/core/services/datasource_srv.js b/public/app/core/services/datasource_srv.js index 2c3a043ac6c..32bc9a39725 100644 --- a/public/app/core/services/datasource_srv.js +++ b/public/app/core/services/datasource_srv.js @@ -66,7 +66,7 @@ function (angular, _, coreModule, config) { }; this.getAnnotationSources = function() { - return _.reduce(config.datasources, function(memo, key, value) { + return _.reduce(config.datasources, function(memo, value) { if (value.meta && value.meta.annotations) { memo.push(value); From 70d03b7a1c40da4f34047d39e8f183f7f5dbf41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 29 Apr 2016 23:20:24 +0200 Subject: [PATCH 14/25] fix(query editor): Fixed issue with removing query for data sources without collapsable query editors, fixes #4856 --- CHANGELOG.md | 3 ++- package.json | 2 +- public/app/features/panel/query_editor_row.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45ab19e8581..874386a2c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ### Bug fixes * **Dashboard title**: Fixed max dashboard title width (media query) for large screens, fixes [#4859](https://github.com/grafana/grafana/issues/4859) -* **Annotations**: Fixed issue with entering annotation edit view, fixes [#4857](https://github.com/grafana/grafana/issues/4857) +* **Annotations**: Fixed issue with entering annotation edit view, fixes [#4857](https://github.com/grafana/grafana/issues/4857) +* **Remove query**: Fixed issue with removing query for data sources without collapsable query editors, fixes [#4856](https://github.com/grafana/grafana/issues/4856) # 3.0.0-beta6 (2016-04-29) diff --git a/package.json b/package.json index e314476f999..5c2b8471626 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "3.0.0-beta6", + "version": "3.0.0-beta7", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" diff --git a/public/app/features/panel/query_editor_row.ts b/public/app/features/panel/query_editor_row.ts index 84cc597e388..76bdd6d8539 100644 --- a/public/app/features/panel/query_editor_row.ts +++ b/public/app/features/panel/query_editor_row.ts @@ -79,7 +79,10 @@ export class QueryRowCtrl { } removeQuery() { - delete this.panelCtrl.__collapsedQueryCache[this.target.refId]; + if (this.panelCtrl.__collapsedQueryCache) { + delete this.panelCtrl.__collapsedQueryCache[this.target.refId]; + } + this.panel.targets = _.without(this.panel.targets, this.target); this.panelCtrl.refresh(); } From 36c583dddf10dbee73693f328cc8457363063d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 30 Apr 2016 16:26:25 +0200 Subject: [PATCH 15/25] fix(graphite): Fixed issue graphite png rendering option, fixes #4864 --- CHANGELOG.md | 1 + public/app/plugins/datasource/graphite/datasource.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 874386a2c33..6797b7186cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * **Dashboard title**: Fixed max dashboard title width (media query) for large screens, fixes [#4859](https://github.com/grafana/grafana/issues/4859) * **Annotations**: Fixed issue with entering annotation edit view, fixes [#4857](https://github.com/grafana/grafana/issues/4857) * **Remove query**: Fixed issue with removing query for data sources without collapsable query editors, fixes [#4856](https://github.com/grafana/grafana/issues/4856) +* **Graphite PNG*: Fixed issue graphite png rendering option, fixes [#4864](https://github.com/grafana/grafana/issues/4864) # 3.0.0-beta6 (2016-04-29) diff --git a/public/app/plugins/datasource/graphite/datasource.ts b/public/app/plugins/datasource/graphite/datasource.ts index 515cd490937..77d44be22e0 100644 --- a/public/app/plugins/datasource/graphite/datasource.ts +++ b/public/app/plugins/datasource/graphite/datasource.ts @@ -31,7 +31,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv } if (options.format === 'png') { - return $q.when(this.url + '/render' + '?' + params.join('&')); + return $q.when({data: this.url + '/render' + '?' + params.join('&')}); } var httpOptions: any = {method: this.render_method, url: '/render'}; From 736ee3ffffd9a25e3038c9bf4f19fc04caffafe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 30 Apr 2016 16:35:42 +0200 Subject: [PATCH 16/25] fix(influxdb): Fixed issue with missing plus group by icon, fixes #4862 --- CHANGELOG.md | 1 + .../plugins/datasource/influxdb/partials/query.editor.html | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6797b7186cd..a33a3814051 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * **Annotations**: Fixed issue with entering annotation edit view, fixes [#4857](https://github.com/grafana/grafana/issues/4857) * **Remove query**: Fixed issue with removing query for data sources without collapsable query editors, fixes [#4856](https://github.com/grafana/grafana/issues/4856) * **Graphite PNG*: Fixed issue graphite png rendering option, fixes [#4864](https://github.com/grafana/grafana/issues/4864) +* **InfluxDB**: Fixed issue missing plus group by iconn, fixes [#4862](https://github.com/grafana/grafana/issues/4862) # 3.0.0-beta6 (2016-04-29) diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index c2efe3093f4..c3a52531ef1 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -70,6 +70,10 @@
+
+ +
+
From cbefd8f8ae091a6910cc49e40b2e0df1ac404249 Mon Sep 17 00:00:00 2001 From: joelanford Date: Sat, 30 Apr 2016 10:40:41 -0400 Subject: [PATCH 17/25] Fixed legend labeling bug in Prometheus datasource (#4858) --- public/app/plugins/datasource/prometheus/datasource.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 21d8c93aa94..ca7ef051ba0 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -63,11 +63,14 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS var end = getPrometheusTime(options.range.to, true); var queries = []; + var activeTargets = []; + options = _.clone(options); _.each(options.targets, _.bind(function(target) { if (!target.expr || target.hide) { return; } + activeTargets.push(target); var query: any = {}; query.expr = templateSrv.replace(target.expr, options.scopedVars, interpolateQueryExpr); @@ -109,7 +112,7 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS delete self.lastErrors.query; _.each(response.data.data.result, function(metricData) { - result.push(self.transformMetricData(metricData, options.targets[index], start, end)); + result.push(self.transformMetricData(metricData, activeTargets[index], start, end)); }); }); From f6d538bb982ae541035585e98b1e75c32dfaf7bb Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Sat, 30 Apr 2016 07:41:24 -0700 Subject: [PATCH 18/25] Bug fix, match tooltip timezone to X-axis timezone (#4855) * Bug fix, match tooltip timezone to X-axis timezone * Small improvement --- public/app/features/dashboard/dashboardSrv.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 89c09ac551a..2e1cd1acbf0 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -184,6 +184,7 @@ function (angular, $, _, moment) { p.formatDate = function(date, format) { date = moment.isMoment(date) ? date : moment(date); format = format || 'YYYY-MM-DD HH:mm:ss'; + this.timezone = this.getTimezone(); return this.timezone === 'browser' ? moment(date).format(format) : From 1b262d33f3945f5914921ad81144d159985c81e3 Mon Sep 17 00:00:00 2001 From: yershalom Date: Sun, 1 May 2016 16:31:01 +0300 Subject: [PATCH 19/25] Added json to file name when exporting dashboard (#4869) --- public/app/features/dashboard/dashnav/dashnav.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/dashboard/dashnav/dashnav.ts b/public/app/features/dashboard/dashnav/dashnav.ts index 2d5b66cb13c..99b113b88c5 100644 --- a/public/app/features/dashboard/dashnav/dashnav.ts +++ b/public/app/features/dashboard/dashnav/dashnav.ts @@ -172,7 +172,7 @@ export class DashNavCtrl { var clone = $scope.dashboard.getSaveModelClone(); var blob = new Blob([angular.toJson(clone, true)], { type: "application/json;charset=utf-8" }); var wnd: any = window; - wnd.saveAs(blob, $scope.dashboard.title + '-' + new Date().getTime()); + wnd.saveAs(blob, $scope.dashboard.title + '-' + new Date().getTime() + '.json'); }; $scope.snapshot = function() { From e6bccc5eff30ba62b6406af9396a05c406ebd0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 May 2016 09:06:57 +0200 Subject: [PATCH 20/25] feat(influxdb): Added new functions moving_average and difference to query editor, closes #4698 --- CHANGELOG.md | 3 +++ docker/blocks/influxdb/fig | 2 +- .../plugins/datasource/influxdb/query_part.ts | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a33a3814051..3cfe94cdf06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ * **Graphite PNG*: Fixed issue graphite png rendering option, fixes [#4864](https://github.com/grafana/grafana/issues/4864) * **InfluxDB**: Fixed issue missing plus group by iconn, fixes [#4862](https://github.com/grafana/grafana/issues/4862) +### Enhancements +* **InfluxDB**: Added new functions moving_average and difference to query editor, closes [#4698](https://github.com/grafana/grafana/issues/4698) + # 3.0.0-beta6 (2016-04-29) ### Enhancements diff --git a/docker/blocks/influxdb/fig b/docker/blocks/influxdb/fig index 931f8a2640a..c537a74b003 100644 --- a/docker/blocks/influxdb/fig +++ b/docker/blocks/influxdb/fig @@ -1,5 +1,5 @@ influxdb: - image: tutum/influxdb:latest + image: tutum/influxdb:0.12 ports: - "2004:2004" - "8083:8083" diff --git a/public/app/plugins/datasource/influxdb/query_part.ts b/public/app/plugins/datasource/influxdb/query_part.ts index 922440bd482..63d70be5653 100644 --- a/public/app/plugins/datasource/influxdb/query_part.ts +++ b/public/app/plugins/datasource/influxdb/query_part.ts @@ -239,6 +239,24 @@ QueryPartDef.register({ renderer: functionRenderer, }); +QueryPartDef.register({ + type: 'difference', + addStrategy: addTransformationStrategy, + category: categories.Transformations, + params: [], + defaultParams: [], + renderer: functionRenderer, +}); + +QueryPartDef.register({ + type: 'moving_average', + addStrategy: addTransformationStrategy, + category: categories.Transformations, + params: [{ name: "window", type: "number", options: [5, 10, 20, 30, 40]}], + defaultParams: [10], + renderer: functionRenderer, +}); + QueryPartDef.register({ type: 'stddev', addStrategy: addTransformationStrategy, From af95993d6db17398f63f4bd45d582be72f88991b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 May 2016 09:54:11 +0200 Subject: [PATCH 21/25] feat(): updated download links --- docs/sources/installation/debian.md | 6 +++--- docs/sources/installation/rpm.md | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index bb870f026f3..cac6a7c92b8 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -11,7 +11,7 @@ page_keywords: grafana, installation, debian, ubuntu, guide Description | Download ------------ | ------------- Stable .deb for Debian-based Linux | [grafana_2.6.0_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb) -Beta .deb for Debian-based Linux | [grafana_3.0.0-beta61461918338_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb) +Beta .deb for Debian-based Linux | [grafana_3.0.0-beta71462173753_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta71462173753_amd64.deb) ## Install Stable @@ -21,9 +21,9 @@ Beta .deb for Debian-based Linux | [grafana_3.0.0-beta61461918338_amd64.deb](h ## Install 3.0 Beta - $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb + $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta71462173753_amd64.deb $ sudo apt-get install -y adduser libfontconfig - $ sudo dpkg -i grafana_3.0.0-beta61461918338_amd64.deb + $ sudo dpkg -i grafana_3.0.0-beta71462173753_amd64.deb ## APT Repository diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index f6a7ebb9c3a..744cafe93db 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -11,7 +11,7 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide Description | Download ------------ | ------------- Stable .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.6.0-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm) -Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta61461918338.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338§.x86_64.rpm) +Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta71462173753.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta71462173753.x86_64.rpm) ## Install Stable Release from package file @@ -34,18 +34,18 @@ Or install manually using `rpm`. You can install Grafana using Yum directly. - $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338.x86_64.rpm + $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta71462173753.x86_64.rpm Or install manually using `rpm`. #### On CentOS / Fedora / Redhat: $ sudo yum install initscripts fontconfig - $ sudo rpm -Uvh grafana-3.0.0-beta61461918338.x86_64.rpm + $ sudo rpm -Uvh grafana-3.0.0-beta71462173753.x86_64.rpm #### On OpenSuse: - $ sudo rpm -i --nodeps grafana-3.0.0-beta61461918338.x86_64.rpm + $ sudo rpm -i --nodeps grafana-3.0.0-beta71462173753.x86_64.rpm ## Install via YUM Repository From 072f51e300110768d88f5a9608a0d871dd9274b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 2 May 2016 10:18:22 +0200 Subject: [PATCH 22/25] fix(): updated changelog --- CHANGELOG.md | 2 +- latest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cfe94cdf06..a67f45e69ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 3.0.0-beta7 (unreleased) +# 3.0.0-beta7 (2016-05-02) ### Bug fixes * **Dashboard title**: Fixed max dashboard title width (media query) for large screens, fixes [#4859](https://github.com/grafana/grafana/issues/4859) diff --git a/latest.json b/latest.json index 9354661781a..8ddb446ec44 100644 --- a/latest.json +++ b/latest.json @@ -1,4 +1,4 @@ { "stable": "2.6.0", - "testing": "3.0.0-beta5" + "testing": "3.0.0-beta7" } From b42064acdb470f324bbb32a45546c0b563f53bb2 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 2 May 2016 10:40:28 +0200 Subject: [PATCH 23/25] tech(singlestat): fixes indentation --- .../plugins/panel/singlestat/mappings.html | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/public/app/plugins/panel/singlestat/mappings.html b/public/app/plugins/panel/singlestat/mappings.html index 5c3d604fa13..749681be2f1 100644 --- a/public/app/plugins/panel/singlestat/mappings.html +++ b/public/app/plugins/panel/singlestat/mappings.html @@ -1,17 +1,17 @@
-
-
-
    -
  • - Type -
  • -
  • - -
  • -
-
-
+
+
+
    +
  • + Type +
  • +
  • + +
  • +
+
+
@@ -46,39 +46,39 @@
-
Set range mappings
-
-
-
-
    -
  • - -
  • -
  • - From -
  • -
  • - -
  • +
    Set range mappings
    +
    +
    +
    +
    • - To -
    • -
    • - -
    • + +
    • - Text -
    • -
    • - -
    • -
    -
    -
    -
    + From + +
  • + +
  • +
  • + To +
  • +
  • + +
  • +
  • + Text +
  • +
  • + +
  • +
+
+
+
- -
+ +
From 91047ffa30bf43c1ec93cf353b766e30b55edcf9 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 2 May 2016 11:39:33 +0200 Subject: [PATCH 24/25] tech(singlestat): convert to gf-form --- .../plugins/panel/singlestat/mappings.html | 126 +++++++----------- public/app/plugins/panel/singlestat/module.ts | 2 +- 2 files changed, 51 insertions(+), 77 deletions(-) diff --git a/public/app/plugins/panel/singlestat/mappings.html b/public/app/plugins/panel/singlestat/mappings.html index 749681be2f1..a1105a159dd 100644 --- a/public/app/plugins/panel/singlestat/mappings.html +++ b/public/app/plugins/panel/singlestat/mappings.html @@ -1,84 +1,58 @@
-
-
-
    -
  • - Type -
  • -
  • - -
  • -
-
-
-
+
+
+ + Type + +
+ +
+
+
-
-
-
    -
  • - Value to text mapping -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • +
    Set valuea mappings
    +
    +
    + + + + + + + + +
    -
  • - - - -
  • - -
-
-
-
+
+ +
+
-
Set range mappings
-
-
-
-
    -
  • - -
  • -
  • - From -
  • -
  • - -
  • -
  • - To -
  • -
  • - -
  • -
  • - Text -
  • -
  • - -
  • -
-
-
-
+
Set range mappings
+
+
+ + + + From + + To + + Text + +
- -
+
+ +
+
diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index 9cf78eff680..e2e529d00c7 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -81,7 +81,7 @@ class SingleStatCtrl extends MetricsPanelCtrl { onInitEditMode() { this.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; this.addEditorTab('Options', 'public/app/plugins/panel/singlestat/editor.html', 2); - this.addEditorTab('Mappings', 'public/app/plugins/panel/singlestat/mappings.html', 3); + this.addEditorTab('Value Mappings', 'public/app/plugins/panel/singlestat/mappings.html', 3); this.unitFormats = kbn.getUnitFormats(); } From 58b91befdedfd5115f07710bc47ed4524bc0cb56 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 2 May 2016 13:15:18 +0200 Subject: [PATCH 25/25] Revert "Merge branch 'utkarshcmu-rangeMaps'" This reverts commit 8f976fd9805b6c5e371bef540fa9b86214672af2, reversing changes made to 072f51e300110768d88f5a9608a0d871dd9274b2. --- .../app/plugins/panel/singlestat/editor.html | 32 +++++++++ .../plugins/panel/singlestat/mappings.html | 58 ----------------- public/app/plugins/panel/singlestat/module.ts | 65 ++++--------------- .../singlestat/specs/singlestat-specs.ts | 25 ------- 4 files changed, 44 insertions(+), 136 deletions(-) delete mode 100644 public/app/plugins/panel/singlestat/mappings.html diff --git a/public/app/plugins/panel/singlestat/editor.html b/public/app/plugins/panel/singlestat/editor.html index 0504277a5e1..fc3c9f69542 100644 --- a/public/app/plugins/panel/singlestat/editor.html +++ b/public/app/plugins/panel/singlestat/editor.html @@ -204,3 +204,35 @@
+ +
+
+
+
    +
  • + Value to text mapping +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + +
  • + + + +
  • + +
+
+
+
+
diff --git a/public/app/plugins/panel/singlestat/mappings.html b/public/app/plugins/panel/singlestat/mappings.html deleted file mode 100644 index a1105a159dd..00000000000 --- a/public/app/plugins/panel/singlestat/mappings.html +++ /dev/null @@ -1,58 +0,0 @@ -
-
-
- - Type - -
- -
-
-
-
-
-
Set valuea mappings
-
-
- - - - - - - - -
- -
- -
-
-
-
-
Set range mappings
-
-
- - - - From - - To - - Text - -
- -
- -
-
-
diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index e2e529d00c7..3c0b9e5342a 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -35,14 +35,6 @@ class SingleStatCtrl extends MetricsPanelCtrl { valueMaps: [ { value: 'null', op: '=', text: 'N/A' } ], - mappingTypes: [ - {name: 'value to text', value: 1}, - {name: 'range to text', value: 2}, - ], - rangeMaps: [ - { from: 'null', to: 'null', text: 'N/A' } - ], - mappingType: 1, nullPointMode: 'connected', valueName: 'avg', prefixFontSize: '50%', @@ -81,7 +73,6 @@ class SingleStatCtrl extends MetricsPanelCtrl { onInitEditMode() { this.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; this.addEditorTab('Options', 'public/app/plugins/panel/singlestat/editor.html', 2); - this.addEditorTab('Value Mappings', 'public/app/plugins/panel/singlestat/mappings.html', 3); this.unitFormats = kbn.getUnitFormats(); } @@ -206,45 +197,23 @@ class SingleStatCtrl extends MetricsPanelCtrl { } } - // check value to text mappings if its enabled - if (this.panel.mappingType === 1) { - for (var i = 0; i < this.panel.valueMaps.length; i++) { - var map = this.panel.valueMaps[i]; - // special null case - if (map.value === 'null') { - if (data.value === null || data.value === void 0) { - data.valueFormated = map.text; - return; - } - continue; - } - - // value/number to text mapping - var value = parseFloat(map.value); - if (value === data.valueRounded) { + // check value to text mappings + for (var i = 0; i < this.panel.valueMaps.length; i++) { + var map = this.panel.valueMaps[i]; + // special null case + if (map.value === 'null') { + if (data.value === null || data.value === void 0) { data.valueFormated = map.text; return; } + continue; } - } else if (this.panel.mappingType === 2) { - for (var i = 0; i < this.panel.rangeMaps.length; i++) { - var map = this.panel.rangeMaps[i]; - // special null case - if (map.from === 'null' && map.to === 'null') { - if (data.value === null || data.value === void 0) { - data.valueFormated = map.text; - return; - } - continue; - } - // value/number to range mapping - var from = parseFloat(map.from); - var to = parseFloat(map.to); - if (to >= data.valueRounded && from <= data.valueRounded) { - data.valueFormated = map.text; - return; - } + // value/number to text mapping + var value = parseFloat(map.value); + if (value === data.valueRounded) { + data.valueFormated = map.text; + return; } } @@ -263,16 +232,6 @@ class SingleStatCtrl extends MetricsPanelCtrl { this.panel.valueMaps.push({value: '', op: '=', text: '' }); } - removeRangeMap(rangeMap) { - var index = _.indexOf(this.panel.rangeMaps, rangeMap); - this.panel.rangeMaps.splice(index, 1); - this.render(); - }; - - addRangeMap() { - this.panel.rangeMaps.push({from: '', to: '', text: ''}); - } - link(scope, elem, attrs, ctrl) { var $location = this.$location; var linkSrv = this.linkSrv; diff --git a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts index 3d6c565443b..dc85454b64a 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts @@ -84,29 +84,4 @@ describe('SingleStatCtrl', function() { expect(ctx.data.valueFormated).to.be('OK'); }); }); - - singleStatScenario('When range to text mapping is specifiedfor first range', function(ctx) { - ctx.setup(function() { - ctx.datapoints = [[41,50]]; - ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; - }); - - it('Should replace value with text OK', function() { - expect(ctx.data.valueFormated).to.be('OK'); - }); - }); - - singleStatScenario('When range to text mapping is specified for other ranges', function(ctx) { - ctx.setup(function() { - ctx.datapoints = [[65,75]]; - ctx.ctrl.panel.mappingType = 2; - ctx.ctrl.panel.rangeMaps = [{from: '10', to: '50', text: 'OK'},{from: '51', to: '100', text: 'NOT OK'}]; - }); - - it('Should replace value with text NOT OK', function() { - expect(ctx.data.valueFormated).to.be('NOT OK'); - }); - }); - });