[ARVADOS-WORKBENCH2] created: 1.1.4-585-g3626497

Git user git at public.curoverse.com
Mon Aug 13 05:32:48 EDT 2018


        at  3626497d024cddee09990afd6e08a24debaf5c7b (commit)


commit 3626497d024cddee09990afd6e08a24debaf5c7b
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date:   Mon Aug 13 11:25:30 2018 +0200

    redirect from empty routing to root project and display list
    
    Feature #13986
    
    Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>

diff --git a/src/components/side-panel/side-panel.tsx b/src/components/side-panel/side-panel.tsx
index ec648e1..c7649d4 100644
--- a/src/components/side-panel/side-panel.tsx
+++ b/src/components/side-panel/side-panel.tsx
@@ -59,7 +59,7 @@ export interface SidePanelItem {
     open?: boolean;
     margin?: boolean;
     openAble?: boolean;
-    activeAction?: (dispatch: Dispatch) => void;
+    activeAction?: (dispatch: Dispatch, uuid?: string) => void;
 }
 
 interface SidePanelDataProps {
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index defddad..dc68021 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -33,12 +33,11 @@ export enum ItemMode {
 }
 
 export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const { projects, router } = getState();
         const treeItem = findTreeItem(projects.items, itemId);
 
         if (treeItem) {
-
             const resourceUrl = getResourceUrl(treeItem.data);
 
             if (itemMode === ItemMode.ACTIVE || itemMode === ItemMode.BOTH) {
@@ -61,6 +60,13 @@ export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
                     dispatch(projectPanelActions.REQUEST_ITEMS());
                 }));
 
+        } else {
+            const uuid = services.authService.getUuid();
+            if (itemId === uuid) {
+                dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(uuid));
+                dispatch(projectPanelActions.RESET_PAGINATION());
+                dispatch(projectPanelActions.REQUEST_ITEMS());
+            }
         }
     };
 
diff --git a/src/store/project/project-action.ts b/src/store/project/project-action.ts
index 5caf012..9777dc7 100644
--- a/src/store/project/project-action.ts
+++ b/src/store/project/project-action.ts
@@ -26,18 +26,19 @@ export const projectActions = unionize({
     value: 'payload'
 });
 
-export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-    dispatch(projectActions.PROJECTS_REQUEST(parentUuid));
-    return services.projectService.list({
-        filters: FilterBuilder
-            .create()
-            .addEqual("ownerUuid", parentUuid)
-    }).then(({ items: projects }) => {
-        dispatch(projectActions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
-        dispatch<any>(checkPresenceInFavorites(projects.map(project => project.uuid)));
-        return projects;
-    });
-};
+export const getProjectList = (parentUuid: string = '') => 
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(projectActions.PROJECTS_REQUEST(parentUuid));
+        return services.projectService.list({
+            filters: FilterBuilder
+                .create()
+                .addEqual("ownerUuid", parentUuid)
+        }).then(({ items: projects }) => {
+            dispatch(projectActions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
+            dispatch<any>(checkPresenceInFavorites(projects.map(project => project.uuid)));
+            return projects;
+        });
+    };
 
 export const createProject = (project: Partial<ProjectResource>) =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
diff --git a/src/store/side-panel/side-panel-reducer.ts b/src/store/side-panel/side-panel-reducer.ts
index cae42ac..7a27e5a 100644
--- a/src/store/side-panel/side-panel-reducer.ts
+++ b/src/store/side-panel/side-panel-reducer.ts
@@ -9,6 +9,9 @@ import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, Tras
 import { Dispatch } from "redux";
 import { push } from "react-router-redux";
 import { favoritePanelActions } from "../favorite-panel/favorite-panel-action";
+import { projectPanelActions } from "../project-panel/project-panel-action";
+import { projectActions } from "../project/project-action";
+import { getProjectUrl } from "../../models/project";
 
 export type SidePanelState = SidePanelItem[];
 
