mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
UI: Update host end user form UX fixes (#36092)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #36056 - Fix submitting form with keyboard enter - Fix opening modal with keyboard enter - [x] Manual QA
This commit is contained in:
parent
8c3dc2aa2f
commit
fa38994494
3 changed files with 18 additions and 6 deletions
|
|
@ -1232,7 +1232,14 @@ const HostDetailsPage = ({
|
|||
isGlobalAdmin ||
|
||||
isGlobalMaintainer
|
||||
}
|
||||
onClickUpdateUser={() => setShowUpdateEndUserModal(true)}
|
||||
onClickUpdateUser={(
|
||||
e:
|
||||
| React.MouseEvent<HTMLButtonElement>
|
||||
| React.KeyboardEvent<HTMLButtonElement>
|
||||
) => {
|
||||
e.preventDefault();
|
||||
setShowUpdateEndUserModal(true);
|
||||
}}
|
||||
/>
|
||||
{showActivityCard && (
|
||||
<ActivityCard
|
||||
|
|
|
|||
|
|
@ -31,7 +31,11 @@ interface IUserProps {
|
|||
disableFullNameTooltip?: boolean;
|
||||
disableGroupsTooltip?: boolean;
|
||||
className?: string;
|
||||
onClickUpdateUser?: () => void;
|
||||
onClickUpdateUser?: (
|
||||
e:
|
||||
| React.MouseEvent<HTMLButtonElement>
|
||||
| React.KeyboardEvent<HTMLButtonElement>
|
||||
) => void;
|
||||
}
|
||||
|
||||
const User = ({
|
||||
|
|
@ -40,7 +44,7 @@ const User = ({
|
|||
disableFullNameTooltip = false,
|
||||
disableGroupsTooltip = false,
|
||||
className,
|
||||
onClickUpdateUser = noop,
|
||||
onClickUpdateUser,
|
||||
}: IUserProps) => {
|
||||
const classNames = classnames(baseClass, className);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ const UpdateEndUserModal = ({
|
|||
const isEditing = !!userNameDisplayValue;
|
||||
const [idpUsername, setIdpUsername] = useState(userNameDisplayValue || "");
|
||||
|
||||
const onSave = () => {
|
||||
const onSave = (e: React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
onUpdate(idpUsername);
|
||||
};
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ const UpdateEndUserModal = ({
|
|||
}
|
||||
return (
|
||||
<>
|
||||
<form>
|
||||
<form onSubmit={onSave}>
|
||||
<InputField
|
||||
label="Username (IdP)"
|
||||
name="username_idp"
|
||||
|
|
@ -57,7 +58,7 @@ const UpdateEndUserModal = ({
|
|||
<Button
|
||||
isLoading={isUpdating}
|
||||
disabled={isUpdating || (!isEditing && idpUsername === "")}
|
||||
onClick={onSave}
|
||||
type="submit"
|
||||
>
|
||||
Save
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue