From e4fecb48e37ee0144b198357cf4a3c891dd5cd29 Mon Sep 17 00:00:00 2001 From: Felix Barnsteiner Date: Fri, 23 Oct 2015 09:32:02 +0200 Subject: [PATCH 1/2] Add ability to set a global time interval The interval is configurable in the data source. This commit only adds the ability to Elasticsearch datasources --- public/app/features/panel/panelHelper.js | 4 +++- .../datasource/elasticsearch/datasource.js | 1 + .../elasticsearch/partials/config.html | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/public/app/features/panel/panelHelper.js b/public/app/features/panel/panelHelper.js index c7473692a43..f0d4f98ee9c 100644 --- a/public/app/features/panel/panelHelper.js +++ b/public/app/features/panel/panelHelper.js @@ -59,7 +59,9 @@ function (angular, dateMath, rangeUtil, _, kbn, $) { scope.resolution = Math.ceil($(window).width() * (scope.panel.span / 12)); } - scope.interval = kbn.calculateInterval(scope.range, scope.resolution, scope.panel.interval); + var panelInterval = scope.panel.interval; + var datasourceInterval = (scope.datasource || {}).interval; + scope.interval = kbn.calculateInterval(scope.range, scope.resolution, panelInterval || datasourceInterval); }; this.applyPanelTimeOverrides = function(scope) { diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 374fc9da90d..21a5f929e89 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -24,6 +24,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes this.index = datasource.index; this.timeField = datasource.jsonData.timeField; this.indexPattern = new IndexPattern(datasource.index, datasource.jsonData.interval); + this.interval = datasource.jsonData.timeInterval; this.queryBuilder = new ElasticQueryBuilder({ timeField: this.timeField }); diff --git a/public/app/plugins/datasource/elasticsearch/partials/config.html b/public/app/plugins/datasource/elasticsearch/partials/config.html index d1cb05801d6..622d4cbdc86 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/config.html +++ b/public/app/plugins/datasource/elasticsearch/partials/config.html @@ -1,7 +1,7 @@

-
Elastic search details
+
Elasticsearch details
-
+
  • Time field name @@ -31,3 +31,18 @@
+
+
    +
  • + Group by time interval +
  • +
  • + +
  • +
  • + +
  • +
+
+
From 80d757b37142cab4da5229fdc71ff0ece988636c Mon Sep 17 00:00:00 2001 From: carl bergquist Date: Thu, 17 Dec 2015 10:00:53 +0100 Subject: [PATCH 2/2] feat(elasticsearch): move default query parameters to new table --- .../datasource/elasticsearch/partials/config.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/partials/config.html b/public/app/plugins/datasource/elasticsearch/partials/config.html index d08a83238ad..595588c1be0 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/config.html +++ b/public/app/plugins/datasource/elasticsearch/partials/config.html @@ -31,7 +31,7 @@
-
+
  • Version @@ -42,10 +42,13 @@
+
+ +
Default query settings