X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ef305b983cd28c2f3535cb6b3eb46e9a02e1a409..0e3c4c507b9d3ec37b808b7a38cf111722659403:/src/views/workbench/workbench.tsx diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 2cca921c..11f36948 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -3,12 +3,11 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; -import { StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core/styles'; +import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; import Drawer from '@material-ui/core/Drawer'; import { connect, DispatchProp } from "react-redux"; -import { Route, Switch, RouteComponentProps, withRouter } from "react-router"; +import { Route, Switch, RouteComponentProps } 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, { @@ -20,22 +19,23 @@ 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, findTreeItem } from '../../store/project/project-reducer'; +import { getTreePath } 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'; import DetailsPanel from '../../views-components/details-panel/details-panel'; +import { ArvadosTheme } from '../../common/custom-theme'; +import detailsPanelActions, { loadDetails } from "../../store/details-panel/details-panel-action"; +import { ResourceKind } from '../../models/kinds'; const drawerWidth = 240; -const appBarHeight = 116; +const appBarHeight = 100; type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar'; -const styles: StyleRulesCallback = (theme: Theme) => ({ +const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { flexGrow: 1, zIndex: 1, @@ -47,7 +47,6 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ }, appBar: { zIndex: theme.zIndex.drawer + 1, - backgroundColor: '#692498', position: "absolute", width: "100%" }, @@ -65,7 +64,7 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ paddingTop: appBarHeight }, content: { - padding: theme.spacing.unit * 3, + padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`, overflowY: "auto", flexGrow: 1 }, @@ -100,9 +99,9 @@ interface WorkbenchState { helpMenu: NavMenuItem[], anonymousMenu: NavMenuItem[] }; - isDetailsPanelOpened: boolean; } + class Workbench extends React.Component { state = { anchorEl: null, @@ -131,8 +130,7 @@ class Workbench extends React.Component { action: () => this.props.dispatch(authActions.LOGIN()) } ] - }, - isDetailsPanelOpened: false + } }; mainAppBarActions: MainAppBarActionProps = { @@ -145,7 +143,7 @@ class Workbench extends React.Component { }, onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(), onDetailsPanelToggle: () => { - this.setState(prev => ({ isDetailsPanelOpened: !prev.isDetailsPanelOpened })); + this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL()); } }; @@ -202,9 +200,7 @@ class Workbench extends React.Component { - + ); @@ -212,7 +208,10 @@ class Workbench extends React.Component { renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))} - onItemClick={item => this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE))} + onItemClick={item => { + this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE)); + this.props.dispatch(loadDetails(item.uuid, item.kind as ResourceKind)); + }} {...props} /> }