keycloak-scim/js/apps/admin-ui/src/clients/ClientDescription.tsx

48 lines
1.4 KiB
TypeScript
Raw Normal View History

import { useTranslation } from "react-i18next";
import { TextControl, TextAreaControl } from "ui-shared";
import { FormAccess } from "../components/form/FormAccess";
import { DefaultSwitchControl } from "../components/SwitchControl";
type ClientDescriptionProps = {
protocol?: string;
2022-05-30 09:23:24 +00:00
hasConfigureAccess?: boolean;
};
2022-05-30 09:23:24 +00:00
export const ClientDescription = ({
hasConfigureAccess: configure,
}: ClientDescriptionProps) => {
const { t } = useTranslation("clients");
return (
2022-05-30 09:23:24 +00:00
<FormAccess role="manage-clients" fineGrainedAccess={configure} unWrap>
<TextControl
name="clientId"
2021-04-06 17:39:27 +00:00
label={t("common:clientId")}
labelIcon={t("clients-help:clientId")}
rules={{ required: { value: true, message: t("common:required") } }}
/>
<TextControl
name="name"
label={t("common:name")}
labelIcon={t("clients-help:clientName")}
/>
<TextAreaControl
name="description"
label={t("common:description")}
labelIcon={t("clients-help:description")}
rules={{
maxLength: {
value: 255,
message: t("common:maxLength", { length: 255 }),
},
}}
/>
<DefaultSwitchControl
name="alwaysDisplayInConsole"
label={t("alwaysDisplayInUI")}
labelIcon={t("clients-help:alwaysDisplayInUI")}
/>
</FormAccess>
);
};