mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'moving_avg_es_support' of https://github.com/bergquist/grafana into bergquist-moving_avg_es_support
This commit is contained in:
@@ -13,21 +13,21 @@ function (angular, _, queryDef) {
|
||||
|
||||
$scope.metricAggTypes = queryDef.metricAggTypes;
|
||||
$scope.extendedStats = queryDef.extendedStats;
|
||||
$scope.mavgOptions = [];
|
||||
$scope.pipelineAggOptions = [];
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.agg = metricAggs[$scope.index];
|
||||
$scope.validateModel();
|
||||
$scope.updateMavgOptions();
|
||||
$scope.updatePipelineAggOptions();
|
||||
};
|
||||
|
||||
$scope.updateMavgOptions = function() {
|
||||
$scope.mavgOptions = queryDef.getMovingAverageOptions($scope.target);
|
||||
$scope.updatePipelineAggOptions = function() {
|
||||
$scope.pipelineAggOptions = queryDef.getMovingAverageOptions($scope.target);
|
||||
};
|
||||
|
||||
$rootScope.onAppEvent('elastic-query-updated', function() {
|
||||
$scope.index = _.indexOf(metricAggs, $scope.agg);
|
||||
$scope.updateMavgOptions();
|
||||
$scope.updatePipelineAggOptions();
|
||||
$scope.validateModel();
|
||||
}, $scope);
|
||||
|
||||
@@ -41,13 +41,13 @@ function (angular, _, queryDef) {
|
||||
$scope.agg.field = 'select field';
|
||||
}
|
||||
|
||||
if (queryDef.isPipelineAgg($scope.agg)) {
|
||||
$scope.agg.pipelineAgg = $scope.agg.pipelineAgg || 'select metric';
|
||||
$scope.agg.field = $scope.agg.pipelineAgg;
|
||||
$scope.settingsLinkText = 'Options';
|
||||
}
|
||||
|
||||
switch($scope.agg.type) {
|
||||
case 'moving_avg': {
|
||||
$scope.agg.pipelineAgg = $scope.agg.pipelineAgg || 'Metric to apply moving average';
|
||||
$scope.settingsLinkText = 'Moving average options';
|
||||
$scope.agg.field = $scope.agg.pipelineAgg;
|
||||
break;
|
||||
}
|
||||
case 'percentiles': {
|
||||
$scope.agg.settings.percents = $scope.agg.settings.percents || [25,50,75,95,99];
|
||||
$scope.settingsLinkText = 'values: ' + $scope.agg.settings.percents.join(',');
|
||||
@@ -78,7 +78,7 @@ function (angular, _, queryDef) {
|
||||
|
||||
$scope.toggleOptions = function() {
|
||||
$scope.showOptions = !$scope.showOptions;
|
||||
$scope.updateMavgOptions();
|
||||
$scope.updatePipelineAggOptions();
|
||||
};
|
||||
|
||||
$scope.onChangeInternal = function() {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
Based on
|
||||
</li>
|
||||
<li>
|
||||
<metric-segment-model property="agg.pipelineAgg" options="mavgOptions" on-change="onChangeInternal()" css-class="last"></metric-segment-model>
|
||||
<metric-segment-model property="agg.pipelineAgg" options="pipelineAggOptions" on-change="onChangeInternal()" css-class="last"></metric-segment-model>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
Reference in New Issue
Block a user