X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b0ea85a58cf15903e67c5a7161d7887b03af713e..d116e491ef904d97dcece5ab1632bef08906ec87:/src/views/workbench/workbench.tsx diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 1069de530c..ea8fce807f 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -6,8 +6,9 @@ import * as React from 'react'; import { StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core/styles'; import Drawer from '@material-ui/core/Drawer'; import { connect, DispatchProp } from "react-redux"; -import { Route, Switch } from "react-router"; +import { Route, Switch, RouteComponentProps, withRouter } from "react-router"; import authActions from "../../store/auth/auth-action"; +import dataExplorerActions from "../../store/data-explorer/data-explorer-action"; import { User } from "../../models/user"; import { RootState } from "../../store/store"; import MainAppBar, { @@ -19,13 +20,14 @@ import { push } from 'react-router-redux'; import ProjectTree from '../../views-components/project-tree/project-tree'; import { TreeItem } from "../../components/tree/tree"; import { Project } from "../../models/project"; -import { getTreePath } from '../../store/project/project-reducer'; -import ProjectPanel from '../project-panel/project-panel'; +import { getTreePath, findTreeItem } from '../../store/project/project-reducer'; import sidePanelActions from '../../store/side-panel/side-panel-action'; import SidePanel, { SidePanelItem } from '../../components/side-panel/side-panel'; import { ResourceKind } from "../../models/resource"; import { ItemMode, setProjectItem } from "../../store/navigation/navigation-action"; import projectActions from "../../store/project/project-action"; +import ProjectPanel from "../project-panel/project-panel"; +import { sidePanelData } from '../../store/side-panel/side-panel-reducer'; const drawerWidth = 240; const appBarHeight = 102; @@ -90,6 +92,7 @@ interface NavMenuItem extends MainAppBarMenuItem { } interface WorkbenchState { + isCreationDialogOpen: boolean; anchorEl: any; searchText: string; menuItems: { @@ -101,6 +104,7 @@ interface WorkbenchState { class Workbench extends React.Component { state = { + isCreationDialogOpen: false, anchorEl: null, searchText: "", breadcrumbs: [], @@ -132,9 +136,7 @@ class Workbench extends React.Component { mainAppBarActions: MainAppBarActionProps = { onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => { - this.props.dispatch( - setProjectItem(this.props.projects, itemId, ResourceKind.PROJECT, ItemMode.BOTH) - ); + this.props.dispatch(setProjectItem(itemId, ItemMode.BOTH)); }, onSearch: searchText => { this.setState({ searchText }); @@ -152,9 +154,17 @@ class Workbench extends React.Component { this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId)); } + handleCreationDialogOpen = () => { + this.setState({ isCreationDialogOpen: true }); + } + + handleCreationDialogClose = () => { + this.setState({ isCreationDialogOpen: false }); + } + render() { - const branch = getTreePath(this.props.projects, this.props.currentProjectId); - const breadcrumbs = branch.map(item => ({ + const path = getTreePath(this.props.projects, this.props.currentProjectId); + const breadcrumbs = path.map(item => ({ label: item.data.name, itemId: item.data.uuid, status: item.status @@ -182,30 +192,37 @@ class Workbench extends React.Component { + sidePanelItems={this.props.sidePanelItems} + handleCreationDialogOpen={this.handleCreationDialogOpen} + handleCreationDialogClose={this.handleCreationDialogClose}> - this.props.dispatch( - setProjectItem(this.props.projects, itemId, ResourceKind.PROJECT, ItemMode.OPEN) - )} - toggleActive={itemId => - this.props.dispatch( - setProjectItem(this.props.projects, itemId, ResourceKind.PROJECT, ItemMode.ACTIVE) - )} + toggleOpen={itemId => this.props.dispatch(setProjectItem(itemId, ItemMode.OPEN))} + toggleActive={itemId => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))} + handleCreationDialogOpen={this.handleCreationDialogOpen} + handleCreationDialogClose={this.handleCreationDialogClose} /> }
- +
); } + + renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))} + onItemClick={item => this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE))} + handleCreationDialogOpen={this.handleCreationDialogOpen} + handleCreationDialogClose={this.handleCreationDialogClose} + isCreationDialogOpen={this.state.isCreationDialogOpen} + {...props} /> + } export default connect(