Mergeg branch 'master'
[arvados-workbench2.git] / src / views / workbench / workbench.tsx
index 94ef7db1c8cd70189fd7d822f00ae81adda1a713..1d7d47d09ee89f8085312cf2b0a1b804f823e07c 100644 (file)
@@ -30,18 +30,23 @@ import { ProcessLogPanel } from '~/views/process-log-panel/process-log-panel';
 import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
 import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
+import { CopyProcessDialog } from '~/views-components/dialog-forms/copy-process-dialog';
 import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
+import { UpdateProcessDialog } from '~/views-components/dialog-forms/update-process-dialog';
 import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
+import { MoveProcessDialog } from '~/views-components/dialog-forms/move-process-dialog';
 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
 import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
 import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
 import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
-
 import { TrashPanel } from "~/views/trash-panel/trash-panel";
-import { MainContentBar } from '../../views-components/main-content-bar/main-content-bar';
+import { MainContentBar } from '~/views-components/main-content-bar/main-content-bar';
 import { Grid } from '@material-ui/core';
+import { SharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel';
+import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
+import SplitterLayout from 'react-splitter-layout';
 
-type CssRules = 'root' | 'contentWrapper' | 'content' | 'appBar';
+type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content' | 'appBar';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -49,13 +54,24 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         width: '100vw',
         height: '100vh'
     },
+    container: {
+        position: 'relative'
+    },
+    splitter: {
+        '& > .layout-splitter': {
+            width: '2px'
+        }
+    },
+    asidePanel: {
+        height: '100%',
+        background: theme.palette.background.default
+    },
     contentWrapper: {
         background: theme.palette.background.default,
         minWidth: 0,
     },
     content: {
         minWidth: 0,
-        overflow: 'auto',
         paddingLeft: theme.spacing.unit * 3,
         paddingRight: theme.spacing.unit * 3,
     },
@@ -77,8 +93,6 @@ interface WorkbenchGeneralProps {
 type WorkbenchProps = WorkbenchDataProps & WorkbenchGeneralProps & DispatchProp<any> & WithStyles<CssRules>;
 
 interface WorkbenchState {
-    isCurrentTokenDialogOpen: boolean;
-    anchorEl: any;
     searchText: string;
 }
 
@@ -91,78 +105,71 @@ export const Workbench = withStyles(styles)(
     )(
         class extends React.Component<WorkbenchProps, WorkbenchState> {
             state = {
-                isCurrentTokenDialogOpen: false,
-                anchorEl: null,
                 searchText: "",
             };
-
             render() {
+                const { classes } = this.props;
                 return <>
-                    <Grid
-                        container
-                        direction="column"
-                        className={this.props.classes.root}>
-                        <Grid className={this.props.classes.appBar}>
+                    <Grid container direction="column" className={classes.root}>
+                        <Grid className={classes.appBar}>
                             <MainAppBar
                                 searchText={this.state.searchText}
                                 user={this.props.user}
-                                onSearch={this.onSearch} />
+                                onSearch={this.onSearch}
+                                buildInfo={this.props.buildInfo} />
                         </Grid>
                         {this.props.user &&
-                            <Grid
-                                container
-                                item
-                                xs
-                                alignItems="stretch"
-                                wrap="nowrap">
-                                <Grid item>
-                                    <SidePanel />
-                                </Grid>
-                                <Grid
-                                    container
-                                    item
-                                    xs
-                                    component="main"
-                                    direction="column"
-                                    className={this.props.classes.contentWrapper}>
-                                    <Grid item>
-                                        <MainContentBar />
-                                    </Grid>
-                                    <Grid xs className={this.props.classes.content}>
-                                        <Switch>
-                                            <Route path={Routes.PROJECTS} component={ProjectPanel} />
-                                            <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
-                                            <Route path={Routes.FAVORITES} component={FavoritePanel} />
-                                            <Route path={Routes.PROCESSES} component={ProcessPanel} />
-                                            <Route path={Routes.TRASH} component={TrashPanel} />
-                                            <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
-                                        </Switch>
-                                    </Grid>
+                            <Grid container item xs alignItems="stretch" wrap="nowrap">
+                                <Grid container item className={classes.container}>
+                                <SplitterLayout customClassName={classes.splitter} percentage={true}
+                                    primaryIndex={0} primaryMinSize={20} secondaryInitialSize={80} secondaryMinSize={40}>
+                                        <Grid container item xs component='aside' direction='column' className={classes.asidePanel}>
+                                            <SidePanel />
+                                        </Grid>
+                                        <Grid container item xs component="main" direction="column" className={classes.contentWrapper}>
+                                            <Grid item>
+                                                <MainContentBar />
+                                            </Grid>
+                                            <Grid item xs className={classes.content}>
+                                                <Switch>
+                                                    <Route path={Routes.PROJECTS} component={ProjectPanel} />
+                                                    <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
+                                                    <Route path={Routes.FAVORITES} component={FavoritePanel} />
+                                                    <Route path={Routes.PROCESSES} component={ProcessPanel} />
+                                                    <Route path={Routes.TRASH} component={TrashPanel} />
+                                                    <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
+                                                    <Route path={Routes.SHARED_WITH_ME} component={SharedWithMePanel} />
+                                                </Switch>
+                                            </Grid>
+                                        </Grid>
+                                    </SplitterLayout>
                                 </Grid>
                                 <Grid item>
                                     <DetailsPanel />
                                 </Grid>
-                            </Grid>}
+                            </Grid>
+                        }
                     </Grid>
                     <ContextMenu />
-                    <Snackbar />
-                    <CreateProjectDialog />
+                    <CopyCollectionDialog />
+                    <CopyProcessDialog />
                     <CreateCollectionDialog />
-                    <RenameFileDialog />
-                    <PartialCopyCollectionDialog />
+                    <CreateProjectDialog />
+                    <CurrentTokenDialog />
                     <FileRemoveDialog />
-                    <CopyCollectionDialog />
                     <FileRemoveDialog />
-                    <MultipleFilesRemoveDialog />
-                    <UpdateCollectionDialog />
                     <FilesUploadCollectionDialog />
-                    <UpdateProjectDialog />
                     <MoveCollectionDialog />
+                    <MoveProcessDialog />
                     <MoveProjectDialog />
-                    <CurrentTokenDialog
-                        currentToken={this.props.currentToken}
-                        open={this.state.isCurrentTokenDialogOpen}
-                        handleClose={this.toggleCurrentTokenModal} />
+                    <MultipleFilesRemoveDialog />
+                    <PartialCopyCollectionDialog />
+                    <ProcessCommandDialog />
+                    <RenameFileDialog />
+                    <Snackbar />
+                    <UpdateCollectionDialog />
+                    <UpdateProcessDialog />
+                    <UpdateProjectDialog />
                 </>;
             }
 
@@ -175,9 +182,6 @@ export const Workbench = withStyles(styles)(
                 this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
             }
 
-            toggleCurrentTokenModal = () => {
-                this.setState({ isCurrentTokenDialogOpen: !this.state.isCurrentTokenDialogOpen });
-            }
         }
     )
 );