fleet/frontend/pages/admin/UserManagementPage/components/ApiKeyDisplay/ApiKeyDisplay.tsx
Nico 578f35292c
[Frontend] Create API-only users that only have access to customer-defined Fleet API endpoints (#43281)
**Related issue:** Resolves #42879

* Full UI for API-only user management: create/edit flows, fleet/role
assignment, selectable API endpoint permissions, and one-time API key
display.
* New reusable components: API user form, endpoint selector, API access
section, and API key presentation.
* Admin workflow switched from in-page modals to dedicated pages and
streamlined action dropdown navigation.
* Layout and styling refinements for user management, team lists, and
dropdown behaviors.

---------

Co-authored-by: Juan Fernandez <juan@fleetdm.com>
2026-04-20 09:18:02 -04:00

40 lines
997 B
TypeScript

import React from "react";
import InfoBanner from "components/InfoBanner/InfoBanner";
import InputFieldHiddenContent from "components/forms/fields/InputFieldHiddenContent";
import Button from "components/buttons/Button";
const baseClass = "api-key-display";
interface IApiKeyDisplayProps {
newUserName: string;
apiKey: string;
onDone: () => void;
}
const ApiKeyDisplay = ({
newUserName,
apiKey,
onDone,
}: IApiKeyDisplayProps) => {
return (
<>
<h1>{newUserName}</h1>
<div className={baseClass}>
<div className={`${baseClass}__api-key-label`}>
<b>API Key</b>
</div>
<InputFieldHiddenContent value={apiKey} name="api-key" />
<InfoBanner color="yellow">
Please make a note of this API key since it is the only time you will
be able to view it.
</InfoBanner>
<div>
<Button onClick={onDone}>Done</Button>
</div>
</div>
</>
);
};
export default ApiKeyDisplay;