X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0c46a74e6c0397fa153c345857977f8654ec4471..20bb2125fddc247d8ff2df960b3d4d316e4a0d13:/src/views/workbench/workbench.tsx

diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index a3ee07ee..692c40b8 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -4,232 +4,124 @@
 
 import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
-import { connect, DispatchProp } from "react-redux";
 import { Route, Switch } from "react-router";
-import { login, logout } from "~/store/auth/auth-action";
-import { User } from "~/models/user";
-import { RootState } from "~/store/store";
-import { MainAppBar, MainAppBarActionProps, MainAppBarMenuItem } from '~/views-components/main-app-bar/main-app-bar';
-import { Breadcrumb } from '~/components/breadcrumbs/breadcrumbs';
-import { push } from 'react-router-redux';
-import { TreeItem } from "~/components/tree/tree";
 import { ProjectPanel } from "~/views/project-panel/project-panel";
 import { DetailsPanel } from '~/views-components/details-panel/details-panel';
 import { ArvadosTheme } from '~/common/custom-theme';
-import { CreateProjectDialog } from "~/views-components/create-project-dialog/create-project-dialog";
-import { detailsPanelActions } from "~/store/details-panel/details-panel-action";
-import { openContextMenu } from '~/store/context-menu/context-menu-actions';
-import { ProjectResource } from '~/models/project';
-import { ContextMenu, ContextMenuKind } from "~/views-components/context-menu/context-menu";
+import { ContextMenu } from "~/views-components/context-menu/context-menu";
 import { FavoritePanel } from "../favorite-panel/favorite-panel";
 import { CurrentTokenDialog } from '~/views-components/current-token-dialog/current-token-dialog';
 import { Snackbar } from '~/views-components/snackbar/snackbar';
-import { CreateCollectionDialog } from '~/views-components/create-collection-dialog/create-collection-dialog';
 import { CollectionPanel } from '../collection-panel/collection-panel';
-import { UpdateCollectionDialog } from '~/views-components/update-collection-dialog/update-collection-dialog.';
-import { UpdateProjectDialog } from '~/views-components/update-project-dialog/update-project-dialog';
-import { AuthService } from "~/services/auth-service/auth-service";
 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
-import { DialogCollectionCreateWithSelectedFile } from '~/views-components/create-collection-dialog-with-selected/create-collection-dialog-with-selected';
-import { UploadCollectionFilesDialog } from '~/views-components/upload-collection-files-dialog/upload-collection-files-dialog';
-import { ProjectCopyDialog } from '~/views-components/project-copy-dialog/project-copy-dialog';
-import { CollectionPartialCopyDialog } from '~/views-components/collection-partial-copy-dialog/collection-partial-copy-dialog';
-import { MoveProjectDialog } from '~/views-components/move-project-dialog/move-project-dialog';
-import { MoveCollectionDialog } from '~/views-components/move-collection-dialog/move-collection-dialog';
-import { SidePanel } from '~/views-components/side-panel/side-panel';
 import { Routes } from '~/routes/routes';
-import { navigateTo } from '~/store/navigation/navigation-action';
-import { Breadcrumbs } from '~/views-components/breadcrumbs/breadcrumbs';
-
-
-const APP_BAR_HEIGHT = 100;
-
-type CssRules = 'root' | 'appBar' | 'content' | 'contentWrapper';
+import { SidePanel } from '~/views-components/side-panel/side-panel';
+import { ProcessPanel } from '~/views/process-panel/process-panel';
+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 { Grid } from '@material-ui/core';
+import { SharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel';
+import SplitterLayout from 'react-splitter-layout';
+import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
+import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
+
+type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
-        flexGrow: 1,
-        zIndex: 1,
-        overflow: 'hidden',
-        position: 'relative',
-        display: 'flex',
-        width: '100vw',
-        height: '100vh'
+        paddingTop: theme.spacing.unit * 7,
+        background: theme.palette.background.default
+    },
+    container: {
+        position: 'relative'
+    },
+    splitter: {
+        '& > .layout-splitter': {
+            width: '2px'
+        }
     },
-    appBar: {
-        zIndex: theme.zIndex.drawer + 1,
-        position: "absolute",
-        width: "100%"
+    asidePanel: {
+        paddingTop: theme.spacing.unit,
+        height: '100%'
     },
     contentWrapper: {
-        backgroundColor: theme.palette.background.default,
-        display: "flex",
-        flexGrow: 1,
-        minWidth: 0,
-        paddingTop: APP_BAR_HEIGHT
+        paddingTop: theme.spacing.unit,
+        minWidth: 0
     },
     content: {
-        padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
-        overflowY: "auto",
-        flexGrow: 1,
-        position: 'relative'
-    },
+        minWidth: 0,
+        paddingLeft: theme.spacing.unit * 3,
+        paddingRight: theme.spacing.unit * 3,
+    }
 });
 
