Redirect on side panel item activation, activate projects item on project tree item...
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 12 Jul 2018 09:57:03 +0000 (11:57 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Thu, 12 Jul 2018 09:57:03 +0000 (11:57 +0200)
Feature #13750

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/store/side-panel/side-panel-reducer.ts
src/views/workbench/workbench.tsx

index 9fc5df1510e37b0f72a86f229c56ca45c0e7c93c..ca26eeb6435b619af28faf2e3a98d68190a83461 100644 (file)
@@ -35,9 +35,18 @@ const sidePanelReducer = (state: SidePanelState = sidePanelData, action: SidePan
     }
 };
 
+export enum SidePanelIdentifiers {
+    Projects = "Projects",
+    SharedWithMe = "SharedWithMe",
+    Workflows = "Workflows",
+    RecentOpen = "RecentOpen",
+    Favourites = "Favourites",
+    Trash = "Trash"
+}
+
 export const sidePanelData = [
     {
-        id: "1",
+        id: SidePanelIdentifiers.Projects,
         name: "Projects",
         icon: "fas fa-th fa-fw",
         open: false,
@@ -46,31 +55,31 @@ export const sidePanelData = [
         openAble: true
     },
     {
-        id: "2",
+        id: SidePanelIdentifiers.SharedWithMe,
         name: "Shared with me",
         icon: "fas fa-users fa-fw",
         active: false,
     },
     {
-        id: "3",
+        id: SidePanelIdentifiers.Workflows,
         name: "Workflows",
         icon: "fas fa-cogs fa-fw",
         active: false,
     },
     {
-        id: "4",
+        id: SidePanelIdentifiers.RecentOpen,
         name: "Recent open",
         icon: "icon-time fa-fw",
         active: false,
     },
     {
-        id: "5",
+        id: SidePanelIdentifiers.Favourites,
         name: "Favorites",
         icon: "fas fa-star fa-fw",
         active: false,
     },
     {
-        id: "6",
+        id: SidePanelIdentifiers.Trash,
         name: "Trash",
         icon: "fas fa-trash-alt fa-fw",
         active: false,
index 6ad4d247456c9d995b3a44562e5defd765756e14..e7a8ae3088d44192d67fc7a0d401b27f92ecac2a 100644 (file)
@@ -34,6 +34,7 @@ import { authService } from '../../services/services';
 
 import detailsPanelActions, { loadDetails } from "../../store/details-panel/details-panel-action";
 import { ResourceKind } from '../../models/kinds';
+import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
 
 const drawerWidth = 240;
 const appBarHeight = 100;
@@ -172,6 +173,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
     toggleSidePanelActive = (itemId: string) => {
         this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
         this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
+        this.props.dispatch(push("/"));
     }
 
     handleCreationDialogOpen = (itemUuid: string) => {
@@ -239,7 +241,8 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                                 toggleActive={itemId => {
                                     this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE));
                                     this.props.dispatch<any>(loadDetails(itemId, ResourceKind.Project));
-                                }}/>
+                                    this.props.dispatch<any>(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(SidePanelIdentifiers.Projects));
+                                }} />
                         </SidePanel>
                     </Drawer>}
                 <main className={classes.contentWrapper}>