Wizard: Add remove user button in users step
this adds remove user button and add unit test as well.
This commit is contained in:
parent
96d68583a3
commit
6e36232e1a
3 changed files with 51 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Button, FormGroup, Checkbox } from '@patternfly/react-core';
|
||||
import { ExternalLinkAltIcon } from '@patternfly/react-icons';
|
||||
import { Button, FormGroup, Checkbox, Tooltip } from '@patternfly/react-core';
|
||||
import { ExternalLinkAltIcon, TrashIcon } from '@patternfly/react-icons';
|
||||
|
||||
import { GENERATING_SSH_KEY_PAIRS_URL } from '../../../../../constants';
|
||||
import { useAppDispatch, useAppSelector } from '../../../../../store/hooks';
|
||||
|
|
@ -14,6 +14,7 @@ import {
|
|||
setUserPasswordByIndex,
|
||||
setUserSshKeyByIndex,
|
||||
setUserAdministratorByIndex,
|
||||
removeUser,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
import { useUsersValidation } from '../../../utilities/useValidation';
|
||||
import {
|
||||
|
|
@ -64,6 +65,10 @@ const UserInfo = () => {
|
|||
);
|
||||
};
|
||||
|
||||
const onRemoveUserClick = () => {
|
||||
dispatch(removeUser(index));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormGroup isRequired label="Username">
|
||||
|
|
@ -119,6 +124,16 @@ const UserInfo = () => {
|
|||
name="user Administrator"
|
||||
/>
|
||||
</FormGroup>
|
||||
<Tooltip position="top-start" content={'Remove user'}>
|
||||
<FormGroup>
|
||||
<Button
|
||||
aria-label="remove user"
|
||||
onClick={onRemoveUserClick}
|
||||
variant="tertiary"
|
||||
icon={<TrashIcon />}
|
||||
></Button>
|
||||
</FormGroup>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue