use input instead of TextInput to make them truly hidden (#28618)

fixes: #28546

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-04-16 13:59:23 +02:00 committed by GitHub
parent 8a0cb36673
commit 426c13967d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 17 deletions

View file

@ -1,4 +1,4 @@
import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
import { FormGroup, Switch } from "@patternfly/react-core";
import {
Select,
SelectOption,
@ -61,17 +61,21 @@ export const KerberosSettingsRequired = ({
{/* Required settings */}
<FormAccess role="manage-realm" isHorizontal>
{/* These hidden fields are required so data object written back matches data retrieved */}
<TextInput
hidden
<input
type="hidden"
defaultValue="kerberos"
{...form.register("providerId")}
/>
<TextInput
hidden
<input
type="hidden"
defaultValue="org.keycloak.storage.UserStorageProvider"
{...form.register("providerType")}
/>
<TextInput hidden defaultValue={realm} {...form.register("parentId")} />
<input
type="hidden"
defaultValue={realm}
{...form.register("parentId")}
/>
<TextControl
name="name"
label={t("uiDisplayName")}

View file

@ -1,5 +1,5 @@
import ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
import { FormGroup, TextInput } from "@patternfly/react-core";
import { FormGroup } from "@patternfly/react-core";
import {
Select,
SelectOption,
@ -107,17 +107,21 @@ export const LdapSettingsGeneral = ({
)}
<FormAccess role="manage-realm" isHorizontal>
{/* These hidden fields are required so data object written back matches data retrieved */}
<TextInput
hidden
<input
type="hidden"
defaultValue="ldap"
{...form.register("providerId")}
/>
<TextInput
hidden
<input
type="hidden"
defaultValue="org.keycloak.storage.UserStorageProvider"
{...form.register("providerType")}
/>
<TextInput hidden defaultValue={realm} {...form.register("parentId")} />
<input
type="hidden"
defaultValue={realm}
{...form.register("parentId")}
/>
<TextControl
name="name"
label={t("uiDisplayName")}

View file

@ -8,7 +8,6 @@ import {
ButtonVariant,
FormGroup,
PageSection,
TextInput,
} from "@patternfly/react-core";
import {
DropdownItem,
@ -222,14 +221,14 @@ export default function LdapMapperDetails() {
isDisabled={!isNew}
rules={{ required: t("required") }}
/>
<TextInput
hidden
<input
type="hidden"
defaultValue={isNew ? id : mapping ? mapping.parentId : ""}
data-testid="ldap-mapper-parentId"
{...form.register("parentId")}
/>
<TextInput
hidden
<input
type="hidden"
defaultValue="org.keycloak.storage.ldap.mappers.LDAPStorageMapper"
data-testid="ldap-mapper-provider-type"
{...form.register("providerType")}