diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx b/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx index b93f438b469df..61b4594ae008b 100644 --- a/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx +++ b/x-pack/legacy/plugins/ml/public/components/navigation_menu/top_nav/top_nav.tsx @@ -103,7 +103,13 @@ export const TopNav: FC = () => { isAutoRefreshOnly={!isTimeRangeSelectorEnabled} refreshInterval={refreshInterval.value} onTimeChange={updateFilter} - onRefresh={() => mlTimefilterRefresh$.next()} + onRefresh={() => { + // This check is a workaround to catch a bug in EuiSuperDatePicker which + // might not have disabled the refresh interval after a props change. + if (!refreshInterval.pause) { + mlTimefilterRefresh$.next(); + } + }} onRefreshChange={updateInterval} recentlyUsedRanges={recentlyUsedRanges} dateFormat={dateFormat} diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer.js b/x-pack/legacy/plugins/ml/public/explorer/explorer.js index 7c7108daa1152..7896c2c46a50c 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer.js +++ b/x-pack/legacy/plugins/ml/public/explorer/explorer.js @@ -267,6 +267,7 @@ export const Explorer = injectI18n(injectObservablesAsProps( stateUpdate.indexPattern = indexPattern; this.updateExplorer(stateUpdate, true); + return; } // Listen for changes to job selection. @@ -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; @@ -903,15 +907,21 @@ export const Explorer = injectI18n(injectObservablesAsProps( }); }; + isSwimlaneSelectActive = false; onSwimlaneEnterHandler = () => this.setSwimlaneSelectActive(true); onSwimlaneLeaveHandler = () => this.setSwimlaneSelectActive(false); setSwimlaneSelectActive = (active) => { - if (!active && this.disableDragSelectOnMouseLeave) { - this.dragSelect.clearSelection(); + if (this.isSwimlaneSelectActive && !active && this.disableDragSelectOnMouseLeave) { this.dragSelect.stop(); + this.isSwimlaneSelectActive = active; return; } - this.dragSelect.start(); + if (!this.isSwimlaneSelectActive && active) { + this.dragSelect.start(); + this.dragSelect.clearSelection(); + this.dragSelect.setSelectables(document.getElementsByClassName('sl-cell')); + this.isSwimlaneSelectActive = active; + } }; // This queue tracks click events while the swimlanes are loading. diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js b/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js index 0b83e4d313f13..b1dcd55aed599 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js +++ b/x-pack/legacy/plugins/ml/public/explorer/explorer_controller.js @@ -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 }); } })); @@ -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())); diff --git a/x-pack/package.json b/x-pack/package.json index caabe71612c05..37949ac44b5bd 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -234,7 +234,7 @@ "d3-scale": "1.0.7", "dataloader": "^1.4.0", "dedent": "^0.7.0", - "dragselect": "1.8.1", + "dragselect": "1.13.1", "elasticsearch": "^16.2.0", "extract-zip": "1.6.7", "file-saver": "^1.3.8", diff --git a/yarn.lock b/yarn.lock index 63cb9b51eed9d..7ecfe59ca3661 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10755,10 +10755,10 @@ download@^5.0.3: mkdirp "^0.5.1" pify "^2.3.0" -dragselect@1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/dragselect/-/dragselect-1.8.1.tgz#63f71a6f980f710c87e28b328e175b7afc9e162b" - integrity sha512-4YbJCcS6zwK8vMX2GiIX3tUrXFSo9a6xmV2z66EIJ8nj+iMHP1o4j0PeFdf5zjfhqVZJi+6zuVKPZInnrTLMbw== +dragselect@1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/dragselect/-/dragselect-1.13.1.tgz#aa4166e1164b51ed5ee0cd89e0c5310a9c35be6a" + integrity sha512-spfUz6/sNnlY4fF/OxPBwaKLa5hVz6V+fq5XhVuD+h47RAkA75TMkfvr4AoWUh5Ufq3V1oIAbfu+sjc9QbewoA== duplexer2@0.0.2, duplexer2@~0.0.2: version "0.0.2"