Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / src / routes / route-change-handlers.ts
index 5b3ce6687ff0e4cb8b3e17a97d286898dda90946..bdc1ddc06325bb473dc7493595df0f42fd56c5a7 100644 (file)
@@ -11,6 +11,7 @@ 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';
+import { openProjectPanel } from 'store/project-panel/project-panel-action';
 
 export const addRouteChangeHandlers = (history: History, store: RootStore) => {
     const handler = handleLocationChange(store);
@@ -33,7 +34,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const runProcessMatch = Routes.matchRunProcessRoute(pathname);
     const virtualMachineUserMatch = Routes.matchUserVirtualMachineRoute(pathname);
     const virtualMachineAdminMatch = Routes.matchAdminVirtualMachineRoute(pathname);
-    const workflowMatch = Routes.matchWorkflowRoute(pathname);
     const sshKeysUserMatch = Routes.matchSshKeysUserRoute(pathname);
     const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname);
     const siteManagerMatch = Routes.matchSiteManagerRoute(pathname);
@@ -48,6 +48,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const linksMatch = Routes.matchLinksRoute(pathname);
     const collectionsContentAddressMatch = Routes.matchCollectionsContentAddressRoute(pathname);
     const allProcessesMatch = Routes.matchAllProcessesRoute(pathname);
+    const registeredWorkflowMatch = Routes.matchRegisteredWorkflowRoute(pathname);
 
     store.dispatch(dialogActions.CLOSE_ALL_DIALOGS());
     store.dispatch(contextMenuActions.CLOSE_CONTEXT_MENU());
@@ -59,8 +60,10 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         }
     }
 
+    document.title = `Arvados (${store.getState().auth.config.uuidPrefix}) - ${pathname.slice(1)}`;
+
     if (projectMatch) {
-        store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id));
+        store.dispatch(openProjectPanel(projectMatch.params.id));
     } else if (collectionMatch) {
         store.dispatch(WorkbenchActions.loadCollection(collectionMatch.params.id));
     } else if (favoriteMatch) {
@@ -77,8 +80,6 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadSharedWithMe);
     } else if (runProcessMatch) {
         store.dispatch(WorkbenchActions.loadRunProcess);
-    } else if (workflowMatch) {
-        store.dispatch(WorkbenchActions.loadWorkflow);
     } else if (searchResultsMatch) {
         store.dispatch(WorkbenchActions.loadSearchResults);
     } else if (virtualMachineUserMatch) {
@@ -115,5 +116,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadCollectionContentAddress);
     } else if (allProcessesMatch) {
         store.dispatch(WorkbenchActions.loadAllProcesses());
+    } else if (registeredWorkflowMatch) {
+        store.dispatch(WorkbenchActions.loadRegisteredWorkflow(registeredWorkflowMatch.params.id));
     }
 };