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 Jul 24, 2018
1 parent 583cc6e commit 6d2a6d6
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="vis-editor-agg-header-description danger" title="{{aggForm.describeErrors()}}">
<span ng-if="!editorOpen && aggForm.$invalid && aggForm.softErrorCount()" class="vis-editor-agg-header-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 @@ -45,6 +45,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 6d2a6d6

Please sign in to comment.