فهرست منبع

Merge branch 'global_interval' of https://github.com/felixbarny/grafana into felixbarny-global_interval

Conflicts:
	public/app/plugins/datasource/elasticsearch/partials/config.html
carl bergquist 10 سال پیش
والد
کامیت
5bdf0cd136

+ 3 - 1
public/app/features/panel/panel_helper.js

@@ -59,7 +59,9 @@ function (angular, _, $, kbn, dateMath, rangeUtil) {
         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) {

+ 1 - 0
public/app/plugins/datasource/elasticsearch/datasource.js

@@ -26,6 +26,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
       this.timeField = datasource.jsonData.timeField;
       this.esVersion = datasource.jsonData.esVersion;
       this.indexPattern = new IndexPattern(datasource.index, datasource.jsonData.interval);
+      this.interval = datasource.jsonData.timeInterval;
       this.queryBuilder = new ElasticQueryBuilder({
         timeField: this.timeField,
         esVersion: this.esVersion,

+ 17 - 1
public/app/plugins/datasource/elasticsearch/partials/config.html

@@ -31,7 +31,7 @@
 	</ul>
 	<div class="clearfix"></div>
 </div>
-<div class="tight-form last">
+<div class="tight-form">
 	<ul class="tight-form-list">
 		<li class="tight-form-item" style="width: 144px">
 			Version
@@ -42,3 +42,19 @@
 	</ul>
 	<div class="clearfix"></div>
 </div>
+
+<div class="tight-form last">
+	<ul class="tight-form-list">
+		<li class="tight-form-item" style="width: 144px">
+			Group by time interval
+		</li>
+		<li>
+			<input type="text" class="input-medium tight-form-input input-xlarge" ng-model="current.jsonData.timeInterval"
+						 spellcheck='false' placeholder="example: >10s">
+		</li>
+		<li class="tight-form-item">
+			<i class="fa fa-question-circle" bs-tooltip="'Set a low limit by having a greater sign: example: >60s'" data-placement="right"></i>
+		</li>
+	</ul>
+	<div class="clearfix"></div>
+</div>