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 { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
48 import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel';
49 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
50 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
51 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
52 import { VirtualMachinePanel } from '~/views/virtual-machine-panel/virtual-machine-panel';
53 import { ProjectPropertiesDialog } from '~/views-components/project-properties-dialog/project-properties-dialog';
54 import { RepositoriesPanel } from '~/views/repositories-panel/repositories-panel';
55 import { KeepServicePanel } from '~/views/keep-service-panel/keep-service-panel';
56 import { ComputeNodePanel } from '~/views/compute-node-panel/compute-node-panel';
57 import { ApiClientAuthorizationPanel } from '~/views/api-client-authorization-panel/api-client-authorization-panel';
58 import { RepositoriesSampleGitDialog } from '~/views-components/repositories-sample-git-dialog/repositories-sample-git-dialog';
59 import { RepositoryAttributesDialog } from '~/views-components/repository-attributes-dialog/repository-attributes-dialog';
60 import { CreateRepositoryDialog } from '~/views-components/dialog-forms/create-repository-dialog';
61 import { RemoveRepositoryDialog } from '~/views-components/repository-remove-dialog/repository-remove-dialog';
62 import { CreateSshKeyDialog } from '~/views-components/dialog-forms/create-ssh-key-dialog';
63 import { PublicKeyDialog } from '~/views-components/ssh-keys-dialog/public-key-dialog';
64 import { RemoveApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/remove-dialog';
65 import { RemoveComputeNodeDialog } from '~/views-components/compute-nodes-dialog/remove-dialog';
66 import { RemoveKeepServiceDialog } from '~/views-components/keep-services-dialog/remove-dialog';
67 import { RemoveSshKeyDialog } from '~/views-components/ssh-keys-dialog/remove-dialog';
68 import { RemoveVirtualMachineDialog } from '~/views-components/virtual-machines-dialog/remove-dialog';
69 import { AttributesApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/attributes-dialog';
70 import { AttributesComputeNodeDialog } from '~/views-components/compute-nodes-dialog/attributes-dialog';
71 import { AttributesKeepServiceDialog } from '~/views-components/keep-services-dialog/attributes-dialog';
72 import { AttributesSshKeyDialog } from '~/views-components/ssh-keys-dialog/attributes-dialog';
73 import { VirtualMachineAttributesDialog } from '~/views-components/virtual-machines-dialog/attributes-dialog';
74 import { UserPanel } from '~/views/user-panel/user-panel';
75 import { UserAttributesDialog } from '~/views-components/user-dialog/attributes-dialog';
76 import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog';
77 import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog';
78 import { GroupsPanel } from '~/views/groups-panel/groups-panel';
79 import { CreateGroupDialog } from '~/views-components/dialog-forms/create-group-dialog';
80 import { RemoveGroupDialog } from '~/views-components/groups-dialog/remove-dialog';
81 import { GroupAttributesDialog } from '~/views-components/groups-dialog/attributes-dialog';
82 import { GroupDetailsPanel } from '~/views/group-details-panel/group-details-panel';
83 import { RemoveGroupMemberDialog } from '~/views-components/groups-dialog/member-remove-dialog';
84 import { GroupMemberAttributesDialog } from '~/views-components/groups-dialog/member-attributes-dialog';
86 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
88 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
90 paddingTop: theme.spacing.unit * 7,
91 background: theme.palette.background.default
97 '& > .layout-splitter': {
102 paddingTop: theme.spacing.unit,
106 paddingTop: theme.spacing.unit,
111 paddingLeft: theme.spacing.unit * 3,
112 paddingRight: theme.spacing.unit * 3,
116 type WorkbenchPanelProps = WithStyles<CssRules>;
118 const defaultSplitterSize = 90;
120 const getSplitterInitialSize = () => {
121 const splitterSize = localStorage.getItem('splitterSize');
122 return splitterSize ? Number(splitterSize) : defaultSplitterSize;
125 const saveSplitterSize = (size: number) => localStorage.setItem('splitterSize', size.toString());
127 export const WorkbenchPanel =
128 withStyles(styles)(({ classes }: WorkbenchPanelProps) =>
129 <Grid container item xs className={classes.root}>
130 <Grid container item xs className={classes.container}>
131 <SplitterLayout customClassName={classes.splitter} percentage={true}
132 primaryIndex={0} primaryMinSize={10}
133 secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
134 onSecondaryPaneSizeChange={saveSplitterSize}>
135 <Grid container item xs component='aside' direction='column' className={classes.asidePanel}>
138 <Grid container item xs component="main" direction="column" className={classes.contentWrapper}>
142 <Grid item xs className={classes.content}>
144 <Route path={Routes.PROJECTS} component={ProjectPanel} />
145 <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
146 <Route path={Routes.FAVORITES} component={FavoritePanel} />
147 <Route path={Routes.PROCESSES} component={ProcessPanel} />
148 <Route path={Routes.TRASH} component={TrashPanel} />
149 <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
150 <Route path={Routes.SHARED_WITH_ME} component={SharedWithMePanel} />
151 <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
152 <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
153 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
154 <Route path={Routes.VIRTUAL_MACHINES} component={VirtualMachinePanel} />
155 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
156 <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
157 <Route path={Routes.KEEP_SERVICES} component={KeepServicePanel} />
158 <Route path={Routes.USERS} component={UserPanel} />
159 <Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />
160 <Route path={Routes.API_CLIENT_AUTHORIZATIONS} component={ApiClientAuthorizationPanel} />
161 <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
162 <Route path={Routes.GROUPS} component={GroupsPanel} />
163 <Route path={Routes.GROUP_DETAILS} component={GroupDetailsPanel} />
172 <AdvancedTabDialog />
173 <AttributesApiClientAuthorizationDialog />
174 <AttributesComputeNodeDialog />
175 <AttributesKeepServiceDialog />
176 <AttributesSshKeyDialog />
177 <ChangeWorkflowDialog />
179 <CopyCollectionDialog />
180 <CopyProcessDialog />
181 <CreateCollectionDialog />
182 <CreateGroupDialog />
183 <CreateProjectDialog />
184 <CreateRepositoryDialog />
185 <CreateSshKeyDialog />
187 <CurrentTokenDialog />
189 <FilesUploadCollectionDialog />
190 <GroupAttributesDialog />
191 <GroupMemberAttributesDialog />
192 <HelpApiClientAuthorizationDialog />
193 <MoveCollectionDialog />
194 <MoveProcessDialog />
195 <MoveProjectDialog />
196 <MultipleFilesRemoveDialog />
198 <PartialCopyCollectionDialog />
199 <ProcessCommandDialog />
200 <ProcessInputDialog />
201 <ProjectPropertiesDialog />
202 <RemoveApiClientAuthorizationDialog />
203 <RemoveComputeNodeDialog />
204 <RemoveGroupDialog />
205 <RemoveGroupMemberDialog />
206 <RemoveKeepServiceDialog />
207 <RemoveProcessDialog />
208 <RemoveRepositoryDialog />
209 <RemoveSshKeyDialog />
210 <RemoveVirtualMachineDialog />
212 <RepositoryAttributesDialog />
213 <RepositoriesSampleGitDialog />
214 <RichTextEditorDialog />
217 <UpdateCollectionDialog />
218 <UpdateProcessDialog />
219 <UpdateProjectDialog />
220 <UserAttributesDialog />
221 <VirtualMachineAttributesDialog />