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

[6.x] [ML] Fixes Anomaly Explorer resize listener. (#23427) #23429

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions x-pack/plugins/ml/public/explorer/explorer_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,15 @@ module.controller('MlExplorerController', function (
});

// Redraw the swimlane when the window resizes or the global nav is toggled.
$(window).resize(() => {
function jqueryRedrawOnResize() {

if (resizeTimeout !== null) {
$timeout.cancel(resizeTimeout);
}
// Only redraw 500ms after last resize event.
resizeTimeout = $timeout(redrawOnResize, 500);
});
}
$(window).resize(jqueryRedrawOnResize);

const navListener = $scope.$on('globalNav:update', () => {
// Run in timeout so that content pane has resized after global nav has updated.
Expand Down Expand Up @@ -508,6 +510,7 @@ module.controller('MlExplorerController', function (
mlSelectLimitService.state.unwatch(swimlaneLimitListener);
delete $scope.cellData;
refreshWatcher.cancel();
$(window).off('resize', jqueryRedrawOnResize);
// Cancel listening for updates to the global nav state.
navListener();
});
Expand Down