From de00d18a7e359d81b0f0bb2888fcd6be2a54fa3b Mon Sep 17 00:00:00 2001 From: Mathieu Chataigner Date: Thu, 9 Oct 2014 16:59:29 +0200 Subject: [PATCH 01/16] adding templating in opentsdb graphs --- src/app/services/opentsdb/opentsdbDatasource.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index f6a36c6f035..aba4179babe 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -1,14 +1,15 @@ define([ 'angular', 'lodash', - 'kbn' + 'kbn', + 'moment' ], -function (angular, _, kbn) { +function (angular, _, kbn, moment) { 'use strict'; var module = angular.module('grafana.services'); - module.factory('OpenTSDBDatasource', function($q, $http) { + module.factory('OpenTSDBDatasource', function($q, $http, templateSrv) { function OpenTSDBDatasource(datasource) { this.type = 'opentsdb'; @@ -123,12 +124,12 @@ function (angular, _, kbn) { } var query = { - metric: target.metric, + metric: templateSrv.replace(target.metric), aggregator: "avg" }; if (target.aggregator) { - query.aggregator = target.aggregator; + query.aggregator = templateSrv.replace(target.aggregator); } if (target.shouldComputeRate) { @@ -143,6 +144,11 @@ function (angular, _, kbn) { } query.tags = angular.copy(target.tags); + if(query.tags){ + for(var key in query.tags){ + query.tags[key] = templateSrv.replace(query.tags[key]); + } + } return query; } From 482b31298fb1c5be3e6203202613d420b7f8e46d Mon Sep 17 00:00:00 2001 From: Mathieu Chataigner Date: Thu, 9 Oct 2014 19:12:56 +0200 Subject: [PATCH 02/16] fixing unused var --- src/app/services/opentsdb/opentsdbDatasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index aba4179babe..e70eaf1285b 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -4,7 +4,7 @@ define([ 'kbn', 'moment' ], -function (angular, _, kbn, moment) { +function (angular, _, kbn) { 'use strict'; var module = angular.module('grafana.services'); From 38b71bf386b1281913fae20588c15310f381ef16 Mon Sep 17 00:00:00 2001 From: Raul Simiciuc Date: Mon, 13 Oct 2014 12:36:26 +0100 Subject: [PATCH 03/16] adding counterMax option to opentsdb --- src/app/partials/opentsdb/editor.html | 13 +++++++++++++ src/app/services/opentsdb/opentsdbDatasource.js | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/app/partials/opentsdb/editor.html b/src/app/partials/opentsdb/editor.html index b74b1d7a269..4c12ac09b87 100644 --- a/src/app/partials/opentsdb/editor.html +++ b/src/app/partials/opentsdb/editor.html @@ -89,6 +89,19 @@ ng-model="target.isCounter" ng-change="targetBlur()"> +
  • + Counter Max: +
  • +
  • + +
  • Alias:
  • diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index f6a36c6f035..6aca0463624 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -136,6 +136,10 @@ function (angular, _, kbn) { query.rateOptions = { counter: !!target.isCounter }; + + if (target.counterMax && target.counterMax.length) { + query.rateOptions['counterMax'] = parseInt(target.counterMax); + } } if (target.shouldDownsample) { From 87e8162a2d26b9a4c4fc06f49f1742ff5c6b2f10 Mon Sep 17 00:00:00 2001 From: Raul Simiciuc Date: Mon, 13 Oct 2014 13:07:46 +0100 Subject: [PATCH 04/16] fixed identation --- src/app/services/opentsdb/opentsdbDatasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index 6aca0463624..a497d23c119 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -138,7 +138,7 @@ function (angular, _, kbn) { }; if (target.counterMax && target.counterMax.length) { - query.rateOptions['counterMax'] = parseInt(target.counterMax); + query.rateOptions['counterMax'] = parseInt(target.counterMax); } } From 29d7d6994a5a394e8bc6216057d698b949d688bd Mon Sep 17 00:00:00 2001 From: Raul Simiciuc Date: Mon, 13 Oct 2014 13:43:25 +0100 Subject: [PATCH 05/16] added reset value --- src/app/partials/opentsdb/editor.html | 13 +++++++++++++ src/app/services/opentsdb/opentsdbDatasource.js | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/partials/opentsdb/editor.html b/src/app/partials/opentsdb/editor.html index 4c12ac09b87..51a575d933c 100644 --- a/src/app/partials/opentsdb/editor.html +++ b/src/app/partials/opentsdb/editor.html @@ -102,6 +102,19 @@ ng-blur="targetBlur()" /> +
  • + Counter Reset Value: +
  • +
  • + +
  • Alias:
  • diff --git a/src/app/services/opentsdb/opentsdbDatasource.js b/src/app/services/opentsdb/opentsdbDatasource.js index a497d23c119..0cf3e5f1148 100644 --- a/src/app/services/opentsdb/opentsdbDatasource.js +++ b/src/app/services/opentsdb/opentsdbDatasource.js @@ -138,7 +138,11 @@ function (angular, _, kbn) { }; if (target.counterMax && target.counterMax.length) { - query.rateOptions['counterMax'] = parseInt(target.counterMax); + query.rateOptions.counterMax = parseInt(target.counterMax); + } + + if (target.counterResetValue && target.counterResetValue.length) { + query.rateOptions.resetValue = parseInt(target.counterResetValue); } } From 08e816a5392b3652dee668d40123abf596f94fbb Mon Sep 17 00:00:00 2001 From: Mark Bell Date: Thu, 23 Oct 2014 10:35:57 -0400 Subject: [PATCH 06/16] Add support for regex based series merging in InfluxDB --- .../services/influxdb/influxQueryBuilder.js | 2 +- src/test/specs/influxQueryBuilder-specs.js | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/app/services/influxdb/influxQueryBuilder.js b/src/app/services/influxdb/influxQueryBuilder.js index eb5334fd4e1..5ee7746af6b 100644 --- a/src/app/services/influxdb/influxQueryBuilder.js +++ b/src/app/services/influxdb/influxQueryBuilder.js @@ -18,7 +18,7 @@ function () { var query = 'select '; var seriesName = target.series; - if(!seriesName.match('^/.*/')) { + if(!seriesName.match('^/.*/') && !seriesName.match(/^merge\(.*\)/)) { seriesName = '"' + seriesName+ '"'; } diff --git a/src/test/specs/influxQueryBuilder-specs.js b/src/test/specs/influxQueryBuilder-specs.js index 4f18bf2905e..b4e052a23af 100644 --- a/src/test/specs/influxQueryBuilder-specs.js +++ b/src/test/specs/influxQueryBuilder-specs.js @@ -44,6 +44,35 @@ define([ }); + describe('merge function detection', function() { + it('should not quote wrap regex merged series', function() { + var builder = new InfluxQueryBuilder({ + series: 'merge(/^google.test/)', + column: 'value', + function: 'mean' + }); + + var query = builder.build(); + + expect(query).to.be('select mean(value) from merge(/^google.test/) where $timeFilter ' + + 'group by time($interval) order asc'); + }); + + it('should quote wrap series names that start with "merge"', function() { + var builder = new InfluxQueryBuilder({ + series: 'merge.google.test', + column: 'value', + function: 'mean' + }); + + var query = builder.build(); + + expect(query).to.be('select mean(value) from "merge.google.test" where $timeFilter ' + + 'group by time($interval) order asc'); + }); + + }); + }); }); From 1cfc4d2f314ab7ad2d20f767bf2c31b127ba6dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 24 Oct 2014 11:48:08 +0200 Subject: [PATCH 07/16] ScriptedDashboard: bugfix for scripted dashboards and collapsed rows, Fixes #965 --- src/app/routes/dashboard-from-script.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/routes/dashboard-from-script.js b/src/app/routes/dashboard-from-script.js index fa3abd36e81..286dca7d7d9 100644 --- a/src/app/routes/dashboard-from-script.js +++ b/src/app/routes/dashboard-from-script.js @@ -16,6 +16,7 @@ function (angular, $, config, _, kbn, moment) { .when('/dashboard/script/:jsFile', { templateUrl: 'app/partials/dashboard.html', controller : 'DashFromScriptProvider', + reloadOnSearch: false, }); }); From 02861142cbb9fe8190f5d8abf282695903b7f4c7 Mon Sep 17 00:00:00 2001 From: Max Stepanov Date: Fri, 24 Oct 2014 20:06:39 +0300 Subject: [PATCH 08/16] Replace all $interval occurrences in query string because template --- src/app/services/influxdb/influxdbDatasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/influxdb/influxdbDatasource.js b/src/app/services/influxdb/influxdbDatasource.js index 1f44dbe78ef..287e2286f07 100644 --- a/src/app/services/influxdb/influxdbDatasource.js +++ b/src/app/services/influxdb/influxdbDatasource.js @@ -44,7 +44,7 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { // replace grafana variables query = query.replace('$timeFilter', timeFilter); - query = query.replace('$interval', (target.interval || options.interval)); + query = query.replace(/\$interval/g, (target.interval || options.interval)); // replace templated variables query = templateSrv.replace(query); From 5cec936128c782c81f634056b648a953c412167e Mon Sep 17 00:00:00 2001 From: Mark Bell Date: Fri, 24 Oct 2014 14:51:45 -0400 Subject: [PATCH 09/16] When get_data fails the legend should be cleared --- src/app/panels/graph/module.js | 1 + src/test/specs/graph-ctrl-specs.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 54a2a028fe6..87098a2d4d7 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -203,6 +203,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries) { $scope.panelMeta.loading = false; $scope.panelMeta.error = err.message || "Timeseries data request error"; $scope.inspector.error = err; + $scope.legend = []; $scope.render([]); }); }; diff --git a/src/test/specs/graph-ctrl-specs.js b/src/test/specs/graph-ctrl-specs.js index e1ddcbc571e..b2cf60d5d5d 100644 --- a/src/test/specs/graph-ctrl-specs.js +++ b/src/test/specs/graph-ctrl-specs.js @@ -36,6 +36,20 @@ define([ var data = ctx.scope.render.getCall(0).args[0]; expect(data.length).to.be(2); }); + + describe('get_data failure following success', function() { + beforeEach(function() { + ctx.datasource.query = sinon.stub().returns(ctx.$q.reject('Datasource Error')); + ctx.scope.get_data(); + ctx.scope.$digest(); + }); + + it('should clear the legend data', function() { + expect(ctx.scope.legend).to.eql([]); + }); + + }); + }); }); From e3942b343829435f9561e191920836ddafab5fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 25 Oct 2014 12:00:56 +0200 Subject: [PATCH 10/16] Graph: multi series tooltip fix for long series names, and metric value row alignment, Fixes #983, #984 --- src/app/directives/grafanaGraph.tooltip.js | 10 ++++++---- src/css/less/graph.less | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/app/directives/grafanaGraph.tooltip.js b/src/app/directives/grafanaGraph.tooltip.js index 3a4a9b1ac2a..e0fede2f62d 100644 --- a/src/app/directives/grafanaGraph.tooltip.js +++ b/src/app/directives/grafanaGraph.tooltip.js @@ -144,8 +144,9 @@ function ($) { hoverInfo = seriesHoverInfo[i]; value = series.formatValue(hoverInfo.value); - group = ' ' + series.label; - seriesHtml = group + ': ' + value + '
    ' + seriesHtml; + seriesHtml += '
    '; + seriesHtml += ' ' + series.label + ':
    '; + seriesHtml += '
    ' + value + '
    '; plot.highlight(i, hoverInfo.hoverIndex); } @@ -154,7 +155,8 @@ function ($) { // single series tooltip else if (item) { series = seriesList[item.seriesIndex]; - group = ' ' + series.label; + group = '
    '; + group += ' ' + series.label + ':
    '; if (scope.panel.stack && scope.panel.tooltip.value_type === 'individual') { value = item.datapoint[1] - item.datapoint[2]; @@ -165,7 +167,7 @@ function ($) { value = series.formatValue(value); timestamp = dashboard.formatDate(item.datapoint[0]); - group += ': ' + value + '
    '; + group += '
    ' + value + '
    '; self.showTooltip(timestamp, group, pos); } diff --git a/src/css/less/graph.less b/src/css/less/graph.less index c0c3f371325..0da3014410f 100644 --- a/src/css/less/graph.less +++ b/src/css/less/graph.less @@ -178,9 +178,18 @@ top: -3px; } + .graph-tooltip-list-item { + display: table-row; + } + + .graph-tooltip-series-name { + display: table-cell; + } + .graph-tooltip-value { + display: table-cell; font-weight: bold; - float: right; padding-left: 10px; + text-align: right; } } From 3cd33b6ffcc59b13ae057020450e259c8d32aa76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sun, 26 Oct 2014 08:45:42 +0100 Subject: [PATCH 11/16] Tech: added cache busting for requirejs fetches, will only affect config.js for optimized builds, should solve user issues where browsers cache config.js which causes initial confusing setup/config issues. --- src/app/components/require.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/components/require.config.js b/src/app/components/require.config.js index 5d8da32846f..882583083c6 100644 --- a/src/app/components/require.config.js +++ b/src/app/components/require.config.js @@ -3,6 +3,7 @@ */ require.config({ baseUrl: 'app', + urlArgs: 'bust=' + (new Date().getTime()), paths: { config: ['../config', '../config.sample'], From 60a2d9f6242aa12abc78a1c5586c2f62d80316f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 27 Oct 2014 10:42:13 +0100 Subject: [PATCH 12/16] Dashboard: fix for collapsed rows became invisible when hide controls was enabled, Fixes #987 --- CHANGELOG.md | 1 + src/css/less/grafana.less | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd27a6a6667..2f055665198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ **Fixes** - [Issue #925](https://github.com/grafana/grafana/issues/925). Graph: bar width calculation fix for some edge cases (bars would render on top of each other) - [Issue #505](https://github.com/grafana/grafana/issues/505). Graph: fix for second y axis tick unit labels wrapping on the next line +- [Issue #987](https://github.com/grafana/grafana/issues/987). Dashboard: Collapsed rows became invisible when hide controls was enabled ======= # 1.8.1 (2014-09-30) diff --git a/src/css/less/grafana.less b/src/css/less/grafana.less index 668feefdef0..31363ee4a31 100644 --- a/src/css/less/grafana.less +++ b/src/css/less/grafana.less @@ -15,7 +15,7 @@ .hide-controls { padding: 0; - .row-control-inner { + .row-tab { display: none; } .submenu-controls { From 4b79a5e9dab915dadc6088af52823ea68f449db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 28 Oct 2014 12:41:17 +0100 Subject: [PATCH 13/16] OpenTSDB: merged PR #930 adding counter max and counter reset options to OpenTSDB query editor --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f055665198..38ff0cdb732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ - [Issue #938](https://github.com/grafana/grafana/issues/938). Panel: Plugin panels now reside outside of app/panels directory - [Issue #952](https://github.com/grafana/grafana/issues/952). Help: Shortcut "?" to open help modal with list of all shortcuts +**OpenTSDB** +- [Issue #930](https://github.com/grafana/grafana/issues/930). OpenTSDB: Adding counter max and counter reset value to open tsdb query editor, thx @rsimiciuc + **Fixes** - [Issue #925](https://github.com/grafana/grafana/issues/925). Graph: bar width calculation fix for some edge cases (bars would render on top of each other) - [Issue #505](https://github.com/grafana/grafana/issues/505). Graph: fix for second y axis tick unit labels wrapping on the next line From a982dd17653203c64ca63682605feebe58988d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 28 Oct 2014 15:40:10 +0100 Subject: [PATCH 14/16] ScriptedDashboard: using grafana services in scripted dashboard --- ' | 84 ++++++++++++++++++ src/app/dashboards/scripted_gen_and_save.js | 95 +++++++++++++++++++++ src/app/routes/dashboard-from-script.js | 16 ++-- 3 files changed, 190 insertions(+), 5 deletions(-) create mode 100644 ' create mode 100644 src/app/dashboards/scripted_gen_and_save.js diff --git a/' b/' new file mode 100644 index 00000000000..86791d43fde --- /dev/null +++ b/' @@ -0,0 +1,84 @@ +/* global _ */ + +/* + * Complex scripted dashboard + * This script generates a dashboard object that Grafana can load. It also takes a number of user + * supplied URL parameters (int ARGS variable) + * + * Return a dashboard object, or a function + * + * For async scripts, return a function, this function must take a single callback function as argument, + * call this callback function with the dashboard object (look at scripted_async.js for an example) + */ + +'use strict'; + +// accessable variables in this scope +var window, document, ARGS, $, jQuery, moment, kbn, services, _; + +// default datasource +var datasource = services.datasourceSrv.default; +// get datasource used for saving dashboards +var dashboardDB = services.datasourceSrv.getGrafanaDB(); + +var targets = []; + +function getTargets(path) { + return datasource.metricFindQuery(path + '.*').then(function(result) { + if (!result) { + return null; + } + + if (targets.length === 10) { + return null; + } + + var promises = _.map(result, function(metric) { + if (metric.expandable) { + return getTargets(path + "." + metric.text); + } + else { + targets.push(path + '.' + metric.text); + } + return null; + }); + + return services.$q.when(promises); + }); +} + +function createDashboard(target, index) { + // Intialize a skeleton with nothing but a rows array and service object + var dashboard = { rows : [] }; + dashboard.title = 'Scripted dash ' + index; + dashboard.time = { + from: "now-6h", + to: "now" + }; + + dashboard.rows.push({ + title: 'Chart', + height: '300px', + panels: [ + { + title: 'Events', + type: 'graph', + span: 12, + targets: [ {target: target} ] + } + ] + }); + +} + +return function(callback) { + + getTargets('apps').then(function(results) { + console.log('targets: ', targets); + _.each(targets, function(target, index) { + var dashboard = createDashboard(target); + }); + }); + +}; + diff --git a/src/app/dashboards/scripted_gen_and_save.js b/src/app/dashboards/scripted_gen_and_save.js new file mode 100644 index 00000000000..d874b3fc28e --- /dev/null +++ b/src/app/dashboards/scripted_gen_and_save.js @@ -0,0 +1,95 @@ +/* global _ */ + +/* + * Complex scripted dashboard + * This script generates a dashboard object that Grafana can load. It also takes a number of user + * supplied URL parameters (int ARGS variable) + * + * Return a dashboard object, or a function + * + * For async scripts, return a function, this function must take a single callback function as argument, + * call this callback function with the dashboard object (look at scripted_async.js for an example) + */ + +'use strict'; + +// accessable variables in this scope +var window, document, ARGS, $, jQuery, moment, kbn, services, _; + +// default datasource +var datasource = services.datasourceSrv.default; +// get datasource used for saving dashboards +var dashboardDB = services.datasourceSrv.getGrafanaDB(); + +var targets = []; + +function getTargets(path) { + return datasource.metricFindQuery(path + '.*').then(function(result) { + if (!result) { + return null; + } + + if (targets.length === 10) { + return null; + } + + var promises = _.map(result, function(metric) { + if (metric.expandable) { + return getTargets(path + "." + metric.text); + } + else { + targets.push(path + '.' + metric.text); + } + return null; + }); + + return services.$q.all(promises); + }); +} + +function createDashboard(target, index) { + // Intialize a skeleton with nothing but a rows array and service object + var dashboard = { rows : [] }; + dashboard.title = 'Scripted dash ' + index; + dashboard.time = { + from: "now-6h", + to: "now" + }; + + dashboard.rows.push({ + title: 'Chart', + height: '300px', + panels: [ + { + title: 'Events', + type: 'graph', + span: 12, + targets: [ {target: target} ] + } + ] + }); + + return dashboard; +} + +function saveDashboard(dashboard) { + var model = services.dashboardSrv.create(dashboard); + dashboardDB.saveDashboard(model); +} + +return function(callback) { + + getTargets('apps').then(function() { + console.log('targets: ', targets); + _.each(targets, function(target, index) { + var dashboard = createDashboard(target, index); + saveDashboard(dashboard); + + if (index === targets.length - 1) { + callback(dashboard); + } + }); + }); + +}; + diff --git a/src/app/routes/dashboard-from-script.js b/src/app/routes/dashboard-from-script.js index 286dca7d7d9..b73a49b0cbe 100644 --- a/src/app/routes/dashboard-from-script.js +++ b/src/app/routes/dashboard-from-script.js @@ -20,18 +20,24 @@ function (angular, $, config, _, kbn, moment) { }); }); - module.controller('DashFromScriptProvider', function($scope, $rootScope, $http, $routeParams, alertSrv, $q) { + module.controller('DashFromScriptProvider', function($scope, $rootScope, $http, $routeParams, $q, dashboardSrv, datasourceSrv, $timeout) { var execute_script = function(result) { + var services = { + dashboardSrv: dashboardSrv, + datasourceSrv: datasourceSrv, + $q: $q, + }; + /*jshint -W054 */ - var script_func = new Function('ARGS','kbn','_','moment','window','document','$','jQuery', result.data); - var script_result = script_func($routeParams, kbn, _ , moment, window, document, $, $); + var script_func = new Function('ARGS','kbn','_','moment','window','document','$','jQuery', 'services', result.data); + var script_result = script_func($routeParams, kbn, _ , moment, window, document, $, $, services); // Handle async dashboard scripts if (_.isFunction(script_result)) { var deferred = $q.defer(); script_result(function(dashboard) { - $rootScope.$apply(function() { + $timeout(function() { deferred.resolve({ data: dashboard }); }); }); @@ -48,7 +54,7 @@ function (angular, $, config, _, kbn, moment) { .then(execute_script) .then(null,function(err) { console.log('Script dashboard error '+ err); - alertSrv.set('Error', "Could not load scripts/"+file+". Please make sure it exists and returns a valid dashboard", 'error'); + $scope.appEvent('alert-error', ["Script Error", "Please make sure it exists and returns a valid dashboard"]); return false; }); }; From a7b0f6dc9fcbb4f3ad1449e7ebde42ded7f67fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 28 Oct 2014 16:16:52 +0100 Subject: [PATCH 15/16] ScriptedDashboard: datasource services are now available in scripted dashboards, you can query datasource for metric keys, generate dashboards, and even save them in a scripted dashboard (see scripted_gen_and_save.js for example), Closes #991 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38ff0cdb732..24772741c14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ **Misc** - [Issue #938](https://github.com/grafana/grafana/issues/938). Panel: Plugin panels now reside outside of app/panels directory - [Issue #952](https://github.com/grafana/grafana/issues/952). Help: Shortcut "?" to open help modal with list of all shortcuts +- [Issue #991](https://github.com/grafana/grafana/issues/991). ScriptedDashboard: datasource services are now available in scripted dashboards, you can query datasource for metric keys, generate dashboards, and even save them in a scripted dashboard (see scripted_gen_and_save.js for example) **OpenTSDB** - [Issue #930](https://github.com/grafana/grafana/issues/930). OpenTSDB: Adding counter max and counter reset value to open tsdb query editor, thx @rsimiciuc From e5bb7f7c2ddda5eff1c72d9abf0651b17c736f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 28 Oct 2014 19:00:46 +0100 Subject: [PATCH 16/16] CustomDatasource: fixed build optimization issue with custom datasources, Fixes #994 --- src/plugins/datasource.example.js | 2 +- tasks/options/ngmin.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/datasource.example.js b/src/plugins/datasource.example.js index d85409cf2a5..fcc160ec569 100644 --- a/src/plugins/datasource.example.js +++ b/src/plugins/datasource.example.js @@ -19,7 +19,7 @@ function (angular, _, kbn) { this.url = datasource.url; } - CustomDatasource.prototype.query = function(filterSrv, options) { + CustomDatasource.prototype.query = function(options) { // get from & to in seconds var from = kbn.parseDate(options.range.from).getTime() / 1000; var to = kbn.parseDate(options.range.to).getTime() / 1000; diff --git a/tasks/options/ngmin.js b/tasks/options/ngmin.js index 39dbb7a540a..82e7dee4f8d 100644 --- a/tasks/options/ngmin.js +++ b/tasks/options/ngmin.js @@ -10,6 +10,7 @@ module.exports = function(config) { 'app/filters/**/*.js', 'app/panels/**/*.js', 'app/routes/**/*.js', + 'plugins/**/*.js', 'app/app.js', 'vendor/angular/**/*.js', ],