load item to panelDetails and display data
[arvados-workbench2.git] / src / store / navigation / navigation-action.ts
index daeb26fd2a9ee0d9e0b4ab7f8dd5441e93b77412..1cab7349da8399e020b629fae853941357827886 100644 (file)
@@ -6,20 +6,20 @@ import { Dispatch } from "redux";
 import projectActions, { getProjectList } from "../project/project-action";
 import { push } from "react-router-redux";
 import { TreeItemStatus } from "../../components/tree/tree";
-import { getCollectionList } from "../collection/collection-action";
 import { findTreeItem } from "../project/project-reducer";
-import { Resource, ResourceKind } from "../../models/resource";
+import { Resource, ResourceKind as R } from "../../models/resource";
 import sidePanelActions from "../side-panel/side-panel-action";
 import dataExplorerActions from "../data-explorer/data-explorer-action";
 import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
-import { projectPanelItems } from "../../views/project-panel/project-panel-selectors";
 import { RootState } from "../store";
 import { sidePanelData } from "../side-panel/side-panel-reducer";
+import { loadDetails } from "../details-panel/details-panel-action";
+import { ResourceKind } from "../../models/kinds";
 
 export const getResourceUrl = (resource: Resource): string => {
     switch (resource.kind) {
-        case ResourceKind.PROJECT: return `/projects/${resource.uuid}`;
-        case ResourceKind.COLLECTION: return `/collections/${resource.uuid}`;
+        case R.PROJECT: return `/projects/${resource.uuid}`;
+        case R.COLLECTION: return `/collections/${resource.uuid}`;
         default: return "";
     }
 };
@@ -61,17 +61,9 @@ export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
                 : dispatch<any>(getProjectList(itemId));
 
             promise
-                .then(() => dispatch<any>(getCollectionList(itemId)))
                 .then(() => dispatch<any>(() => {
-                    const { projects, collections } = getState();
-                    dispatch(dataExplorerActions.SET_ITEMS({
-                        id: PROJECT_PANEL_ID,
-                        items: projectPanelItems(
-                            projects.items,
-                            treeItem.data.uuid,
-                            collections
-                        )
-                    }));
+                    dispatch(dataExplorerActions.RESET_PAGINATION({id: PROJECT_PANEL_ID}));
+                    dispatch(dataExplorerActions.REQUEST_ITEMS({id: PROJECT_PANEL_ID}));
                 }));
 
         }