Skip to content

Commit

Permalink
Merge pull request #6306 from spalger/fix/autoSelectOptions
Browse files Browse the repository at this point in the history
[vis/editor] auto select the options when appropriate
  • Loading branch information
spalger committed Feb 29, 2016
2 parents eb9927d + f9fd042 commit 6aa765c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/plugins/kibana/public/visualize/editor/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- tabs -->
<ul class="nav navbar-nav">
<li ng-class="{active: sidebar.section == 'data'}" ng-show="vis.type.schemas.metrics">
<li ng-class="{active: sidebar.section == 'data'}" ng-show="sidebar.showData">
<a class="navbar-link active" ng-click="sidebar.section='data'">Data</a>
</li>
<li ng-class="{active: sidebar.section == 'options'}">
Expand Down Expand Up @@ -66,4 +66,3 @@

</form>
</div>

7 changes: 6 additions & 1 deletion src/plugins/kibana/public/visualize/editor/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ uiModules
controller: function ($scope) {
$scope.$bind('vis', 'editableVis');
$scope.$bind('outputVis', 'vis');
this.section = _.get($scope, 'vis.type.requiresSearch') ? 'data' : 'options';
$scope.$watch('vis.type', (visType) => {
if (visType) {
this.showData = visType.schemas.buckets || visType.schemas.metrics;
this.section = this.section || (this.showData ? 'data' : 'options');
}
});
}
};
});

0 comments on commit 6aa765c

Please sign in to comment.