X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/81db818eb5a3404d0b98e6afbbbccc1ae064fd48..789dabb5b8554237e5caa62a41a61f1793e8353e:/src/views/workbench/workbench.tsx?ds=sidebyside diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 48cab3c6..85ed90c9 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -6,7 +6,7 @@ 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, RouteComponentProps } 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"; @@ -27,6 +27,7 @@ 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; @@ -184,14 +185,8 @@ class Workbench extends React.Component { sidePanelItems={this.props.sidePanelItems}> - this.props.dispatch( - setProjectItem(itemId, ItemMode.OPEN) - )} - toggleActive={itemId => - this.props.dispatch( - setProjectItem(itemId, ItemMode.ACTIVE) - )} + toggleOpen={itemId => this.props.dispatch(setProjectItem(itemId, ItemMode.OPEN))} + toggleActive={itemId => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))} /> } @@ -206,16 +201,15 @@ class Workbench extends React.Component { ); } - renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => { - if (props.match.params.id !== this.props.currentProjectId) { - this.props.dispatch( - setProjectItem(props.match.params.id, ItemMode.ACTIVE) - ); - } - return this.props.dispatch( - setProjectItem(item.uuid, ItemMode.ACTIVE) - )} />; + renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE))} + {...props} /> + + handleItemRouteChange = (itemId: string) => { + this.props.dispatch(sidePanelActions.RESET_SIDE_PANEL_ACTIVITY()); + this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(sidePanelData[0].id)); + this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE)); } }