keycloak-scim/src/clients/authorization/policy/JavaScript.tsx
Erik Jan de Wit 109c255d90
Added the policy screens (#1884)
* initial policies tab

* added initial edit create screen

* removed switch in favour of mapping list

* added pickers

* added groups

* added regex

* added role select component

* added time

* added js type

* fixed create route

* fixed details

* added tests

* changed table header to required

* added user type

* added missing validation message
2022-01-21 15:10:36 +01:00

43 lines
1.1 KiB
TypeScript

import React from "react";
import { useTranslation } from "react-i18next";
import { Controller, useFormContext } from "react-hook-form";
import { FormGroup } from "@patternfly/react-core";
import { CodeEditor, Language } from "@patternfly/react-code-editor";
import { HelpItem } from "../../../components/help-enabler/HelpItem";
export const JavaScript = () => {
const { t } = useTranslation("clients");
const { control } = useFormContext();
return (
<FormGroup
label={t("code")}
labelIcon={
<HelpItem
helpText="clients-help:policyCode"
fieldLabelId="clients:code"
/>
}
fieldId="code"
isRequired
>
<Controller
name="code"
defaultValue=""
control={control}
render={({ onChange, value }) => (
<CodeEditor
id="code"
data-testid="code"
type="text"
onChange={onChange}
code={value}
height="600px"
language={Language.javascript}
/>
)}
/>
</FormGroup>
);
};