import { withDialog } from '~/store/dialog/with-dialog';
import { WithStyles, withStyles } from '@material-ui/core/styles';
import { ArvadosTheme } from '~/common/custom-theme';
-import { compose } from "redux";
-import { USER_MANAGE_DIALOG } from "~/store/users/users-actions";
+import { compose, Dispatch } from "redux";
+import { USER_MANAGE_DIALOG, openSetupShellAccount } from "~/store/users/users-actions";
import { UserResource } from "~/models/user";
+import { connect } from "react-redux";
type CssRules = 'spacing';
data: UserResource;
}
-type UserManageProps = UserManageDataProps & WithStyles<CssRules>;
+interface UserManageActionProps {
+ openSetupShellAccount: (uuid: string) => void;
+}
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+ openSetupShellAccount: (uuid: string) => dispatch<any>(openSetupShellAccount(uuid))
+});
+
+type UserManageProps = UserManageDataProps & UserManageActionProps & WithStyles<CssRules>;
export const UserManageDialog = compose(
+ connect(null, mapDispatchToProps),
withDialog(USER_MANAGE_DIALOG),
styles)(
(props: WithDialogProps<UserManageProps> & UserManageProps) =>
<Typography variant="body2" className={props.classes.spacing}>
As an admin, you can setup a shell account for this user. The login name is automatically generated from the user's e-mail address.
</Typography>
- <Button variant="contained" color="primary">
+ <Button variant="contained" color="primary" onClick={() => props.openSetupShellAccount(props.data.uuid)}>
{`SETUP SHELL ACCOUNT FOR ${props.data.firstName} ${props.data.lastName}`}
</Button>
</DialogContent>