Skip to content

Commit

Permalink
[ML] Fixes retaining the swimlane selection on a timefilter refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Aug 22, 2019
1 parent c9a870b commit 3d1c43d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 4 additions & 0 deletions x-pack/legacy/plugins/ml/public/explorer/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const Explorer = injectI18n(injectObservablesAsProps(
stateUpdate.indexPattern = indexPattern;

this.updateExplorer(stateUpdate, true);
return;
}

// Listen for changes to job selection.
Expand Down Expand Up @@ -313,17 +314,20 @@ export const Explorer = injectI18n(injectObservablesAsProps(
}

this.updateExplorer(stateUpdate, true);
return;
}

// RELOAD reloads full Anomaly Explorer and clears the selection.
if (action === EXPLORER_ACTION.RELOAD) {
this.props.appStateHandler(APP_STATE_ACTION.CLEAR_SELECTION);
this.updateExplorer({ ...payload, ...getClearedSelectedAnomaliesState() }, true);
return;
}

// REDRAW reloads Anomaly Explorer and tries to retain the selection.
if (action === EXPLORER_ACTION.REDRAW) {
this.updateExplorer({}, false);
return;
}
} else if (this.previousSwimlaneLimit !== this.props.swimlaneLimit) {
this.previousSwimlaneLimit = this.props.swimlaneLimit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.controller('MlExplorerController', function (

subscriptions.add(mlTimefilterRefresh$.subscribe(() => {
if ($scope.jobSelectionUpdateInProgress === false) {
explorer$.next({ action: EXPLORER_ACTION.RELOAD });
explorer$.next({ action: EXPLORER_ACTION.REDRAW });
}
}));

Expand All @@ -209,13 +209,6 @@ module.controller('MlExplorerController', function (
}
});

// Add a watcher for auto-refresh of the time filter to refresh all the data.
subscriptions.add(mlTimefilterRefresh$.subscribe(() => {
if ($scope.jobSelectionUpdateInProgress === false) {
explorer$.next({ action: EXPLORER_ACTION.RELOAD });
}
}));

subscriptions.add(subscribeAppStateToObservable(AppState, 'mlShowCharts', showCharts$, () => $rootScope.$applyAsync()));
subscriptions.add(subscribeAppStateToObservable(AppState, 'mlSelectInterval', interval$, () => $rootScope.$applyAsync()));
subscriptions.add(subscribeAppStateToObservable(AppState, 'mlSelectSeverity', severity$, () => $rootScope.$applyAsync()));
Expand Down

0 comments on commit 3d1c43d

Please sign in to comment.