X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7e58fd10a7abc133b32a5084796c2b061e03ecd8..eeb82d50816250cc6287928e6d958affa73880ee:/src/views/workbench/workbench.tsx diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 8f0562bbb9..7cccfe3034 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -12,18 +12,21 @@ import Typography from '@material-ui/core/Typography'; import { connect, DispatchProp } from "react-redux"; import Tree from "../../components/tree/tree"; import { Project } from "../../models/project"; -import { RootState } from "../../store/root-reducer"; import ProjectList from "../../components/project-list/project-list"; import { Route, Switch } from "react-router"; import { Link } from "react-router-dom"; import Button from "@material-ui/core/Button/Button"; -import authActions from "../../store/auth-action"; -import { authService } from "../../services/services"; +import authActions from "../../store/auth/auth-action"; import IconButton from "@material-ui/core/IconButton/IconButton"; import Menu from "@material-ui/core/Menu/Menu"; import MenuItem from "@material-ui/core/MenuItem/MenuItem"; import { AccountCircle } from "@material-ui/icons"; -import { AnyAction } from "redux"; +import { User } from "../../models/user"; +import Grid from "@material-ui/core/Grid/Grid"; +import { RootState } from "../../store/store"; + +import { actions as projectActions } from "../../store/project-action"; +import ProjectTree, { WorkbenchProps } from '../../components/project-tree/project-tree'; const drawerWidth = 240; @@ -59,6 +62,7 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ interface WorkbenchDataProps { projects: Project[]; + user?: User; } interface WorkbenchActionProps { @@ -79,12 +83,12 @@ class Workbench extends React.Component { } login = () => { - this.props.dispatch(authActions.LOGIN() as AnyAction); + this.props.dispatch(authActions.LOGIN()); }; logout = () => { this.handleClose(); - this.props.dispatch(authActions.LOGOUT() as AnyAction); + this.props.dispatch(authActions.LOGOUT()); }; handleOpenMenu = (event: React.MouseEvent) => { @@ -100,8 +104,7 @@ class Workbench extends React.Component { }; render() { - const {classes} = this.props; - const userLoggedIn = authService.isUserLoggedIn(); + const {classes, user} = this.props; return (
@@ -109,15 +112,22 @@ class Workbench extends React.Component { Arvados
Workbench 2
- {userLoggedIn ? -
- - - + {user ? + + + + {user.firstName} {user.lastName} + + + + + + + { Logout My account -
+ : }
- {userLoggedIn && + {user &&
- - {p.name} - }/> + }
@@ -164,8 +174,11 @@ class Workbench extends React.Component { export default connect( (state: RootState) => ({ - projects: state.projects - }) + projects: state.projects, + user: state.auth.user + }){ + toggleProjectTreeItem: (id: string) => projectActions.toggleProjectTreeItem(id) + } )( withStyles(styles)(Workbench) );