mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Fix blank index pattern selector in Discover (#13715)
ui-select-match's expression was expecting an IndexPattern object, but the indexPatternList passed to ui-select-choices contained SavedObject instances due to the [SavedObjectsClient refactor][1]. This wasn't a problem most of the time because switching index patterns caused the entire directive to get destroyed and re-created. However, when the directive didn't get re-created (for example, when clicking the already selected pattern) it would result in a blank select box. Fixes https://github.com/elastic/kibana/issues/13080 [1]: https://github.com/elastic/kibana/pull/12719
This commit is contained in:
parent
a93ee59b5a
commit
c11cd4963b
2 changed files with 4 additions and 2 deletions
|
@ -4,10 +4,9 @@
|
|||
class="index-pattern-selection"
|
||||
ng-model="selectedIndexPattern"
|
||||
on-select="setIndexPattern($item)"
|
||||
ng-init="selectedIndexPattern = indexPattern"
|
||||
>
|
||||
<ui-select-match>
|
||||
{{$select.selected.title}}
|
||||
{{$select.selected.get('title')}}
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="pattern in indexPatternList | filter:$select.search">
|
||||
<div ng-bind-html="pattern.get('title') | highlight: $select.search"></div>
|
||||
|
|
|
@ -30,6 +30,9 @@ app.directive('discFieldChooser', function ($location, globalState, config, $rou
|
|||
},
|
||||
template: fieldChooserTemplate,
|
||||
link: function ($scope) {
|
||||
$scope.selectedIndexPattern = $scope.indexPatternList.find(
|
||||
(pattern) => pattern.id === $scope.indexPattern.id
|
||||
);
|
||||
$scope.indexPatternList = _.sortBy($scope.indexPatternList, o => o.get('title'));
|
||||
$scope.setIndexPattern = function (pattern) {
|
||||
$scope.state.index = pattern.id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue