mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add a minimum value option for template auto interval
This commit is contained in:
parent
8f9c3c8381
commit
d6e4fb46cf
@ -119,10 +119,14 @@ function($, _) {
|
||||
s: 1
|
||||
};
|
||||
|
||||
kbn.calculateInterval = function(range, resolution, userInterval) {
|
||||
kbn.calculateInterval = function(range, resolution, userInterval, lowLimit) {
|
||||
var lowLimitMs = 1; // 1 millisecond default low limit
|
||||
var intervalMs, lowLimitInterval;
|
||||
|
||||
if(lowLimit) {
|
||||
lowLimitMs = kbn.interval_to_ms(lowLimit);
|
||||
}
|
||||
|
||||
if (userInterval) {
|
||||
if (userInterval[0] === '>') {
|
||||
lowLimitInterval = userInterval.slice(1);
|
||||
|
@ -134,6 +134,12 @@
|
||||
<li>
|
||||
<select class="input-mini tight-form-input last" ng-model="current.auto_count" ng-options="f for f in [3,5,10,30,50,100,200]" ng-change="runQuery()"></select>
|
||||
</li>
|
||||
<li class="tight-form-item" ng-show="current.auto">
|
||||
Auto interval min value <tip>The calculated value will not go below this threshold</tip>
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" style="width: 35px" class="input-xxlarge tight-form-input last" ng-model="current.auto_min" ng-change="runQuery()"></input>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
@ -60,7 +60,7 @@ function (angular, _, kbn) {
|
||||
variable.options.unshift({ text: 'auto', value: '$__auto_interval' });
|
||||
}
|
||||
|
||||
var interval = kbn.calculateInterval(timeSrv.timeRange(), variable.auto_count);
|
||||
var interval = kbn.calculateInterval(timeSrv.timeRange(), variable.auto_count, null, variable.auto_min);
|
||||
templateSrv.setGrafanaVariable('$__auto_interval', interval);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user