Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -242,7 +242,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, $scope.model.filters);
}
$scope.refresh();
Expand Down Expand Up @@ -282,7 +282,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 });
});

Expand Down
Expand Up @@ -546,7 +546,8 @@ function discoverController(
}
});

$scope.$watch('state.query', (query) => {
$scope.$watch('state.query', (newQuery) => {
const query = migrateLegacyQuery(newQuery);
$scope.updateQueryAndFetch({ query });
});

Expand Down Expand Up @@ -668,7 +669,7 @@ function discoverController(

$scope.updateQueryAndFetch = function ({ query, dateRange }) {
timefilter.setTime(dateRange);
$state.query = migrateLegacyQuery(query);
$state.query = query;
$scope.fetch();
};

Expand Down
Expand Up @@ -355,7 +355,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 });
});

Expand Down Expand Up @@ -443,7 +444,7 @@ function VisEditor(

$scope.updateQueryAndFetch = function ({ query, dateRange }) {
timefilter.setTime(dateRange);
$state.query = migrateLegacyQuery(query);
$state.query = query;
$scope.fetch();
};

Expand Down