diff --git a/x-pack/plugins/ml/public/application/explorer/hooks/use_explorer_url_state.ts b/x-pack/plugins/ml/public/application/explorer/hooks/use_explorer_url_state.ts index d51be619c39eea..805f13f48b01cf 100644 --- a/x-pack/plugins/ml/public/application/explorer/hooks/use_explorer_url_state.ts +++ b/x-pack/plugins/ml/public/application/explorer/hooks/use_explorer_url_state.ts @@ -9,5 +9,16 @@ import { ExplorerAppState } from '../../../../common/types/ml_url_generator'; import { ML_PAGES } from '../../../../common/constants/ml_url_generator'; export function useExplorerUrlState() { - return usePageUrlState(ML_PAGES.ANOMALY_EXPLORER); + /** + * Originally `mlExplorerSwimlane` resided directly in the app URL state (`_a` URL state key). + * With current URL structure it has been moved under the `explorer` key of the app state (_a). + */ + const [legacyExplorerState] = usePageUrlState( + 'mlExplorerSwimlane' + ); + + return usePageUrlState(ML_PAGES.ANOMALY_EXPLORER, { + mlExplorerSwimlane: legacyExplorerState, + mlExplorerFilter: {}, + }); } diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html index 5ce7d9f81f367c..2e93c7eefcf1e5 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/create_watch_flyout/email.html @@ -22,7 +22,7 @@

- + <%= openInAnomalyExplorerLinkText %>
diff --git a/x-pack/plugins/ml/public/application/util/url_state.tsx b/x-pack/plugins/ml/public/application/util/url_state.tsx index 6cdc069096dccd..569e7bcc7b7e1a 100644 --- a/x-pack/plugins/ml/public/application/util/url_state.tsx +++ b/x-pack/plugins/ml/public/application/util/url_state.tsx @@ -162,7 +162,14 @@ export const useUrlState = (accessor: Accessor) => { return [urlState, setUrlState]; }; -type AppStateKey = 'mlSelectSeverity' | 'mlSelectInterval' | 'mlAnomaliesTable' | MlPages; +type LegacyUrlKeys = 'mlExplorerSwimlane'; + +type AppStateKey = + | 'mlSelectSeverity' + | 'mlSelectInterval' + | 'mlAnomaliesTable' + | MlPages + | LegacyUrlKeys; /** * Hook for managing the URL state of the page.