X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/122fba47e0b0629ebb449c5206ba400021bc6de1..41f6f1e495c82fcfa79b87cf718fa2e9cd91c726:/src/routes/route-change-handlers.ts diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index b43e84bb..5b3ce668 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -3,13 +3,14 @@ // SPDX-License-Identifier: AGPL-3.0 import { History, Location } from 'history'; -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'; +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'; +import { pluginConfig } from 'plugins'; export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); @@ -26,7 +27,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const publicFavoritesMatch = Routes.matchPublicFavoritesRoute(pathname); const trashMatch = Routes.matchTrashRoute(pathname); const processMatch = Routes.matchProcessRoute(pathname); - const processLogMatch = Routes.matchProcessLogRoute(pathname); const repositoryMatch = Routes.matchRepositoriesRoute(pathname); const searchResultsMatch = Routes.matchSearchResultsRoute(pathname); const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname); @@ -38,20 +38,27 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname); const siteManagerMatch = Routes.matchSiteManagerRoute(pathname); const keepServicesMatch = Routes.matchKeepServicesRoute(pathname); - const computeNodesMatch = Routes.matchComputeNodesRoute(pathname); const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname); const myAccountMatch = Routes.matchMyAccountRoute(pathname); const linkAccountMatch = Routes.matchLinkAccountRoute(pathname); - const userMatch = Routes.matchUsersRoute(pathname); + const usersMatch = Routes.matchUsersRoute(pathname); + const userProfileMatch = Routes.matchUserProfileRoute(pathname); const groupsMatch = Routes.matchGroupsRoute(pathname); const groupDetailsMatch = Routes.matchGroupDetailsRoute(pathname); const linksMatch = Routes.matchLinksRoute(pathname); const collectionsContentAddressMatch = Routes.matchCollectionsContentAddressRoute(pathname); + const allProcessesMatch = Routes.matchAllProcessesRoute(pathname); store.dispatch(dialogActions.CLOSE_ALL_DIALOGS()); store.dispatch(contextMenuActions.CLOSE_CONTEXT_MENU()); store.dispatch(searchBarActions.CLOSE_SEARCH_VIEW()); + for (const locChangeFn of pluginConfig.locationChangeHandlers) { + if (locChangeFn(store, pathname)) { + return; + } + } + if (projectMatch) { store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); } else if (collectionMatch) { @@ -64,8 +71,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadTrash()); } else if (processMatch) { store.dispatch(WorkbenchActions.loadProcess(processMatch.params.id)); - } else if (processLogMatch) { - store.dispatch(WorkbenchActions.loadProcessLog(processLogMatch.params.id)); } else if (rootMatch) { store.dispatch(navigateToRootProject); } else if (sharedWithMeMatch) { @@ -79,7 +84,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { } else if (virtualMachineUserMatch) { store.dispatch(WorkbenchActions.loadVirtualMachines); } else if (virtualMachineAdminMatch) { - store.dispatch(WorkbenchActions.loadVirtualMachines); + store.dispatch(WorkbenchActions.loadVirtualMachinesAdmin); } else if (repositoryMatch) { store.dispatch(WorkbenchActions.loadRepositories); } else if (sshKeysUserMatch) { @@ -90,16 +95,16 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadSiteManager); } else if (keepServicesMatch) { store.dispatch(WorkbenchActions.loadKeepServices); - } else if (computeNodesMatch) { - store.dispatch(WorkbenchActions.loadComputeNodes); } else if (apiClientAuthorizationsMatch) { store.dispatch(WorkbenchActions.loadApiClientAuthorizations); } else if (myAccountMatch) { - store.dispatch(WorkbenchActions.loadMyAccount); + store.dispatch(WorkbenchActions.loadUserProfile()); } else if (linkAccountMatch) { store.dispatch(WorkbenchActions.loadLinkAccount); - } else if (userMatch) { + } else if (usersMatch) { store.dispatch(WorkbenchActions.loadUsers); + } else if (userProfileMatch) { + store.dispatch(WorkbenchActions.loadUserProfile(userProfileMatch.params.id)); } else if (groupsMatch) { store.dispatch(WorkbenchActions.loadGroupsPanel); } else if (groupDetailsMatch) { @@ -108,5 +113,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadLinks); } else if (collectionsContentAddressMatch) { store.dispatch(WorkbenchActions.loadCollectionContentAddress); + } else if (allProcessesMatch) { + store.dispatch(WorkbenchActions.loadAllProcesses()); } -}; \ No newline at end of file +};