X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/00bf04d74afad9970678b87c02942003e0712cd2..4d73bcbaa792da5854f4d266dd7be32fc99e3289:/src/routes/route-change-handlers.ts diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index b29e5d1e..ca15a150 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -4,8 +4,10 @@ import { History, Location } from 'history'; import { RootStore } from '~/store/store'; -import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute } from './routes'; -import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog } from '~/store/workbench/workbench-actions'; +import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchVirtualMachineRoute } from './routes'; +import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadVirtualMachines } from '~/store/workbench/workbench-actions'; +import { navigateToRootProject } from '~/store/navigation/navigation-action'; +import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions'; export const addRouteChangeHandlers = (history: History, store: RootStore) => { const handler = handleLocationChange(store); @@ -14,13 +16,19 @@ export const addRouteChangeHandlers = (history: History, store: RootStore) => { }; const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { + const rootMatch = matchRootRoute(pathname); const projectMatch = matchProjectRoute(pathname); const collectionMatch = matchCollectionRoute(pathname); const favoriteMatch = matchFavoritesRoute(pathname); const trashMatch = matchTrashRoute(pathname); const processMatch = matchProcessRoute(pathname); const processLogMatch = matchProcessLogRoute(pathname); - + const searchResultsMatch = matchSearchResultsRoute(pathname); + const sharedWithMeMatch = matchSharedWithMeRoute(pathname); + const runProcessMatch = matchRunProcessRoute(pathname); + const virtualMachineMatch = matchVirtualMachineRoute(pathname); + const workflowMatch = matchWorkflowRoute(pathname); + if (projectMatch) { store.dispatch(loadProject(projectMatch.params.id)); } else if (collectionMatch) { @@ -33,5 +41,17 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(loadProcess(processMatch.params.id)); } else if (processLogMatch) { store.dispatch(loadProcessLog(processLogMatch.params.id)); + } else if (rootMatch) { + store.dispatch(navigateToRootProject); + } else if (sharedWithMeMatch) { + store.dispatch(loadSharedWithMe); + } else if (runProcessMatch) { + store.dispatch(loadRunProcess); + } else if (workflowMatch) { + store.dispatch(loadWorkflow); + } else if (searchResultsMatch) { + store.dispatch(loadSearchResults); + } else if (virtualMachineMatch) { + store.dispatch(loadVirtualMachines); } };