Create shared-with-me panel skeleton
[arvados-workbench2.git] / src / store / navigation / navigation-action.ts
index 1d36beeca27119aade65cc52eb82e8a4c1c4ac07..b65f687586002047af4164f5da4bd4e0a1923081 100644 (file)
@@ -7,9 +7,10 @@ import { push } from "react-router-redux";
 import { ResourceKind, extractUuidKind } from '~/models/resource';
 import { getCollectionUrl } from "~/models/collection";
 import { getProjectUrl } from "~/models/project";
-
 import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions';
-import { Routes } from '~/routes/routes';
+import { Routes, getProcessUrl, getProcessLogUrl } from '~/routes/routes';
+import { RootState } from '~/store/store';
+import { ServiceRepository } from '~/services/services';
 
 export const navigateTo = (uuid: string) =>
     async (dispatch: Dispatch) => {
@@ -18,6 +19,8 @@ export const navigateTo = (uuid: string) =>
             dispatch<any>(navigateToProject(uuid));
         } else if (kind === ResourceKind.COLLECTION) {
             dispatch<any>(navigateToCollection(uuid));
+        } else if (kind === ResourceKind.CONTAINER_REQUEST) {
+            dispatch<any>(navigateToProcess(uuid));
         }
         if (uuid === SidePanelTreeCategory.FAVORITES) {
             dispatch<any>(navigateToFavorites);
@@ -26,6 +29,21 @@ export const navigateTo = (uuid: string) =>
 
 export const navigateToFavorites = push(Routes.FAVORITES);
 
+export const navigateToTrash = push(Routes.TRASH);
+
 export const navigateToProject = compose(push, getProjectUrl);
 
 export const navigateToCollection = compose(push, getCollectionUrl);
+
+export const navigateToProcess = compose(push, getProcessUrl);
+
+export const navigateToProcessLogs = compose(push, getProcessLogUrl);
+
+export const navigateToRootProject = (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+    const rootProjectUuid = services.authService.getUuid();
+    if (rootProjectUuid) {
+        dispatch(navigateToProject(rootProjectUuid));
+    }
+};
+
+export const navigateToSharedWithMe = push(Routes.SHARED_WITH_ME);