2020-09-17 13:51:40 +00:00
|
|
|
import React from "react";
|
2020-09-03 19:25:05 +00:00
|
|
|
import { FormGroup, TextInput } from "@patternfly/react-core";
|
2020-09-23 19:19:02 +00:00
|
|
|
import { UseFormMethods } from "react-hook-form";
|
2020-09-10 18:04:03 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2020-10-28 18:17:15 +00:00
|
|
|
import { FormAccess } from "../components/form-access/FormAccess";
|
2020-09-03 19:25:05 +00:00
|
|
|
|
|
|
|
type ClientDescriptionProps = {
|
2020-09-23 19:19:02 +00:00
|
|
|
form: UseFormMethods;
|
2020-09-03 19:25:05 +00:00
|
|
|
};
|
|
|
|
|
2020-09-23 19:19:02 +00:00
|
|
|
export const ClientDescription = ({ form }: ClientDescriptionProps) => {
|
2020-09-10 18:04:03 +00:00
|
|
|
const { t } = useTranslation("clients");
|
2020-09-23 19:19:02 +00:00
|
|
|
const { register, errors } = form;
|
2020-09-03 19:25:05 +00:00
|
|
|
return (
|
2020-10-28 18:17:15 +00:00
|
|
|
<FormAccess role="manage-clients" unWrap>
|
2020-09-23 19:19:02 +00:00
|
|
|
<FormGroup
|
|
|
|
label={t("clientID")}
|
|
|
|
fieldId="kc-client-id"
|
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
validated={errors.clientId ? "error" : "default"}
|
|
|
|
isRequired
|
|
|
|
>
|
2020-09-03 19:25:05 +00:00
|
|
|
<TextInput
|
2020-09-23 19:19:02 +00:00
|
|
|
ref={register({ required: true })}
|
2020-09-03 19:25:05 +00:00
|
|
|
type="text"
|
|
|
|
id="kc-client-id"
|
|
|
|
name="clientId"
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2020-09-16 14:56:23 +00:00
|
|
|
<FormGroup label={t("name")} fieldId="kc-name">
|
2020-09-17 13:51:40 +00:00
|
|
|
<TextInput ref={register()} type="text" id="kc-name" name="name" />
|
2020-09-03 19:25:05 +00:00
|
|
|
</FormGroup>
|
2020-09-16 14:56:23 +00:00
|
|
|
<FormGroup label={t("description")} fieldId="kc-description">
|
2020-09-03 19:25:05 +00:00
|
|
|
<TextInput
|
2020-09-17 13:51:40 +00:00
|
|
|
ref={register()}
|
2020-09-03 19:25:05 +00:00
|
|
|
type="text"
|
|
|
|
id="kc-description"
|
|
|
|
name="description"
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2020-10-28 18:17:15 +00:00
|
|
|
</FormAccess>
|
2020-09-03 19:25:05 +00:00
|
|
|
);
|
|
|
|
};
|