diff --git a/CHANGELOG.md b/CHANGELOG.md index 225e1db96ac..d68dc949c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,26 @@ # 3.0.0 (unrelased master branch) ### New Features -* **Playlists**: Playlists can now be persisted and started from urls, closes [#3655](https://github.com/grafana/grafana/pull/3655) +* **Playlists**: Playlists can now be persisted and started from urls, closes [#3655](https://github.com/grafana/grafana/issues/3655) * **Metadata**: Settings panel now shows dashboard metadata, closes [#3304](https://github.com/grafana/grafana/issues/3304) * **InfluxDB**: Support for policy selection in query editor, closes [#2018](https://github.com/grafana/grafana/issues/2018) ### Breaking changes -* **Plugin API**: Both datasource and panel plugin api (and plugin.json schema) have been updated, requiring a minor update to plugins. See [plugin api](https://github.com/grafana/grafana/blob/master/public/app/plugins/plugin_api.md) for more info. +* **Plugin API**: Both datasource and panel plugin api (and plugin.json schema) have been updated, requiring an update to plugins. See [plugin api](https://github.com/grafana/grafana/blob/master/public/app/plugins/plugin_api.md) for more info. * **InfluxDB 0.8.x** The data source for the old version of influxdb (0.8.x) is no longer included in default builds, but can easily be installed via improved plugin system, closes [#3523](https://github.com/grafana/grafana/issues/3523) * **KairosDB** The data source is no longer included in default builds, but can easily be installed via improved plugin system, closes [#3524](https://github.com/grafana/grafana/issues/3524) ### Enhancements -* **Sessions**: Support for memcached as session storage, closes [#3458](https://github.com/grafana/grafana/pull/3458) -* **mysql**: Grafana now supports ssl for mysql, closes [#3584](https://github.com/grafana/grafana/pull/3584) -* **snapshot**: Annotations are now included in snapshots, closes [#3635](https://github.com/grafana/grafana/pull/3635) +* **Sessions**: Support for memcached as session storage, closes [#3458](https://github.com/grafana/grafana/issues/3458) +* **mysql**: Grafana now supports ssl for mysql, closes [#3584](https://github.com/grafana/grafana/issues/3584) +* **snapshot**: Annotations are now included in snapshots, closes [#3635](https://github.com/grafana/grafana/issues/3635) * **Admin**: Admin can now have global overview of Grafana setup, closes [#3812](https://github.com/grafana/grafana/issues/3812) ### Bug fixes * **Playlist**: Fix for memory leak when running a playlist, closes [#3794](https://github.com/grafana/grafana/pull/3794) +* **InfluxDB**: Fix for InfluxDB and table panel when using Format As Table and having group by time, fixes [#3928](https://github.com/grafana/grafana/issues/3928) +* **Panel Time shift**: Fix for panel time range and using dashboard times liek `Today` and `This Week`, fixes [#3941](https://github.com/grafana/grafana/issues/3941) +* **Row repeat**: Repeated rows will now appear next to each other and not by the bottom of the dashboard, fixes [#3942](https://github.com/grafana/grafana/issues/3942) # 2.6.1 (unrelased, 2.6.x branch) diff --git a/docs/sources/guides/basic_concepts.md b/docs/sources/guides/basic_concepts.md index 9deda2ee97e..b654554fa48 100644 --- a/docs/sources/guides/basic_concepts.md +++ b/docs/sources/guides/basic_concepts.md @@ -77,7 +77,7 @@ The Query Editor exposes capabilities of your Data Source and allows you to quer Use the Query Editor to build one or more queries (for one or more series) in your time series database. The panel will instantly update allowing you to effectively explore your data in real time and build a perfect query for that particular Panel. -You can utilize [Template variables]((reference/templating/) in the Query Editor within the queries themselves. This provides a powerful way to explore data dynamically based on the Templating variables selected on the Dashboard. +You can utilize [Template variables](/reference/templating/) in the Query Editor within the queries themselves. This provides a powerful way to explore data dynamically based on the Templating variables selected on the Dashboard. Grafana allows you to reference queries in the Query Editor by the row that they’re on. If you add a second query to graph, you can reference the first query simply by typing in #A. This provides an easy and convenient way to build compounded queries. diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 0b120dd85b7..55c0f4ec049 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -3,7 +3,6 @@ import "./directives/annotation_tooltip"; import "./directives/body_class"; -import "./directives/config_modal"; import "./directives/confirm_click"; import "./directives/dash_edit_link"; import "./directives/dash_upload"; @@ -16,6 +15,8 @@ import "./directives/password_strenght"; import "./directives/spectrum_picker"; import "./directives/tags"; import "./directives/value_select_dropdown"; +import "./directives/plugin_component"; +import "./directives/rebuild_on_change"; import "./directives/give_focus"; import './jquery_extended'; import './partials'; diff --git a/public/app/core/directives/config_modal.js b/public/app/core/directives/config_modal.js deleted file mode 100644 index e37d6797fc4..00000000000 --- a/public/app/core/directives/config_modal.js +++ /dev/null @@ -1,46 +0,0 @@ -define([ - 'lodash', - 'jquery', - '../core_module', -], -function (_, $, coreModule) { - 'use strict'; - - coreModule.default.directive('configModal', function($modal, $q, $timeout) { - return { - restrict: 'A', - link: function(scope, elem, attrs) { - var partial = attrs.configModal; - var id = '#' + partial.replace('.html', '').replace(/[\/|\.|:]/g, '-') + '-' + scope.$id; - - elem.bind('click',function() { - if ($(id).length) { - elem.attr('data-target', id).attr('data-toggle', 'modal'); - scope.$apply(function() { scope.$broadcast('modal-opened'); }); - return; - } - - var panelModal = $modal({ - template: partial, - persist: false, - show: false, - scope: scope.$new(), - keyboard: false - }); - - $q.when(panelModal).then(function(modalEl) { - elem.attr('data-target', id).attr('data-toggle', 'modal'); - - $timeout(function () { - if (!modalEl.data('modal').isShown) { - modalEl.modal('show'); - } - }, 50); - }); - - scope.$apply(); - }); - } - }; - }); -}); diff --git a/public/app/core/directives/misc.js b/public/app/core/directives/misc.js index b3d6de2585d..1f96422d49e 100644 --- a/public/app/core/directives/misc.js +++ b/public/app/core/directives/misc.js @@ -90,7 +90,6 @@ function (angular, coreModule, kbn) { var li = '
- {{message}}
-
+
+{{message}}
+
diff --git a/public/app/partials/metrics.html b/public/app/partials/metrics.html index 8a7eb1bfd71..f7b1672cd97 100644 --- a/public/app/partials/metrics.html +++ b/public/app/partials/metrics.html @@ -1,8 +1,12 @@-- +++ ++ +@@ -26,7 +30,11 @@-+ + ++ +diff --git a/public/app/plugins/datasource/cloudwatch/datasource.d.ts b/public/app/plugins/datasource/cloudwatch/datasource.d.ts index a50d7ca49cc..afc49d07dea 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.d.ts +++ b/public/app/plugins/datasource/cloudwatch/datasource.d.ts @@ -1,3 +1,3 @@ -declare var Datasource: any; -export default Datasource; +declare var CloudWatchDatasource: any; +export {CloudWatchDatasource}; diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 6f9f24ff867..119c4a83167 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -357,5 +357,7 @@ function (angular, _, moment, dateMath) { } - return CloudWatchDatasource; + return { + CloudWatchDatasource: CloudWatchDatasource + }; }); diff --git a/public/app/plugins/datasource/cloudwatch/module.js b/public/app/plugins/datasource/cloudwatch/module.js deleted file mode 100644 index 6f15457a43e..00000000000 --- a/public/app/plugins/datasource/cloudwatch/module.js +++ /dev/null @@ -1,27 +0,0 @@ -define([ - './datasource', - './query_parameter_ctrl', - './query_ctrl', -], -function (CloudWatchDatasource) { - 'use strict'; - - function metricsQueryEditor() { - return {controller: 'CloudWatchQueryCtrl', templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/query.editor.html'}; - } - - function annotationsQueryEditor() { - return {templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html'}; - } - - function configView() { - return {templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/edit_view.html'}; - } - - return { - Datasource: CloudWatchDatasource, - configView: configView, - annotationsQueryEditor: annotationsQueryEditor, - metricsQueryEditor: metricsQueryEditor, - }; -}); diff --git a/public/app/plugins/datasource/cloudwatch/module.ts b/public/app/plugins/datasource/cloudwatch/module.ts new file mode 100644 index 00000000000..674506310ab --- /dev/null +++ b/public/app/plugins/datasource/cloudwatch/module.ts @@ -0,0 +1,20 @@ +import './query_parameter_ctrl'; + +import {CloudWatchDatasource} from './datasource'; +import {CloudWatchQueryCtrl} from './query_ctrl'; + +class CloudWatchConfigCtrl { + static templateUrl = 'public/app/plugins/datasource/cloudwatch/partials/config.html'; +} + +class CloudWatchAnnotationsQueryCtrl { + static templateUrl = 'public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html'; +} + +export { + CloudWatchDatasource as Datasource, + CloudWatchQueryCtrl as QueryCtrl, + CloudWatchConfigCtrl as ConfigCtrl, + CloudWatchAnnotationsQueryCtrl as AnnotationsQueryCtrl, +}; + diff --git a/public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html b/public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html index 583a578134d..050698f3ff2 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html @@ -1 +1 @@ -diff --git a/public/app/plugins/datasource/elasticsearch/partials/edit_view.html b/public/app/plugins/datasource/elasticsearch/partials/config.html similarity index 67% rename from public/app/plugins/datasource/elasticsearch/partials/edit_view.html rename to public/app/plugins/datasource/elasticsearch/partials/config.html index bf43012c72e..05df80143e3 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/edit_view.html +++ b/public/app/plugins/datasource/elasticsearch/partials/config.html @@ -1,4 +1,5 @@ -+ diff --git a/public/app/plugins/datasource/cloudwatch/partials/edit_view.html b/public/app/plugins/datasource/cloudwatch/partials/config.html similarity index 76% rename from public/app/plugins/datasource/cloudwatch/partials/edit_view.html rename to public/app/plugins/datasource/cloudwatch/partials/config.html index fbb641633ac..92a963da7c6 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/edit_view.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -9,7 +9,7 @@ Credentials profile name Credentials profile name, as specified in ~/.aws/credentials, leave blank for default - + @@ -19,12 +19,12 @@Default Region -Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. - + diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html index fa5e74c33c2..a64635dc397 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html @@ -1,38 +1,4 @@ - - -+ diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_ctrl.js deleted file mode 100644 index 927c08b3f2d..00000000000 --- a/public/app/plugins/datasource/cloudwatch/query_ctrl.js +++ /dev/null @@ -1,27 +0,0 @@ -define([ - 'angular', - 'lodash', -], -function (angular, _) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('CloudWatchQueryCtrl', function($scope) { - - $scope.init = function() { - $scope.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{ }}'; - }; - - $scope.refreshMetricData = function() { - if (!_.isEqual($scope.oldTarget, $scope.target)) { - $scope.oldTarget = angular.copy($scope.target); - $scope.ctrl.refresh(); - } - }; - - $scope.init(); - - }); - -}); diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.ts b/public/app/plugins/datasource/cloudwatch/query_ctrl.ts new file mode 100644 index 00000000000..daacd7fe198 --- /dev/null +++ b/public/app/plugins/datasource/cloudwatch/query_ctrl.ts @@ -0,0 +1,17 @@ +/// + +import './query_parameter_ctrl'; +import _ from 'lodash'; +import {QueryCtrl} from 'app/features/panel/panel'; + +export class CloudWatchQueryCtrl extends QueryCtrl { + static templateUrl = 'public/app/plugins/datasource/cloudwatch/partials/query.editor.html'; + + aliasSyntax: string; + + /** @ngInject **/ + constructor($scope, $injector) { + super($scope, $injector); + this.aliasSyntax = '{{metric}} {{stat}} {{namespace}} {{region}} {{ }}'; + } +} diff --git a/public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js index 3be1f0d5a01..dc027f60aef 100644 --- a/public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js +++ b/public/app/plugins/datasource/cloudwatch/query_parameter_ctrl.js @@ -9,7 +9,7 @@ function (angular, _) { module.directive('cloudwatchQueryParameter', function() { return { - templateUrl: 'app/plugins/datasource/cloudwatch/partials/query.parameter.html', + templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/query.parameter.html', controller: 'CloudWatchQueryParameterCtrl', restrict: 'E', scope: { diff --git a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts index ed5f9418f8f..cec32420aea 100644 --- a/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/cloudwatch/specs/datasource_specs.ts @@ -3,7 +3,7 @@ import "../datasource"; import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common'; import moment from 'moment'; import helpers from 'test/specs/helpers'; -import Datasource from "../datasource"; +import {CloudWatchDatasource} from "../datasource"; describe('CloudWatchDatasource', function() { var ctx = new helpers.ServiceTestContext(); @@ -20,7 +20,7 @@ describe('CloudWatchDatasource', function() { ctx.$q = $q; ctx.$httpBackend = $httpBackend; ctx.$rootScope = $rootScope; - ctx.ds = $injector.instantiate(Datasource, {instanceSettings: instanceSettings}); + ctx.ds = $injector.instantiate(CloudWatchDatasource, {instanceSettings: instanceSettings}); })); describe('When performing CloudWatch query', function() { diff --git a/public/app/plugins/datasource/elasticsearch/config_ctrl.ts b/public/app/plugins/datasource/elasticsearch/config_ctrl.ts new file mode 100644 index 00000000000..4c14e1133bf --- /dev/null +++ b/public/app/plugins/datasource/elasticsearch/config_ctrl.ts @@ -0,0 +1,34 @@ +/// + +import angular from 'angular'; +import _ from 'lodash'; + +export class ElasticConfigCtrl { + static templateUrl = 'public/app/plugins/datasource/elasticsearch/partials/config.html'; + current: any; + + /** @ngInject */ + constructor($scope) { + this.current.jsonData.timeField = this.current.jsonData.timeField || '@timestamp'; + } + + indexPatternTypes = [ + {name: 'No pattern', value: undefined}, + {name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH'}, + {name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD'}, + {name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW'}, + {name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM'}, + {name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'}, + ]; + + esVersions = [ + {name: '1.x', value: 1}, + {name: '2.x', value: 2}, + ]; + + indexPatternTypeChanged() { + var def = _.findWhere(this.indexPatternTypes, {value: this.current.jsonData.interval}); + this.current.database = def.example || 'es-index-name'; + } +} + diff --git a/public/app/plugins/datasource/elasticsearch/datasource.d.ts b/public/app/plugins/datasource/elasticsearch/datasource.d.ts index a50d7ca49cc..3682abfb614 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.d.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.d.ts @@ -1,3 +1,3 @@ -declare var Datasource: any; -export default Datasource; +declare var ElasticDatasource: any; +export {ElasticDatasource}; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 0d2fd174c4d..294f666abc7 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -304,5 +304,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes }; } - return ElasticDatasource; + return { + ElasticDatasource: ElasticDatasource + }; }); diff --git a/public/app/plugins/datasource/elasticsearch/edit_view.ts b/public/app/plugins/datasource/elasticsearch/edit_view.ts deleted file mode 100644 index c7e17d4fbea..00000000000 --- a/public/app/plugins/datasource/elasticsearch/edit_view.ts +++ /dev/null @@ -1,39 +0,0 @@ -/// - -import angular from 'angular'; -import _ from 'lodash'; - -export class EditViewCtrl { - - /** @ngInject */ - constructor($scope) { - $scope.indexPatternTypes = [ - {name: 'No pattern', value: undefined}, - {name: 'Hourly', value: 'Hourly', example: '[logstash-]YYYY.MM.DD.HH'}, - {name: 'Daily', value: 'Daily', example: '[logstash-]YYYY.MM.DD'}, - {name: 'Weekly', value: 'Weekly', example: '[logstash-]GGGG.WW'}, - {name: 'Monthly', value: 'Monthly', example: '[logstash-]YYYY.MM'}, - {name: 'Yearly', value: 'Yearly', example: '[logstash-]YYYY'}, - ]; - - $scope.esVersions = [ - {name: '1.x', value: 1}, - {name: '2.x', value: 2}, - ]; - - $scope.indexPatternTypeChanged = function() { - var def = _.findWhere($scope.indexPatternTypes, {value: $scope.current.jsonData.interval}); - $scope.current.database = def.example || 'es-index-name'; - }; - } -} - -function editViewDirective() { - return { - templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/edit_view.html', - controller: EditViewCtrl, - }; -}; - - -export default editViewDirective; diff --git a/public/app/plugins/datasource/elasticsearch/module.js b/public/app/plugins/datasource/elasticsearch/module.js deleted file mode 100644 index d38afe8e936..00000000000 --- a/public/app/plugins/datasource/elasticsearch/module.js +++ /dev/null @@ -1,30 +0,0 @@ -define([ - './datasource', - './edit_view', - './bucket_agg', - './metric_agg', -], -function (ElasticDatasource, editView) { - 'use strict'; - - function metricsQueryEditor() { - return {controller: 'ElasticQueryCtrl', templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/query.editor.html'}; - } - - function metricsQueryOptions() { - return {templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/query.options.html'}; - } - - function annotationsQueryEditor() { - return {templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html'}; - } - - return { - Datasource: ElasticDatasource, - configView: editView.default, - annotationsQueryEditor: annotationsQueryEditor, - metricsQueryEditor: metricsQueryEditor, - metricsQueryOptions: metricsQueryOptions, - }; - -}); diff --git a/public/app/plugins/datasource/elasticsearch/module.ts b/public/app/plugins/datasource/elasticsearch/module.ts new file mode 100644 index 00000000000..438649017e5 --- /dev/null +++ b/public/app/plugins/datasource/elasticsearch/module.ts @@ -0,0 +1,19 @@ +import {ElasticDatasource} from './datasource'; +import {ElasticQueryCtrl} from './query_ctrl'; +import {ElasticConfigCtrl} from './config_ctrl'; + +class ElasticQueryOptionsCtrl { + static templateUrl = 'public/app/plugins/datasource/elasticsearch/partials/query.options.html'; +} + +class ElasticAnnotationsQueryCtrl { + static templateUrl = 'public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html'; +} + +export { + ElasticDatasource as Datasource, + ElasticQueryCtrl as QueryCtrl, + ElasticConfigCtrl as ConfigCtrl, + ElasticQueryOptionsCtrl as QueryOptionsCtrl, + ElasticAnnotationsQueryCtrl as AnnotationsQueryCtrl, +}; diff --git a/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html b/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html index 0b7070904de..8f761b67865 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html +++ b/public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html @@ -1,14 +1,14 @@ -+@@ -18,22 +18,22 @@Index name
- +Search query (lucene)
Use [[filterName]] in query to replace part of the query with a filter value - +Field mappings
- +- +- +- ++ + Elasticsearch details
@@ -8,13 +9,13 @@ Index name