wizard: add Administrator checkbox to users step (HMS-4903)
this commit add Administrator checkbox to users step
This commit is contained in:
parent
bdd259f758
commit
25f124077c
5 changed files with 87 additions and 1 deletions
|
|
@ -1,17 +1,19 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Button, FormGroup } from '@patternfly/react-core';
|
||||
import { Button, FormGroup, Checkbox } from '@patternfly/react-core';
|
||||
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
||||
|
||||
import { GENERATING_SSH_KEY_PAIRS_URL } from '../../../../../constants';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||
import {
|
||||
selectUserAdministrator,
|
||||
selectUserNameByIndex,
|
||||
selectUserPasswordByIndex,
|
||||
selectUserSshKeyByIndex,
|
||||
setUserNameByIndex,
|
||||
setUserPasswordByIndex,
|
||||
setUserSshKeyByIndex,
|
||||
setUserAdministratorByIndex,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
import { useUsersValidation } from '../../../utilities/useValidation';
|
||||
import { HookValidatedInput } from '../../../ValidatedTextInput';
|
||||
|
|
@ -24,6 +26,8 @@ const UserInfo = () => {
|
|||
const userPassword = useAppSelector(userPasswordSelector);
|
||||
const userSshKeySelector = selectUserSshKeyByIndex(index);
|
||||
const userSshKey = useAppSelector(userSshKeySelector);
|
||||
const userIsAdministratorSelector = selectUserAdministrator(index);
|
||||
const userIsAdministrator = useAppSelector(userIsAdministratorSelector);
|
||||
|
||||
const handleNameChange = (
|
||||
_e: React.FormEvent<HTMLInputElement>,
|
||||
|
|
@ -48,6 +52,15 @@ const UserInfo = () => {
|
|||
|
||||
const stepValidation = useUsersValidation();
|
||||
|
||||
const handleCheckboxChange = (
|
||||
_event: React.FormEvent<HTMLInputElement>,
|
||||
value: boolean
|
||||
) => {
|
||||
dispatch(
|
||||
setUserAdministratorByIndex({ index: index, isAdministrator: value })
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormGroup isRequired label="Username">
|
||||
|
|
@ -92,6 +105,16 @@ const UserInfo = () => {
|
|||
Learn more about SSH keys
|
||||
</Button>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
<Checkbox
|
||||
label="Administrator"
|
||||
isChecked={userIsAdministrator}
|
||||
onChange={(_e, value) => handleCheckboxChange(_e, value)}
|
||||
aria-label="Administrator"
|
||||
id="user Administrator"
|
||||
name="user Administrator"
|
||||
/>
|
||||
</FormGroup>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue