Merge branch 'master'
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Tue, 17 Jul 2018 09:11:06 +0000 (11:11 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Tue, 17 Jul 2018 09:11:06 +0000 (11:11 +0200)
Feature #13805

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

src/components/breadcrumbs/breadcrumbs.tsx
src/views-components/dialog-create/dialog-project-create.tsx
src/views-components/main-app-bar/main-app-bar.test.tsx
src/views-components/project-list/project-list.tsx [deleted file]
src/views/project-panel/project-panel.tsx
src/views/workbench/workbench.tsx

index 4868e137f9f6b11065bdd2dbfaf3d3ff4ac642da..cfcfd407d99b40aec6c53255864928d5fd0d2a45 100644 (file)
@@ -38,9 +38,7 @@ const Breadcrumbs: React.SFC<BreadcrumbsProps & WithStyles<CssRules>> = ({ class
                                 </Typography>
                             </Button>
                         </Tooltip>
-                        {
-                            !isLastItem && <ChevronRightIcon color="inherit" className={classes.item} />
-                        }
+                        {!isLastItem && <ChevronRightIcon color="inherit" className={classes.item} />}
                     </React.Fragment>
                 );
             })
@@ -51,7 +49,6 @@ const Breadcrumbs: React.SFC<BreadcrumbsProps & WithStyles<CssRules>> = ({ class
 type CssRules = "item" | "currentItem" | "label";
 
 const styles: StyleRulesCallback<CssRules> = theme => {
-    const { unit } = theme.spacing;
     return {
         item: {
             opacity: 0.6
index ef07ea2f4a7d8608bbd2aa523018dca88c8033d8..89deea6f86d8bfc94a7c36859c15a30b73c1faa8 100644 (file)
@@ -87,13 +87,13 @@ class DialogProjectCreate extends React.Component<ProjectCreateProps & WithStyle
     });
   }
 
-  handleProjectName(e: any) {
+  handleProjectName(e: React.ChangeEvent<HTMLInputElement>) {
     this.setState({
       name: e.target.value,
     });
   }
 
-  handleDescriptionValue(e: any) {
+  handleDescriptionValue(e: React.ChangeEvent<HTMLInputElement>) {
     this.setState({
       description: e.target.value,
     });
index f58b26a0f1c27c0415844f852511a868c581cc8d..ac744b9e63d6f37b5809645b543fc63955a6b539 100644 (file)
@@ -28,6 +28,7 @@ describe("<MainAppBar />", () => {
         const mainAppBar = mount(
             <MainAppBar
                 user={user}
+                onContextMenu={jest.fn()}
                 onDetailsPanelToggle={jest.fn()}
                 onContextMenu={jest.fn()}
                 {...{ searchText: "", breadcrumbs: [], menuItems: { accountMenu: [], helpMenu: [], anonymousMenu: [] }, onSearch: jest.fn(), onBreadcrumbClick: jest.fn(), onMenuItemClick: jest.fn() }}
@@ -60,6 +61,7 @@ describe("<MainAppBar />", () => {
             <MainAppBar
                 searchText="search text"
                 searchDebounce={2000}
+                onContextMenu={jest.fn()}
                 onSearch={onSearch}
                 onContextMenu={jest.fn()}
                 onDetailsPanelToggle={jest.fn()}
@@ -79,6 +81,7 @@ describe("<MainAppBar />", () => {
         const mainAppBar = mount(
             <MainAppBar
                 breadcrumbs={items}
+                onContextMenu={jest.fn()}
                 onBreadcrumbClick={onBreadcrumbClick}
                 onContextMenu={jest.fn()}
                 onDetailsPanelToggle={jest.fn()}
@@ -97,6 +100,7 @@ describe("<MainAppBar />", () => {
         const mainAppBar = mount(
             <MainAppBar
                 menuItems={menuItems}
+                onContextMenu={jest.fn()}
                 onMenuItemClick={onMenuItemClick}
                 onContextMenu={jest.fn()}
                 onDetailsPanelToggle={jest.fn()}
diff --git a/src/views-components/project-list/project-list.tsx b/src/views-components/project-list/project-list.tsx
deleted file mode 100644 (file)
index 88cd0f7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import * as React from 'react';
-import { Theme } from "@material-ui/core";
-import { StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core/styles";
-import Paper from "@material-ui/core/Paper/Paper";
-import Table from "@material-ui/core/Table/Table";
-import TableHead from "@material-ui/core/TableHead/TableHead";
-import TableRow from "@material-ui/core/TableRow/TableRow";
-import TableCell from "@material-ui/core/TableCell/TableCell";
-import TableBody from "@material-ui/core/TableBody/TableBody";
-
-type CssRules = 'root' | 'table';
-
-const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
-    root: {
-        width: '100%',
-        marginTop: theme.spacing.unit * 3,
-        overflowX: 'auto',
-    },
-    table: {
-        minWidth: 700,
-    },
-});
-
-interface ProjectListProps {
-}
-
-class ProjectList extends React.Component<ProjectListProps & WithStyles<CssRules>, {}> {
-    render() {
-        const {classes} = this.props;
-        return <Paper className={classes.root}>
-            <Table className={classes.table}>
-                <TableHead>
-                    <TableRow>
-                        <TableCell>Name</TableCell>
-                        <TableCell>Status</TableCell>
-                        <TableCell>Type</TableCell>
-                        <TableCell>Shared by</TableCell>
-                        <TableCell>File size</TableCell>
-                        <TableCell>Last modified</TableCell>
-                    </TableRow>
-                </TableHead>
-                <TableBody>
-                    <TableRow>
-                        <TableCell>Project 1</TableCell>
-                        <TableCell>Complete</TableCell>
-                        <TableCell>Project</TableCell>
-                        <TableCell>John Doe</TableCell>
-                        <TableCell>1.5 GB</TableCell>
-                        <TableCell>9:22 PM</TableCell>
-                    </TableRow>
-                </TableBody>
-            </Table>
-        </Paper>;
-    }
-}
-
-export default withStyles(styles)(ProjectList);
index e34ea1ecda6c72c6bc124ab4113376733d288872..2fdb715ffa3f284373410f33726b908383b0006c 100644 (file)
@@ -37,15 +37,16 @@ type ProjectPanelProps = {
 
 class ProjectPanel extends React.Component<ProjectPanelProps> {
     render() {
+        const { classes, currentItemId, onItemClick, onItemDoubleClick, onContextMenu, onDialogOpen } = this.props;
         return <div>
-            <div className={this.props.classes.toolbar}>
-                <Button color="primary" variant="raised" className={this.props.classes.button}>
+            <div className={classes.toolbar}>
+                <Button color="primary" variant="raised" className={classes.button}>
                     Create a collection
                 </Button>
-                <Button color="primary" variant="raised" className={this.props.classes.button}>
+                <Button color="primary" variant="raised" className={classes.button}>
                     Run a process
                 </Button>
-                <Button color="primary" onClick={() => this.props.onDialogOpen(this.props.currentItemId)} variant="raised" className={this.props.classes.button}>
+                <Button color="primary" onClick={this.handleNewProjectClick} variant="raised" className={classes.button}>
                     New project
                 </Button>
             </div>
@@ -57,10 +58,13 @@ class ProjectPanel extends React.Component<ProjectPanelProps> {
                 extractKey={(item: ProjectPanelItem) => item.uuid} />
         </div>;
     }
-
-    componentWillReceiveProps({ match, currentItemId }: ProjectPanelProps) {
+    
+    handleNewProjectClick = () => {
+        this.props.onDialogOpen(this.props.currentItemId);
+    }
+    componentWillReceiveProps({ match, currentItemId, onItemRouteChange }: ProjectPanelProps) {
         if (match.params.id !== currentItemId) {
-            this.props.onItemRouteChange(match.params.id);
+            onItemRouteChange(match.params.id);
         }
     }
 }
index 13e22d8ca76e72f6fee4a4c9f62ffaf971e03d0e..c7bfc8b4c40966c36827c468d9664f83d6c85a1a 100644 (file)
@@ -36,47 +36,6 @@ import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer'
 import { ProjectResource } from '../../models/project';
 import { ResourceKind } from '../../models/resource';
 
-const drawerWidth = 240;
-const appBarHeight = 100;
-
-type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    root: {
-        flexGrow: 1,
-        zIndex: 1,
-        overflow: 'hidden',
-        position: 'relative',
-        display: 'flex',
-        width: '100vw',
-        height: '100vh'
-    },
-    appBar: {
-        zIndex: theme.zIndex.drawer + 1,
-        position: "absolute",
-        width: "100%"
-    },
-    drawerPaper: {
-        position: 'relative',
-        width: drawerWidth,
-        display: 'flex',
-        flexDirection: 'column',
-    },
-    contentWrapper: {
-        backgroundColor: theme.palette.background.default,
-        display: "flex",
-        flexGrow: 1,
-        minWidth: 0,
-        paddingTop: appBarHeight
-    },
-    content: {
-        padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
-        overflowY: "auto",
-        flexGrow: 1
-    },
-    toolbar: theme.mixins.toolbar
-});
-
 interface WorkbenchDataProps {
     projects: Array<TreeItem<ProjectResource>>;
     currentProjectId: string;
@@ -140,48 +99,6 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
         }
     };
 
-    mainAppBarActions: MainAppBarActionProps = {
-        onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => {
-            this.props.dispatch<any>(setProjectItem(itemId, ItemMode.BOTH));
-            this.props.dispatch<any>(loadDetails(itemId, ResourceKind.Project));
-        },
-        onSearch: searchText => {
-            this.setState({ searchText });
-            this.props.dispatch(push(`/search?q=${searchText}`));
-        },
-        onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(),
-        onDetailsPanelToggle: () => {
-            this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
-        },
-        onContextMenu: (event: React.MouseEvent<HTMLElement>, breadcrumb: NavBreadcrumb) => {
-            this.openContextMenu(event, breadcrumb.itemId, ContextMenuKind.Project);
-        }
-    };
-
-    toggleSidePanelOpen = (itemId: string) => {
-        this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(itemId));
-    }
-
-    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) => {
-        this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid }));
-    }
-
-    openContextMenu = (event: React.MouseEvent<HTMLElement>, itemUuid: string, kind: ContextMenuKind) => {
-        event.preventDefault();
-        this.props.dispatch(
-            contextMenuActions.OPEN_CONTEXT_MENU({
-                position: { x: event.clientX, y: event.clientY },
-                resource: { uuid: itemUuid, kind }
-            })
-        );
-    }
-
     render() {
         const path = getTreePath(this.props.projects, this.props.currentProjectId);
         const breadcrumbs = path.map(item => ({
@@ -250,8 +167,93 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
             this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.Project));
         }}
         {...props} />
+
+    mainAppBarActions: MainAppBarActionProps = {
+        onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => {
+            this.props.dispatch<any>(setProjectItem(itemId, ItemMode.BOTH));
+            this.props.dispatch<any>(loadDetails(itemId, ResourceKind.Project));
+        },
+        onSearch: searchText => {
+            this.setState({ searchText });
+            this.props.dispatch(push(`/search?q=${searchText}`));
+        },
+        onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(),
+        onDetailsPanelToggle: () => {
+            this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
+        },
+        onContextMenu: (event: React.MouseEvent<HTMLElement>, breadcrumb: NavBreadcrumb) => {
+            this.openContextMenu(event, breadcrumb.itemId, ContextMenuKind.Project);
+        }
+    };
+
+    toggleSidePanelOpen = (itemId: string) => {
+        this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(itemId));
+    }
+
+    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) => {
+        this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid }));
+    }
+
+    openContextMenu = (event: React.MouseEvent<HTMLElement>, itemUuid: string, kind: ContextMenuKind) => {
+        event.preventDefault();
+        this.props.dispatch(
+            contextMenuActions.OPEN_CONTEXT_MENU({
+                position: { x: event.clientX, y: event.clientY },
+                resource: { uuid: itemUuid, kind }
+            })
+        );
+    }
+
+
 }
 
+const drawerWidth = 240;
+const appBarHeight = 100;
+
+type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        flexGrow: 1,
+        zIndex: 1,
+        overflow: 'hidden',
+        position: 'relative',
+        display: 'flex',
+        width: '100vw',
+        height: '100vh'
+    },
+    appBar: {
+        zIndex: theme.zIndex.drawer + 1,
+        position: "absolute",
+        width: "100%"
+    },
+    drawerPaper: {
+        position: 'relative',
+        width: drawerWidth,
+        display: 'flex',
+        flexDirection: 'column',
+    },
+    contentWrapper: {
+        backgroundColor: theme.palette.background.default,
+        display: "flex",
+        flexGrow: 1,
+        minWidth: 0,
+        paddingTop: appBarHeight
+    },
+    content: {
+        padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
+        overflowY: "auto",
+        flexGrow: 1
+    },
+    toolbar: theme.mixins.toolbar
+});
+
 export default connect<WorkbenchDataProps>(
     (state: RootState) => ({
         projects: state.projects.items,