Add 'copy to clipboard' button for user id (#33491)

Closes #33496

Signed-off-by: Tim Koch <me@timkoch.dev>
This commit is contained in:
Tim 2024-10-09 18:23:59 +02:00 committed by GitHub
parent 1ef845b31d
commit ff44d8dd98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 9 deletions

View file

@ -17,7 +17,7 @@ import { useAlerts } from "@keycloak/keycloak-ui-shared";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { useAccess } from "../../context/access/Access";
import useFormatDate from "../../utils/useFormatDate";
import { CopyToClipboardButton } from "../scopes/CopyToClipboardButton";
import { CopyToClipboardButton } from "../../components/copy-to-clipboard-button/CopyToClipboardButton";
export type ClientSecretProps = {
client: ClientRepresentation;

View file

@ -8,7 +8,7 @@ import {
TextArea,
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { CopyToClipboardButton } from "./CopyToClipboardButton";
import { CopyToClipboardButton } from "../../components/copy-to-clipboard-button/CopyToClipboardButton";
type GeneratedCodeTabProps = {
user?: UserRepresentation;

View file

@ -56,7 +56,7 @@ export * as DetailProvider from "./clients/registration/DetailProvider";
export * as CreateClientRole from "./clients/roles/CreateClientRole";
export { AddScopeDialog } from "./clients/scopes/AddScopeDialog";
export { ClientScopes } from "./clients/scopes/ClientScopes";
export { CopyToClipboardButton } from "./clients/scopes/CopyToClipboardButton";
export { CopyToClipboardButton } from "./components/copy-to-clipboard-button/CopyToClipboardButton";
export { DedicatedScope } from "./clients/scopes/DedicatedScope";
export * as DedicatedScopes from "./clients/scopes/DedicatedScopes";
export { EvaluateScopes } from "./clients/scopes/EvaluateScopes";

View file

@ -39,6 +39,7 @@ import { toUsers } from "./routes/Users";
import { FixedButtonsGroup } from "../components/form/FixedButtonGroup";
import { RequiredActionMultiSelect } from "./user-credentials/RequiredActionMultiSelect";
import { useNavigate } from "react-router-dom";
import { CopyToClipboardButton } from "../components/copy-to-clipboard-button/CopyToClipboardButton";
export type BruteForced = {
isBruteForceProtected?: boolean;
@ -183,12 +184,24 @@ export const UserForm = ({
{user?.id && (
<>
<FormGroup label={t("id")} fieldId="kc-id" isRequired>
<TextInput
id={user.id}
aria-label={t("userID")}
value={user.id}
readOnly
/>
<InputGroup>
<InputGroupItem isFill>
<TextInput
id={user.id}
aria-label={t("userID")}
value={user.id}
readOnly
/>
</InputGroupItem>
<InputGroupItem>
<CopyToClipboardButton
id={`user-${user.id}`}
text={user.id}
label={t("userID")}
variant="control"
/>
</InputGroupItem>
</InputGroup>
</FormGroup>
<FormGroup
label={t("createdAt")}