Fix apps to always migrate legacy queries on state change (#33276)

This commit is contained in:
Lukas Olson 2019-03-15 11:22:25 -07:00
parent 42f97324bb
commit 9637b135b0
3 changed files with 9 additions and 6 deletions

View file

@ -227,7 +227,7 @@ app.directive('dashboardApp', function ($injector) {
// a reload, since no state changes will cause it.
dashboardStateManager.requestReload();
} else {
$scope.model.query = migrateLegacyQuery(query);
$scope.model.query = query;
dashboardStateManager.applyFilters($scope.model.query, filterBar.getFilters());
}
$scope.refresh();
@ -242,7 +242,8 @@ app.directive('dashboardApp', function ($injector) {
$scope.indexPatterns = dashboardStateManager.getPanelIndexPatterns();
};
$scope.$watch('model.query', (query) => {
$scope.$watch('model.query', (newQuery) => {
const query = migrateLegacyQuery(newQuery);
$scope.updateQueryAndFetch({ query });
});

View file

@ -515,7 +515,8 @@ function discoverController(
}
});
$scope.$watch('state.query', (query) => {
$scope.$watch('state.query', (newQuery) => {
const query = migrateLegacyQuery(newQuery);
$scope.updateQueryAndFetch({ query });
});
@ -636,7 +637,7 @@ function discoverController(
};
$scope.updateQueryAndFetch = function ({ query }) {
$state.query = migrateLegacyQuery(query);
$state.query = query;
$scope.fetch();
};

View file

@ -309,7 +309,8 @@ function VisEditor(
$appStatus.dirty = status.dirty || !savedVis.id;
});
$scope.$watch('state.query', (query) => {
$scope.$watch('state.query', (newQuery) => {
const query = migrateLegacyQuery(newQuery);
$scope.updateQueryAndFetch({ query });
});
@ -386,7 +387,7 @@ function VisEditor(
}
$scope.updateQueryAndFetch = function ({ query }) {
$state.query = migrateLegacyQuery(query);
$state.query = query;
$scope.fetch();
};