-interface WorkbenchDataProps {
-    projects: Array<TreeItem<ProjectResource>>;
-    currentProjectId: string;
-    user?: User;
-    currentToken?: string;
-}
-
-interface WorkbenchGeneralProps {
-    authService: AuthService;
-    buildInfo: string;
-}
-
-interface WorkbenchActionProps {
-}
-
-type WorkbenchProps = WorkbenchDataProps & WorkbenchGeneralProps & WorkbenchActionProps & DispatchProp<any> & WithStyles<CssRules>;
-
-interface NavBreadcrumb extends Breadcrumb {
-    itemId: string;
-}
-
-interface NavMenuItem extends MainAppBarMenuItem {
-    action: () => void;
-}
-
-interface WorkbenchState {
-    isCurrentTokenDialogOpen: boolean;
-    anchorEl: any;
-    searchText: string;
-    menuItems: {
-        accountMenu: NavMenuItem[],
-        helpMenu: NavMenuItem[],
-        anonymousMenu: NavMenuItem[]
-    };
-}
-
-export const Workbench = withStyles(styles)(
-    connect<WorkbenchDataProps>(
-        (state: RootState) => ({
-            projects: state.projects.items,
-            currentProjectId: state.projects.currentItemId,
-            user: state.auth.user,
-            currentToken: state.auth.apiToken,
-        })
-    )(
-        class extends React.Component<WorkbenchProps, WorkbenchState> {
-            state = {
-                isCurrentTokenDialogOpen: false,
-                anchorEl: null,
-                searchText: "",
-                breadcrumbs: [],
-                menuItems: {
-                    accountMenu: [
-                        {
-                            label: 'Current token',
-                            action: () => this.toggleCurrentTokenModal()
-                        },
-                        {
-                            label: "Logout",
-                            action: () => this.props.dispatch(logout())
-                        },
-                        {
-                            label: "My account",
-                            action: () => this.props.dispatch(push("/my-account"))
-                        }
-                    ],
-                    helpMenu: [
-                        {
-                            label: "Help",
-                            action: () => this.props.dispatch(push("/help"))
-                        }
-                    ],
-                    anonymousMenu: [
-                        {
-                            label: "Sign in",
-                            action: () => this.props.dispatch(login())
-                        }
-                    ]
-                }
-            };
-
-            render() {
-                const { classes, user } = this.props;
-                return (
-                    <div className={classes.root}>
-                        <div className={classes.appBar}>
-                            <MainAppBar
-                                breadcrumbs={Breadcrumbs}
-                                searchText={this.state.searchText}
-                                user={this.props.user}
-                                menuItems={this.state.menuItems}
-                                buildInfo={this.props.buildInfo}
-                                {...this.mainAppBarActions} />
-                        </div>
-                        {user && <SidePanel />}
-                        <main className={classes.contentWrapper}>
-                            <div className={classes.content}>
-                                <Switch>
-                                    <Route path={Routes.PROJECTS} component={ProjectPanel} />
-                                    <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
-                                    <Route path={Routes.FAVORITES} component={FavoritePanel} />
-                                </Switch>
-                            </div>
-                            {user && <DetailsPanel />}
-                        </main>
-                        <ContextMenu />
-                        <Snackbar />
-                        <CreateProjectDialog />
-                        <CreateCollectionDialog />
-                        <RenameFileDialog />
-                        <CollectionPartialCopyDialog />
-                        <DialogCollectionCreateWithSelectedFile />
-                        <FileRemoveDialog />
-                        <ProjectCopyDialog />
-                        <MultipleFilesRemoveDialog />
-                        <UpdateCollectionDialog />
-                        <UploadCollectionFilesDialog />
-                        <UpdateProjectDialog />
-                        <MoveCollectionDialog />
-                        <MoveProjectDialog />
-                        <CurrentTokenDialog
-                            currentToken={this.props.currentToken}
-                            open={this.state.isCurrentTokenDialogOpen}
-                            handleClose={this.toggleCurrentTokenModal} />
-                    </div>
-                );
-            }
-
-            mainAppBarActions: MainAppBarActionProps = {
-                onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => {
-                    this.props.dispatch(navigateTo(itemId));
-                },
-                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.props.dispatch<any>(openContextMenu(event, {
-                        uuid: breadcrumb.itemId,
-                        name: breadcrumb.label,
-                        kind: ContextMenuKind.PROJECT
-                    }));
-                }
-            };
-
-            toggleCurrentTokenModal = () => {
-                this.setState({ isCurrentTokenDialogOpen: !this.state.isCurrentTokenDialogOpen });
-            }
-        }
-    )
-);
+type WorkbenchPanelProps = WithStyles<CssRules>;
+
+export const WorkbenchPanel = 
+    withStyles(styles)(({ classes }: WorkbenchPanelProps) => 
+        <Grid container item xs className={classes.root}>
+            <Grid container item xs 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} />
+                                <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
+                            </Switch>
+                        </Grid>
+                    </Grid>
+                </SplitterLayout>
+            </Grid>
+            <Grid item>
+                <DetailsPanel />
+            </Grid>
+            <ContextMenu />
+            <CopyCollectionDialog />
+            <CopyProcessDialog />
+            <CreateCollectionDialog />
+            <CreateProjectDialog />
+            <CurrentTokenDialog />
+            <FileRemoveDialog />
+            <FileRemoveDialog />
+            <FilesUploadCollectionDialog />
+            <MoveCollectionDialog />
+            <MoveProcessDialog />
+            <MoveProjectDialog />
+            <MultipleFilesRemoveDialog />
+            <PartialCopyCollectionDialog />
+            <ProcessCommandDialog />
+            <RenameFileDialog />
+            <Snackbar />
+            <UpdateCollectionDialog />
+            <UpdateProcessDialog />
+            <UpdateProjectDialog />
+        </Grid>
+    );
