X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0dbd184178c1016a19828fa80df9f91dec907993..98b3d2afa476478fa3d1acbce7a0784a8daf6945:/src/views/workbench/workbench.tsx

diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 90df260b97..f1f00885ec 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -19,11 +19,13 @@ import ProjectTree from '../../components/project-tree/project-tree';
 import { TreeItem, TreeItemStatus } from "../../components/tree/tree";
 import { Project } from "../../models/project";
 import { projectService } from '../../services/services';
+import { getTreePath } from '../../store/project/project-reducer';
 import DataExplorer from '../data-explorer/data-explorer';
 
 const drawerWidth = 240;
+const appBarHeight = 102;
 
-type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'toolbar';
+type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';
 
 const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
     root: {
@@ -45,12 +47,17 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
         position: 'relative',
         width: drawerWidth,
     },
-    content: {
-        flexGrow: 1,
+    contentWrapper: {
         backgroundColor: theme.palette.background.default,
-        padding: theme.spacing.unit * 3,
-        height: '100%',
+        display: "flex",
+        flexGrow: 1,
         minWidth: 0,
+        paddingTop: appBarHeight
+    },
+    content: {
+        padding: theme.spacing.unit * 3,
+        overflowY: "auto",
+        flexGrow: 1
     },
     toolbar: theme.mixins.toolbar
 });
@@ -66,7 +73,8 @@ interface WorkbenchActionProps {
 type WorkbenchProps = WorkbenchDataProps & WorkbenchActionProps & DispatchProp & WithStyles<CssRules>;
 
 interface NavBreadcrumb extends Breadcrumb {
-    path: string;
+    itemId: string;
+    status: TreeItemStatus;
 }
 
 interface NavMenuItem extends MainAppBarMenuItem {
@@ -88,15 +96,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
     state = {
         anchorEl: null,
         searchText: "",
-        breadcrumbs: [
-            {
-                label: "Projects",
-                path: "/projects"
-            }, {
-                label: "Project 1",
-                path: "/projects/project-1"
-            }
-        ],
+        breadcrumbs: [],
         menuItems: {
             accountMenu: [
                 {
@@ -125,7 +125,9 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
 
 
     mainAppBarActions: MainAppBarActionProps = {
-        onBreadcrumbClick: (breadcrumb: NavBreadcrumb) => this.props.dispatch(push(breadcrumb.path)),
+        onBreadcrumbClick: ({ itemId, status }: NavBreadcrumb) => {
+            this.toggleProjectTreeItem(itemId, status);
+        },
         onSearch: searchText => {
             this.setState({ searchText });
             this.props.dispatch(push(`/search?q=${searchText}`));
@@ -142,6 +144,14 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
     }
 
     openProjectItem = (itemId: string) => {
+        const branch = getTreePath(this.props.projects, itemId);
+        this.setState({
+            breadcrumbs: branch.map(item => ({
+                label: item.data.name,
+                itemId: item.data.uuid,
+                status: item.status
+            }))
+        });
         this.props.dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM(itemId));
         this.props.dispatch(push(`/project/${itemId}`));
     }
@@ -170,12 +180,12 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                             projects={this.props.projects}
                             toggleProjectTreeItem={this.toggleProjectTreeItem} />
                     </Drawer>}
-                <main className={classes.content}>
-                    <div className={classes.toolbar} />
-                    <div className={classes.toolbar} />
-                    <Switch>
-                        <Route path="/project/:name" component={DataExplorer} />
-                    </Switch>
+                <main className={classes.contentWrapper}>
+                    <div className={classes.content}>
+                        <Switch>
+                            <Route path="/project/:name" component={DataExplorer} />
+                        </Switch>
+                    </div>
                 </main>
             </div>
         );