@@ -56,7 +59,13 @@ export const sidePanelData = [
         open: false,
         active: false,
         margin: true,
-        openAble: true
+        openAble: true,
+        activeAction: (dispatch: Dispatch, uuid: string) => {
+            dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(uuid));
+            dispatch(push(getProjectUrl(uuid)));
+            dispatch(projectPanelActions.RESET_PAGINATION());
+            dispatch(projectPanelActions.REQUEST_ITEMS()); 
+        }
     },
     {
         id: SidePanelIdentifiers.SHARED_WITH_ME,
diff --git a/src/views-components/context-menu/action-sets/root-project-action-set.ts b/src/views-components/context-menu/action-sets/root-project-action-set.ts
index 8c57f47..c88b1b4 100644
--- a/src/views-components/context-menu/action-sets/root-project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/root-project-action-set.ts
@@ -6,14 +6,26 @@ import { reset } from "redux-form";
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { projectActions } from "../../../store/project/project-action";
-import { NewProjectIcon } from "../../../components/icon/icon";
+import { collectionCreateActions } from "../../../store/collections/creator/collection-creator-action";
 import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
+import { COLLECTION_CREATE_DIALOG } from "../../dialog-create/dialog-collection-create";
+import { NewProjectIcon, CollectionIcon } from "../../../components/icon/icon";
 
-export const rootProjectActionSet: ContextMenuActionSet =  [[{
-    icon: NewProjectIcon,
-    name: "New project",
-    execute: (dispatch, resource) => {
-        dispatch(reset(PROJECT_CREATE_DIALOG));
-        dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+export const rootProjectActionSet: ContextMenuActionSet =  [[
+    {
+        icon: NewProjectIcon,
+        name: "New project",
+        execute: (dispatch, resource) => {
+            dispatch(reset(PROJECT_CREATE_DIALOG));
+            dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+        }
+    }, 
+    {
+        icon: CollectionIcon,
+        name: "New Collection",
+        execute: (dispatch, resource) => {
+            dispatch(reset(COLLECTION_CREATE_DIALOG));
+            dispatch(collectionCreateActions.OPEN_COLLECTION_CREATOR({ ownerUuid: resource.uuid }));
+        }
     }
-}]];
+]];
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 9c3ba1b..cf4aca5 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -174,7 +174,7 @@ export const ProjectPanel = withStyles(styles)(
                         onContextMenu={this.props.onContextMenu}
                         extractKey={(item: ProjectPanelItem) => item.uuid}
                         defaultIcon={ProjectIcon}
-                        defaultMessages={['Your project is empty. Please create a project', 'or create a collection and upload a data.']} />
+                        defaultMessages={['Your project is empty.', 'Please create a project or create a collection and upload a data.']} />
                 </div>;
             }
 
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index ce8e246..356a670 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -6,7 +6,7 @@ import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import Drawer from '@material-ui/core/Drawer';
 import { connect, DispatchProp } from "react-redux";
-import { Route, Switch, RouteComponentProps } from "react-router";
+import { Route, Switch, RouteComponentProps, Redirect } from "react-router";
 import { login, logout } from "../../store/auth/auth-action";
 import { User } from "../../models/user";
 import { RootState } from "../../store/store";
@@ -228,6 +228,7 @@ export const Workbench = withStyles(styles)(
                         <main className={classes.contentWrapper}>
                             <div className={classes.content}>
                                 <Switch>
+                                    <Route path='/' exact render={() => <Redirect to={`/projects/${this.props.authService.getUuid()}`}  />} />
                                     <Route path="/projects/:id" render={this.renderProjectPanel} />
                                     <Route path="/favorites" render={this.renderFavoritePanel} />
                                     <Route path="/collections/:id" render={this.renderCollectionPanel} />
@@ -362,9 +363,10 @@ export const Workbench = withStyles(styles)(
             toggleSidePanelActive = (itemId: string) => {
                 this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
                 this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
+
                 const panelItem = this.props.sidePanelItems.find(it => it.id === itemId);
                 if (panelItem && panelItem.activeAction) {
-                    panelItem.activeAction(this.props.dispatch);
+                    panelItem.activeAction(this.props.dispatch, this.props.authService.getUuid());
                 }
             }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list