1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { connect } from 'react-redux';
7 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
8 import { Route, Switch } from "react-router";
9 import { ProjectPanel } from "~/views/project-panel/project-panel";
10 import { DetailsPanel } from '~/views-components/details-panel/details-panel';
11 import { ArvadosTheme } from '~/common/custom-theme';
12 import { ContextMenu } from "~/views-components/context-menu/context-menu";
13 import { FavoritePanel } from "../favorite-panel/favorite-panel";
14 import { CurrentTokenDialog } from '~/views-components/current-token-dialog/current-token-dialog';
15 import { RichTextEditorDialog } from '~/views-components/rich-text-editor-dialog/rich-text-editor-dialog';
16 import { Snackbar } from '~/views-components/snackbar/snackbar';
17 import { CollectionPanel } from '../collection-panel/collection-panel';
18 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
19 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
20 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
21 import { Routes } from '~/routes/routes';
22 import { SidePanel } from '~/views-components/side-panel/side-panel';
23 import { ProcessPanel } from '~/views/process-panel/process-panel';
24 import { ProcessLogPanel } from '~/views/process-log-panel/process-log-panel';
25 import { ChangeWorkflowDialog } from '~/views-components/run-process-dialog/change-workflow-dialog';
26 import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
27 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
28 import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
29 import { CopyProcessDialog } from '~/views-components/dialog-forms/copy-process-dialog';
30 import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
31 import { UpdateProcessDialog } from '~/views-components/dialog-forms/update-process-dialog';
32 import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
33 import { MoveProcessDialog } from '~/views-components/dialog-forms/move-process-dialog';
34 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
35 import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
36 import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
37 import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
38 import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
39 import { RemoveProcessDialog } from '~/views-components/process-remove-dialog/process-remove-dialog';
40 import { MainContentBar } from '~/views-components/main-content-bar/main-content-bar';
41 import { Grid } from '@material-ui/core';
42 import { TrashPanel } from "~/views/trash-panel/trash-panel";
43 import { SharedWithMePanel } from '~/views/shared-with-me-panel/shared-with-me-panel';
44 import { RunProcessPanel } from '~/views/run-process-panel/run-process-panel';
45 import SplitterLayout from 'react-splitter-layout';
46 import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
47 import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel';
48 import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
49 import { SiteManagerPanel } from "~/views/site-manager-panel/site-manager-panel";
50 import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel';
51 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
52 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
53 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
54 import { VirtualMachineUserPanel } from '~/views/virtual-machine-panel/virtual-machine-user-panel';
55 import { VirtualMachineAdminPanel } from '~/views/virtual-machine-panel/virtual-machine-admin-panel';
56 import { ProjectPropertiesDialog } from '~/views-components/project-properties-dialog/project-properties-dialog';
57 import { RepositoriesPanel } from '~/views/repositories-panel/repositories-panel';
58 import { KeepServicePanel } from '~/views/keep-service-panel/keep-service-panel';
59 import { ComputeNodePanel } from '~/views/compute-node-panel/compute-node-panel';
60 import { ApiClientAuthorizationPanel } from '~/views/api-client-authorization-panel/api-client-authorization-panel';
61 import { LinkPanel } from '~/views/link-panel/link-panel';
62 import { RepositoriesSampleGitDialog } from '~/views-components/repositories-sample-git-dialog/repositories-sample-git-dialog';
63 import { RepositoryAttributesDialog } from '~/views-components/repository-attributes-dialog/repository-attributes-dialog';
64 import { CreateRepositoryDialog } from '~/views-components/dialog-forms/create-repository-dialog';
65 import { RemoveRepositoryDialog } from '~/views-components/repository-remove-dialog/repository-remove-dialog';
66 import { CreateSshKeyDialog } from '~/views-components/dialog-forms/create-ssh-key-dialog';
67 import { PublicKeyDialog } from '~/views-components/ssh-keys-dialog/public-key-dialog';
68 import { RemoveApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/remove-dialog';
69 import { RemoveComputeNodeDialog } from '~/views-components/compute-nodes-dialog/remove-dialog';
70 import { RemoveKeepServiceDialog } from '~/views-components/keep-services-dialog/remove-dialog';
71 import { RemoveLinkDialog } from '~/views-components/links-dialog/remove-dialog';
72 import { RemoveSshKeyDialog } from '~/views-components/ssh-keys-dialog/remove-dialog';
73 import { RemoveVirtualMachineDialog } from '~/views-components/virtual-machines-dialog/remove-dialog';
74 import { AttributesApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/attributes-dialog';
75 import { AttributesComputeNodeDialog } from '~/views-components/compute-nodes-dialog/attributes-dialog';
76 import { AttributesKeepServiceDialog } from '~/views-components/keep-services-dialog/attributes-dialog';
77 import { AttributesLinkDialog } from '~/views-components/links-dialog/attributes-dialog';
78 import { AttributesSshKeyDialog } from '~/views-components/ssh-keys-dialog/attributes-dialog';
79 import { VirtualMachineAttributesDialog } from '~/views-components/virtual-machines-dialog/attributes-dialog';
80 import { UserPanel } from '~/views/user-panel/user-panel';
81 import { UserAttributesDialog } from '~/views-components/user-dialog/attributes-dialog';
82 import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog';
83 import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog';
84 import { UserManageDialog } from '~/views-components/user-dialog/manage-dialog';
85 import { SetupShellAccountDialog } from '~/views-components/dialog-forms/setup-shell-account-dialog';
86 import { GroupsPanel } from '~/views/groups-panel/groups-panel';
87 import { CreateGroupDialog } from '~/views-components/dialog-forms/create-group-dialog';
88 import { RemoveGroupDialog } from '~/views-components/groups-dialog/remove-dialog';
89 import { GroupAttributesDialog } from '~/views-components/groups-dialog/attributes-dialog';
90 import { GroupDetailsPanel } from '~/views/group-details-panel/group-details-panel';
91 import { RemoveGroupMemberDialog } from '~/views-components/groups-dialog/member-remove-dialog';
92 import { GroupMemberAttributesDialog } from '~/views-components/groups-dialog/member-attributes-dialog';
93 import { AddGroupMembersDialog } from '~/views-components/dialog-forms/add-group-member-dialog';
94 import { PartialCopyToCollectionDialog } from '~/views-components/dialog-forms/partial-copy-to-collection-dialog';
95 import { PublicFavoritePanel } from '~/views/public-favorites-panel/public-favorites-panel';
96 import { LinkAccountPanel } from '~/views/link-account-panel/link-account-panel';
97 import { FedLogin } from './fed-login';
98 import { CollectionsContentAddressPanel } from '~/views/collection-content-address-panel/collection-content-address-panel';
100 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
102 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
104 paddingTop: theme.spacing.unit * 7,
105 background: theme.palette.background.default
111 '& > .layout-splitter': {
116 paddingTop: theme.spacing.unit,
120 paddingTop: theme.spacing.unit,
125 paddingLeft: theme.spacing.unit * 3,
126 paddingRight: theme.spacing.unit * 3,
130 interface WorkbenchDataProps {
131 isUserActive: boolean;
132 isNotLinking: boolean;
135 type WorkbenchPanelProps = WithStyles<CssRules> & WorkbenchDataProps;
137 const defaultSplitterSize = 90;
139 const getSplitterInitialSize = () => {
140 const splitterSize = localStorage.getItem('splitterSize');
141 return splitterSize ? Number(splitterSize) : defaultSplitterSize;
144 const saveSplitterSize = (size: number) => localStorage.setItem('splitterSize', size.toString());
146 export const WorkbenchPanel =
147 withStyles(styles)((props: WorkbenchPanelProps) =>
148 <Grid container item xs className={props.classes.root}>
149 <Grid container item xs className={props.classes.container}>
150 <SplitterLayout customClassName={props.classes.splitter} percentage={true}
151 primaryIndex={0} primaryMinSize={10}
152 secondaryInitialSize={getSplitterInitialSize()} secondaryMinSize={40}
153 onSecondaryPaneSizeChange={saveSplitterSize}>
154 { props.isUserActive && props.isNotLinking && <Grid container item xs component='aside' direction='column' className={props.classes.asidePanel}>
157 <Grid container item xs component="main" direction="column" className={props.classes.contentWrapper}>
159 { props.isNotLinking && <MainContentBar /> }
161 <Grid item xs className={props.classes.content}>
163 <Route path={Routes.PROJECTS} component={ProjectPanel} />
164 <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
165 <Route path={Routes.FAVORITES} component={FavoritePanel} />
166 <Route path={Routes.PROCESSES} component={ProcessPanel} />
167 <Route path={Routes.TRASH} component={TrashPanel} />
168 <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
169 <Route path={Routes.SHARED_WITH_ME} component={SharedWithMePanel} />
170 <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
171 <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
172 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
173 <Route path={Routes.VIRTUAL_MACHINES_USER} component={VirtualMachineUserPanel} />
174 <Route path={Routes.VIRTUAL_MACHINES_ADMIN} component={VirtualMachineAdminPanel} />
175 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
176 <Route path={Routes.SSH_KEYS_USER} component={SshKeyPanel} />
177 <Route path={Routes.SSH_KEYS_ADMIN} component={SshKeyPanel} />
178 <Route path={Routes.SITE_MANAGER} component={SiteManagerPanel} />
179 <Route path={Routes.KEEP_SERVICES} component={KeepServicePanel} />
180 <Route path={Routes.USERS} component={UserPanel} />
181 <Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />
182 <Route path={Routes.API_CLIENT_AUTHORIZATIONS} component={ApiClientAuthorizationPanel} />
183 <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
184 <Route path={Routes.GROUPS} component={GroupsPanel} />
185 <Route path={Routes.GROUP_DETAILS} component={GroupDetailsPanel} />
186 <Route path={Routes.LINKS} component={LinkPanel} />
187 <Route path={Routes.PUBLIC_FAVORITES} component={PublicFavoritePanel} />
188 <Route path={Routes.LINK_ACCOUNT} component={LinkAccountPanel} />
189 <Route path={Routes.COLLECTIONS_CONTENT_ADDRESS} component={CollectionsContentAddressPanel} />
198 <AddGroupMembersDialog />
199 <AdvancedTabDialog />
200 <AttributesApiClientAuthorizationDialog />
201 <AttributesComputeNodeDialog />
202 <AttributesKeepServiceDialog />
203 <AttributesLinkDialog />
204 <AttributesSshKeyDialog />
205 <ChangeWorkflowDialog />
207 <CopyCollectionDialog />
208 <CopyProcessDialog />
209 <CreateCollectionDialog />
210 <CreateGroupDialog />
211 <CreateProjectDialog />
212 <CreateRepositoryDialog />
213 <CreateSshKeyDialog />
215 <CurrentTokenDialog />
217 <FilesUploadCollectionDialog />
218 <GroupAttributesDialog />
219 <GroupMemberAttributesDialog />
220 <HelpApiClientAuthorizationDialog />
221 <MoveCollectionDialog />
222 <MoveProcessDialog />
223 <MoveProjectDialog />
224 <MultipleFilesRemoveDialog />
226 <PartialCopyCollectionDialog />
227 <PartialCopyToCollectionDialog />
228 <ProcessCommandDialog />
229 <ProcessInputDialog />
230 <ProjectPropertiesDialog />
231 <RemoveApiClientAuthorizationDialog />
232 <RemoveComputeNodeDialog />
233 <RemoveGroupDialog />
234 <RemoveGroupMemberDialog />
235 <RemoveKeepServiceDialog />
237 <RemoveProcessDialog />
238 <RemoveRepositoryDialog />
239 <RemoveSshKeyDialog />
240 <RemoveVirtualMachineDialog />
242 <RepositoryAttributesDialog />
243 <RepositoriesSampleGitDialog />
244 <RichTextEditorDialog />
245 <SetupShellAccountDialog />
248 <UpdateCollectionDialog />
249 <UpdateProcessDialog />
250 <UpdateProjectDialog />
251 <UserAttributesDialog />
253 <VirtualMachineAttributesDialog />