mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
13ba5e2231
commit
67934ca23b
1 changed files with 4 additions and 22 deletions
|
@ -237,28 +237,9 @@ function discoverController(
|
|||
$scope.state = { ...newState };
|
||||
|
||||
// detect changes that should trigger fetching of new data
|
||||
const changes = ['interval', 'sort', 'index', 'query'].filter(
|
||||
const changes = ['interval', 'sort', 'query'].filter(
|
||||
prop => !_.isEqual(newStatePartial[prop], oldStatePartial[prop])
|
||||
);
|
||||
if (changes.indexOf('index') !== -1) {
|
||||
try {
|
||||
$scope.indexPattern = await indexPatterns.get(newStatePartial.index);
|
||||
$scope.opts.timefield = getTimeField();
|
||||
$scope.enableTimeRangeSelector = !!$scope.opts.timefield;
|
||||
// is needed to rerender the histogram
|
||||
$scope.vis = undefined;
|
||||
|
||||
// Taking care of sort when switching index pattern:
|
||||
// Old indexPattern: sort by A
|
||||
// If A is not available in the new index pattern, sort has to be adapted and propagated to URL
|
||||
const sort = getSortArray(newStatePartial.sort, $scope.indexPattern);
|
||||
if (newStatePartial.sort && !_.isEqual(sort, newStatePartial.sort)) {
|
||||
return await replaceUrlAppState({ sort });
|
||||
}
|
||||
} catch (e) {
|
||||
toastNotifications.addWarning({ text: getIndexPatternWarning(newStatePartial.index) });
|
||||
}
|
||||
}
|
||||
|
||||
if (changes.length) {
|
||||
$fetchObservable.next();
|
||||
|
@ -267,8 +248,9 @@ function discoverController(
|
|||
}
|
||||
});
|
||||
|
||||
$scope.setIndexPattern = id => {
|
||||
setAppState({ index: id });
|
||||
$scope.setIndexPattern = async id => {
|
||||
await replaceUrlAppState({ index: id });
|
||||
$route.reload();
|
||||
};
|
||||
|
||||
// update data source when filters update
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue