From b0cb49beedbfcac126469abb37cdf8a061081075 Mon Sep 17 00:00:00 2001 From: Daniel Kos Date: Wed, 6 Jun 2018 08:20:10 +0200 Subject: [PATCH] Add displaying logged user name Feature #13563 Arvados-DCO-1.1-Signed-off-by: Daniel Kos : --- src/views/workbench/workbench.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 8f0562bbb9..13c7ea225f 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -23,7 +23,7 @@ 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"; const drawerWidth = 240; @@ -59,6 +59,7 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ interface WorkbenchDataProps { projects: Project[]; + user: User; } interface WorkbenchActionProps { @@ -79,12 +80,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) => { @@ -111,6 +112,9 @@ class Workbench extends React.Component { {userLoggedIn ?
+ + {this.props.user.firstName} {this.props.user.lastName} + { export default connect( (state: RootState) => ({ - projects: state.projects + projects: state.projects, + user: state.auth.user! }) )( withStyles(styles)(Workbench) -- 2.30.2