15230: Link to other workbenches when double-clicking search results.
[arvados-workbench2.git] / src / store / workbench / workbench-actions.ts
index 2bac55af40e998c7e4a41bce9861d902b731877a..fb85c0e0c8392b8b6fb2742358b6246389f069b3 100644 (file)
@@ -32,7 +32,7 @@ import {
     setSidePanelBreadcrumbs,
     setTrashBreadcrumbs
 } from '~/store/breadcrumbs/breadcrumbs-actions';
-import { navigateToProject } from '~/store/navigation/navigation-action';
+import { navigateTo } from '~/store/navigation/navigation-action';
 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
 import { ServiceRepository } from '~/services/services';
 import { getResource } from '~/store/resources/resources';
@@ -68,8 +68,7 @@ import { FilterBuilder } from '~/services/api/filter-builder';
 import { GroupContentsResource } from '~/services/groups-service/groups-service';
 import { MatchCases, ofType, unionize, UnionOf } from '~/common/unionize';
 import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
-import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
-import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
+import { collectionPanelActions, loadCollectionPanel } from "~/store/collection-panel/collection-panel-action";
 import { CollectionResource } from "~/models/collection";
 import {
     loadSearchResultsPanel,
@@ -92,6 +91,10 @@ import { groupsPanelColumns } from '~/views/groups-panel/groups-panel';
 import * as groupDetailsPanelActions from '~/store/group-details-panel/group-details-panel-actions';
 import { groupDetailsPanelColumns } from '~/views/group-details-panel/group-details-panel';
 import { DataTableFetchMode } from "~/components/data-table/data-table";
+import { loadPublicFavoritePanel, publicFavoritePanelActions } from '~/store/public-favorites-panel/public-favorites-action';
+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';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -117,31 +120,28 @@ export const loadWorkbench = () =>
         const { auth, router } = getState();
         const { user } = auth;
         if (user) {
-            const userResource = await dispatch<any>(loadResource(user.uuid));
-            if (userResource) {
-                dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
-                dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
-                dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
-                dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
-                dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
-                dispatch(searchResultsPanelActions.SET_FETCH_MODE({ fetchMode: DataTableFetchMode.INFINITE }));
-                dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
-                dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
-                dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns }));
-                dispatch(groupDetailsPanelActions.GroupDetailsPanelActions.SET_COLUMNS({columns: groupDetailsPanelColumns}));
-                dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
-                dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns }));
-                dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns }));
-
-                dispatch<any>(initSidePanelTree());
-                if (router.location) {
-                    const match = matchRootRoute(router.location.pathname);
-                    if (match) {
-                        dispatch(navigateToProject(userResource.uuid));
-                    }
+            dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
+            dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
+            dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: publicFavoritePanelColumns }));
+            dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
+            dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
+            dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
+            dispatch(searchResultsPanelActions.SET_FETCH_MODE({ fetchMode: DataTableFetchMode.INFINITE }));
+            dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
+            dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
+            dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns }));
+            dispatch(groupDetailsPanelActions.GroupDetailsPanelActions.SET_COLUMNS({ columns: groupDetailsPanelColumns }));
+            dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
+            dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns }));
+            dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns }));
+            dispatch(collectionsContentAddressActions.SET_COLUMNS({ columns: collectionContentAddressPanelColumns }));
+
+            dispatch<any>(initSidePanelTree());
+            if (router.location) {
+                const match = matchRootRoute(router.location.pathname);
+                if (match) {
+                    dispatch<any>(navigateTo(user.uuid));
                 }
-            } else {
-                dispatch(userIsNotAuthenticated);
             }
         } else {
             dispatch(userIsNotAuthenticated);
@@ -156,6 +156,11 @@ export const loadFavorites = () =>
             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
         });
 
+export const loadCollectionContentAddress = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadCollectionsContentAddressPanel());
+    });
+
 export const loadTrash = () =>
     handleFirstTimeLoad(
         (dispatch: Dispatch) => {
@@ -259,21 +264,21 @@ export const loadCollection = (uuid: string) =>
                         dispatch(updateResources([collection]));
                         await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
                         dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
-                        dispatch(loadCollectionFiles(collection.uuid));
+                        dispatch(loadCollectionPanel(collection.uuid));
                     },
                     SHARED: collection => {
                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
                         dispatch(updateResources([collection]));
                         dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
                         dispatch(activateSidePanelTreeItem(collection.ownerUuid));
-                        dispatch(loadCollectionFiles(collection.uuid));
+                        dispatch(loadCollectionPanel(collection.uuid));
                     },
                     TRASHED: collection => {
                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
                         dispatch(updateResources([collection]));
                         dispatch(setTrashBreadcrumbs(''));
                         dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
-                        dispatch(loadCollectionFiles(collection.uuid));
+                        dispatch(loadCollectionPanel(collection.uuid));
                     },
 
                 });
@@ -442,6 +447,14 @@ export const loadWorkflow = handleFirstTimeLoad(async (dispatch: Dispatch<any>)
     dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.WORKFLOWS));
 });
 
+export const loadPublicFavorites = () =>
+    handleFirstTimeLoad(
+        (dispatch: Dispatch) => {
+            dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.PUBLIC_FAVORITES));
+            dispatch<any>(loadPublicFavoritePanel());
+            dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.PUBLIC_FAVORITES));
+        });
+
 export const loadSearchResults = handleFirstTimeLoad(
     async (dispatch: Dispatch<any>) => {
         await dispatch(loadSearchResultsPanel());
@@ -470,9 +483,9 @@ export const loadSshKeys = handleFirstTimeLoad(
     });
 
 export const loadSiteManager = handleFirstTimeLoad(
-async (dispatch: Dispatch<any>) => {
-    await dispatch(loadSiteManagerPanel());
-});
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadSiteManagerPanel());
+    });
 
 export const loadMyAccount = handleFirstTimeLoad(
     (dispatch: Dispatch<any>) => {