-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>
+ );