16439: Merge branch 'master' into 16439-objects-creation-placement-fix
[arvados-workbench2.git] / src / store / workbench / workbench-actions.ts
index 81e84ac52951542b2b5647e538a7ec637a5ac342..e2ff01f7afa71c6df8e6434ce03d08a830f5c0fb 100644 (file)
@@ -4,7 +4,7 @@
 
 import { Dispatch } from 'redux';
 import { RootState } from "~/store/store";
-import { getUserUuid } from "~/common/getuser"; 
+import { getUserUuid } from "~/common/getuser";
 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 import { favoritePanelActions, loadFavoritePanel } from '~/store/favorite-panel/favorite-panel-action';
@@ -97,6 +97,10 @@ import { loadPublicFavoritePanel, publicFavoritePanelActions } from '~/store/pub
 import { publicFavoritePanelColumns } from '~/views/public-favorites-panel/public-favorites-panel';
 import { loadCollectionsContentAddressPanel, collectionsContentAddressActions } from '~/store/collections-content-address-panel/collections-content-address-panel-actions';
 import { collectionContentAddressPanelColumns } from '~/views/collection-content-address-panel/collection-content-address-panel';
+import { subprocessPanelActions } from '~/store/subprocess-panel/subprocess-panel-actions';
+import { subprocessPanelColumns } from '~/views/subprocess-panel/subprocess-panel-root';
+import { loadAllProcessesPanel, allProcessesPanelActions } from '../all-processes-panel/all-processes-panel-action';
+import { allProcessesPanelColumns } from '~/views/all-processes-panel/all-processes-panel';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -124,6 +128,7 @@ export const loadWorkbench = () =>
         if (user) {
             dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
             dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
+            dispatch(allProcessesPanelActions.SET_COLUMNS({ columns: allProcessesPanelColumns }));
             dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: publicFavoritePanelColumns }));
             dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
             dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
@@ -137,6 +142,7 @@ export const loadWorkbench = () =>
             dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns }));
             dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns }));
             dispatch(collectionsContentAddressActions.SET_COLUMNS({ columns: collectionContentAddressPanelColumns }));
+            dispatch(subprocessPanelActions.SET_COLUMNS({ columns: subprocessPanelColumns }));
 
             if (services.linkAccountService.getAccountToLink()) {
                 dispatch(linkAccountPanelActions.HAS_SESSION_DATA());
@@ -175,6 +181,15 @@ export const loadTrash = () =>
             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
         });
 
+export const loadAllProcesses = () =>
+    handleFirstTimeLoad(
+        (dispatch: Dispatch) => {
+            dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.ALL_PROCESSES));
+            dispatch<any>(loadAllProcessesPanel());
+            dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.ALL_PROCESSES));
+        }
+    );
+
 export const loadProject = (uuid: string) =>
     handleFirstTimeLoad(
         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
@@ -222,7 +237,7 @@ export const createProject = (data: projectCreateActions.ProjectCreateFormDialog
                 kind: SnackbarKind.SUCCESS
             }));
             await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
-            dispatch<any>(reloadProjectMatchingUuid([newProject.ownerUuid]));
+            dispatch<any>(navigateTo(newProject.uuid));
         }
     };
 
@@ -268,7 +283,7 @@ export const loadCollection = (uuid: string) =>
                     OWNED: async collection => {
                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
                         dispatch(updateResources([collection]));
-                        await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
+                        dispatch(activateSidePanelTreeItem(collection.ownerUuid));
                         dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
                         dispatch(loadCollectionPanel(collection.uuid));
                     },
@@ -286,7 +301,6 @@ export const loadCollection = (uuid: string) =>
                         dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
                         dispatch(loadCollectionPanel(collection.uuid));
                     },
-
                 });
             }
         });
@@ -301,7 +315,7 @@ export const createCollection = (data: collectionCreateActions.CollectionCreateF
                 kind: SnackbarKind.SUCCESS
             }));
             dispatch<any>(updateResources([collection]));
-            dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
+            dispatch<any>(navigateTo(collection.uuid));
         }
     };