X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/090f4825bdd30925a10c6df1b9493df0c2e8f541..ee63ba213e2e56a57e0cd49f6c7ce9bde5014f53:/src/routes/route-change-handlers.ts diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index 34b488de..bc5cbb6a 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -7,6 +7,9 @@ import { RootStore } from '~/store/store'; import * as Routes from '~/routes/routes'; import * as WorkbenchActions from '~/store/workbench/workbench-actions'; import { navigateToRootProject } from '~/store/navigation/navigation-action'; +import { dialogActions } from '~/store/dialog/dialog-actions'; +import { contextMenuActions } from '~/store/context-menu/context-menu-actions'; +import { searchBarActions } from '~/store/search-bar/search-bar-actions'; export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); @@ -26,9 +29,11 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const searchResultsMatch = Routes.matchSearchResultsRoute(pathname); const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname); const runProcessMatch = Routes.matchRunProcessRoute(pathname); - const virtualMachineMatch = Routes.matchVirtualMachineRoute(pathname); + const virtualMachineUserMatch = Routes.matchUserVirtualMachineRoute(pathname); + const virtualMachineAdminMatch = Routes.matchAdminVirtualMachineRoute(pathname); const workflowMatch = Routes.matchWorkflowRoute(pathname); - const sshKeysMatch = Routes.matchSshKeysRoute(pathname); + const sshKeysUserMatch = Routes.matchSshKeysUserRoute(pathname); + const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname); const keepServicesMatch = Routes.matchKeepServicesRoute(pathname); const computeNodesMatch = Routes.matchComputeNodesRoute(pathname); const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname); @@ -36,6 +41,10 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const userMatch = Routes.matchUsersRoute(pathname); const linksMatch = Routes.matchLinksRoute(pathname); + store.dispatch(dialogActions.CLOSE_ALL_DIALOGS()); + store.dispatch(contextMenuActions.CLOSE_CONTEXT_MENU()); + store.dispatch(searchBarActions.CLOSE_SEARCH_VIEW()); + if (projectMatch) { store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); } else if (collectionMatch) { @@ -58,11 +67,15 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadWorkflow); } else if (searchResultsMatch) { store.dispatch(WorkbenchActions.loadSearchResults); - } else if (virtualMachineMatch) { + } else if (virtualMachineUserMatch) { + store.dispatch(WorkbenchActions.loadVirtualMachines); + } else if (virtualMachineAdminMatch) { store.dispatch(WorkbenchActions.loadVirtualMachines); - } else if(repositoryMatch) { + } else if (repositoryMatch) { store.dispatch(WorkbenchActions.loadRepositories); - } else if (sshKeysMatch) { + } else if (sshKeysUserMatch) { + store.dispatch(WorkbenchActions.loadSshKeys); + } else if (sshKeysAdminMatch) { store.dispatch(WorkbenchActions.loadSshKeys); } else if (keepServicesMatch) { store.dispatch(WorkbenchActions.loadKeepServices);