1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
7 import { Route, Switch } from "react-router";
8 import { ProjectPanel } from "~/views/project-panel/project-panel";
9 import { DetailsPanel } from '~/views-components/details-panel/details-panel';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { ContextMenu } from "~/views-components/context-menu/context-menu";
12 import { FavoritePanel } from "../favorite-panel/favorite-panel";
13 import { CurrentTokenDialog } from '~/views-components/current-token-dialog/current-token-dialog';
14 import { RichTextEditorDialog } from '~/views-components/rich-text-editor-dialog/rich-text-editor-dialog';
15 import { Snackbar } from '~/views-components/snackbar/snackbar';
16 import { CollectionPanel } from '../collection-panel/collection-panel';
17 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
18 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
19 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
20 import { Routes } from '~/routes/routes';
21 import { SidePanel } from '~/views-components/side-panel/side-panel';
22 import { ProcessPanel } from '~/views/process-panel/process-panel';
23 import { ProcessLogPanel } from '~/views/process-log-panel/process-log-panel';
24 import { ChangeWorkflowDialog } from '~/views-components/run-process-dialog/change-workflow-dialog';
25 import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
26 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
27 import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
28 import { CopyProcessDialog } from '~/views-components/dialog-forms/copy-process-dialog';
29 import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
30 import { UpdateProcessDialog } from '~/views-components/dialog-forms/update-process-dialog';
31 import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
32 import { MoveProcessDialog } from '~/views-components/dialog-forms/move-process-dialog';
33 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
34 import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
35 import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
36 import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
37 import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
38 import { RemoveProcessDialog } from '~/views-components/process-remove-dialog/process-remove-dialog';
39 import { MainContentBar } from '~/views-components/main-content-bar/main-content-bar';
40 import { Grid } from '@material-ui/core';
41 import { TrashPanel } from "~/views/trash-panel/trash-panel";
42 import { SharedWithMePanel } from '~/views/shared-with-me-panel/shared-with-me-panel';
43 import { RunProcessPanel } from '~/views/run-process-panel/run-process-panel';
44 import SplitterLayout from 'react-splitter-layout';
45 import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
46 import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel';
47 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
48 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
49 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
51 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
53 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
55 paddingTop: theme.spacing.unit * 7,
56 background: theme.palette.background.default
62 '& > .layout-splitter': {
67 paddingTop: theme.spacing.unit,
71 paddingTop: theme.spacing.unit,
76 paddingLeft: theme.spacing.unit * 3,
77 paddingRight: theme.spacing.unit * 3,
81 type WorkbenchPanelProps = WithStyles<CssRules>;
83 const defaultSplitterSize = 90;
85 const getSplitterInitialSize = () => {
86 const splitterSize = localStorage.getItem('splitterSize');
87 return splitterSize ? Number(splitterSize) : defaultSplitterSize;
90 const saveSplitterSize = (size: number) => localStorage.setItem('splitterSize', size.toString());
92 export const WorkbenchPanel =
93 withStyles(styles)(({ classes }: WorkbenchPanelProps) =>
94 <Grid container item xs className={classes.root}>
95 <Grid container item xs className={classes.container}>
96 <SplitterLayout customClassName={classes.splitter} percentage={true}
97 primaryIndex={0} primaryMinSize={10}
98 secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
99 onSecondaryPaneSizeChange={saveSplitterSize}>
100 <Grid container item xs component='aside' direction='column' className={classes.asidePanel}>
103 <Grid container item xs component="main" direction="column" className={classes.contentWrapper}>
107 <Grid item xs className={classes.content}>
109 <Route path={Routes.PROJECTS} component={ProjectPanel} />
110 <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
111 <Route path={Routes.FAVORITES} component={FavoritePanel} />
112 <Route path={Routes.PROCESSES} component={ProcessPanel} />
113 <Route path={Routes.TRASH} component={TrashPanel} />
114 <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
115 <Route path={Routes.SHARED_WITH_ME} component={SharedWithMePanel} />
116 <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
117 <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
118 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
127 <AdvancedTabDialog />
128 <ChangeWorkflowDialog />
130 <CopyCollectionDialog />
131 <CopyProcessDialog />
132 <CreateCollectionDialog />
133 <CreateProjectDialog />
134 <CurrentTokenDialog />
136 <FilesUploadCollectionDialog />
137 <MoveCollectionDialog />
138 <MoveProcessDialog />
139 <MoveProjectDialog />
140 <MultipleFilesRemoveDialog />
141 <PartialCopyCollectionDialog />
142 <ProcessCommandDialog />
143 <ProcessInputDialog />
144 <RemoveProcessDialog />
146 <RichTextEditorDialog />
149 <UpdateCollectionDialog />
150 <UpdateProcessDialog />
151 <UpdateProjectDialog />