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 { connect, DispatchProp } from "react-redux";
8 import { Route, Switch } from "react-router";
9 import { User } from "~/models/user";
10 import { RootState } from "~/store/store";
11 import { MainAppBar } from '~/views-components/main-app-bar/main-app-bar';
12 import { push } from 'react-router-redux';
13 import { ProjectPanel } from "~/views/project-panel/project-panel";
14 import { DetailsPanel } from '~/views-components/details-panel/details-panel';
15 import { ArvadosTheme } from '~/common/custom-theme';
16 import { detailsPanelActions } from "~/store/details-panel/details-panel-action";
17 import { ContextMenu } from "~/views-components/context-menu/context-menu";
18 import { FavoritePanel } from "../favorite-panel/favorite-panel";
19 import { CurrentTokenDialog } from '~/views-components/current-token-dialog/current-token-dialog';
20 import { Snackbar } from '~/views-components/snackbar/snackbar';
21 import { CollectionPanel } from '../collection-panel/collection-panel';
22 import { AuthService } from "~/services/auth-service/auth-service";
23 import { RenameFileDialog } from '~/views-components/rename-file-dialog/rename-file-dialog';
24 import { FileRemoveDialog } from '~/views-components/file-remove-dialog/file-remove-dialog';
25 import { MultipleFilesRemoveDialog } from '~/views-components/file-remove-dialog/multiple-files-remove-dialog';
26 import { Routes } from '~/routes/routes';
27 import { SidePanel } from '~/views-components/side-panel/side-panel';
28 import { ProcessPanel } from '~/views/process-panel/process-panel';
29 import { ProcessLogPanel } from '~/views/process-log-panel/process-log-panel';
30 import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
31 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
32 import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
33 import { UpdateCollectionDialog } from '~/views-components/dialog-forms/update-collection-dialog';
34 import { UpdateProjectDialog } from '~/views-components/dialog-forms/update-project-dialog';
35 import { MoveProjectDialog } from '~/views-components/dialog-forms/move-project-dialog';
36 import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-collection-dialog';
37 import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
38 import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
40 import { TrashPanel } from "~/views/trash-panel/trash-panel";
41 import { MainContentBar } from '../../views-components/main-content-bar/main-content-bar';
42 import { Grid } from '@material-ui/core';
44 type CssRules = 'root' | 'contentWrapper' | 'content' | 'appBar';
46 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
53 background: theme.palette.background.default,
59 paddingLeft: theme.spacing.unit * 3,
60 paddingRight: theme.spacing.unit * 3,
67 interface WorkbenchDataProps {
69 currentToken?: string;
72 interface WorkbenchGeneralProps {
73 authService: AuthService;
77 type WorkbenchProps = WorkbenchDataProps & WorkbenchGeneralProps & DispatchProp<any> & WithStyles<CssRules>;
79 interface WorkbenchState {
83 export const Workbench = withStyles(styles)(
84 connect<WorkbenchDataProps>(
85 (state: RootState) => ({
86 user: state.auth.user,
87 currentToken: state.auth.apiToken,
90 class extends React.Component<WorkbenchProps, WorkbenchState> {
100 className={this.props.classes.root}>
101 <Grid className={this.props.classes.appBar}>
103 searchText={this.state.searchText}
104 user={this.props.user}
105 onSearch={this.onSearch}
106 buildInfo={this.props.buildInfo} />
124 className={this.props.classes.contentWrapper}>
128 <Grid item xs className={this.props.classes.content}>
130 <Route path={Routes.PROJECTS} component={ProjectPanel} />
131 <Route path={Routes.COLLECTIONS} component={CollectionPanel} />
132 <Route path={Routes.FAVORITES} component={FavoritePanel} />
133 <Route path={Routes.PROCESSES} component={ProcessPanel} />
134 <Route path={Routes.TRASH} component={TrashPanel} />
135 <Route path={Routes.PROCESS_LOGS} component={ProcessLogPanel} />
146 <CreateProjectDialog />
147 <CreateCollectionDialog />
149 <PartialCopyCollectionDialog />
151 <CopyCollectionDialog />
153 <MultipleFilesRemoveDialog />
154 <UpdateCollectionDialog />
155 <FilesUploadCollectionDialog />
156 <UpdateProjectDialog />
157 <MoveCollectionDialog />
158 <MoveProjectDialog />
159 <CurrentTokenDialog />
163 onSearch = (searchText: string) => {
164 this.setState({ searchText });
165 this.props.dispatch(push(`/search?q=${searchText}`));
168 toggleDetailsPanel = () => {
169 this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());