diff --git a/portal-ui/src/screens/Console/Users/AddUser.tsx b/portal-ui/src/screens/Console/Users/AddUser.tsx index 2c8ca9de4..a5d12bb8a 100644 --- a/portal-ui/src/screens/Console/Users/AddUser.tsx +++ b/portal-ui/src/screens/Console/Users/AddUser.tsx @@ -29,11 +29,18 @@ import { import { createStyles, Theme, withStyles } from "@material-ui/core/styles"; import api from "../../../common/api"; import { User } from "./types"; +import GroupsSelectors from "./GroupsSelectors"; const styles = (theme: Theme) => createStyles({ errorBlock: { color: "red" + }, + strongText: { + fontWeight: 700, + }, + keyName: { + marginLeft: 5 } }); @@ -48,6 +55,9 @@ interface IAddUserContentState { addError: string; accessKey: string; secretKey: string; + selectedGroups: string[]; + loadingGroups: boolean; + groupsList: any[]; } class AddUserContent extends React.Component< @@ -58,7 +68,10 @@ class AddUserContent extends React.Component< addLoading: false, addError: "", accessKey: "", - secretKey: "" + secretKey: "", + selectedGroups: [], + loadingGroups: false, + groupsList: [], }; componentDidMount(): void { @@ -74,7 +87,7 @@ class AddUserContent extends React.Component< saveRecord(event: React.FormEvent) { event.preventDefault(); - const { accessKey, addLoading, secretKey } = this.state; + const { accessKey, addLoading, secretKey, selectedGroups } = this.state; const { selectedUser } = this.props; if (addLoading) { return; @@ -133,12 +146,12 @@ class AddUserContent extends React.Component< render() { const { classes, selectedUser } = this.props; - const { addLoading, addError, accessKey, secretKey } = this.state; + const { addLoading, addError, accessKey, secretKey, selectedGroups, loadingGroups, groupsList } = this.state; return ( - Create User + {selectedUser !== null ? 'Edit User' : 'Add User'}
- - {selectedUser !== null ? ( - Edit User - ) : ( - Add User - )} - {addError !== "" && ( )} - - ) => { - this.setState({ accessKey: e.target.value }); - }} - /> - - - ) => { - this.setState({ secretKey: e.target.value }); - }} - autoComplete="current-password" - /> - + + {selectedUser !== null ? ( + + Access Key: + {` ${accessKey}`} + + ) : ( + + + ) => { + this.setState({ accessKey: e.target.value }); + }} + /> + + + ) => { + this.setState({ secretKey: e.target.value }); + }} + autoComplete="current-password" + /> + + + )} +
+ + { + this.setState({ + selectedGroups: elements + }) + } + } + loading={loadingGroups} + records={groupsList} + /> +