Skip to content

Commit

Permalink
Check if default agg type is part of filtered list and if not, change…
Browse files Browse the repository at this point in the history
… to first agg type in list
  • Loading branch information
jen-huang committed Oct 17, 2018
1 parent 89ba089 commit 212d7df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/public/vis/editors/default/agg.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</span>

<!-- error -->
<span ng-if="!editorOpen && aggForm.$invalid" class="visEditorAggHeader__description visEditorAggHeader__description--danger" title="{{aggForm.describeErrors()}}">
<span ng-if="!editorOpen && aggForm.$invalid && aggForm.softErrorCount()" class="visEditorAggHeader__description visEditorAggHeader__description--danger" title="{{aggForm.describeErrors()}}">
{{ aggForm.describeErrors() }}
</span>

Expand Down
5 changes: 5 additions & 0 deletions src/ui/public/vis/editors/default/agg_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ uiModules
$scope.aggTypeOptions = aggTypeFilters
.filter(aggTypes.byType[$scope.groupName], $scope.indexPattern, $scope.agg);

// If current agg type is not part of allowed agg types, set to first element of allowed agg types
if(!$scope.aggTypeOptions.includes($scope.agg.type)) {
$scope.agg.type = $scope.aggTypeOptions[0];
}

$scope.advancedToggled = false;

// We set up this watch prior to adding the controls below, because when the controls are added,
Expand Down

0 comments on commit 212d7df

Please sign in to comment.