made user required (#33771)
reverts changes made in https://github.com/keycloak/keycloak-ui/pull/4494 fixes: #33404 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
0ebf862b63
commit
243e357173
1 changed files with 3 additions and 10 deletions
|
@ -25,7 +25,7 @@ import {
|
|||
Title,
|
||||
} from "@patternfly/react-core";
|
||||
import { useState } from "react";
|
||||
import { FormProvider, useForm, useWatch } from "react-hook-form";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ForbiddenSection } from "../../ForbiddenSection";
|
||||
import { useAdminClient } from "../../admin-client";
|
||||
|
@ -96,7 +96,6 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
|
|||
|
||||
const form = useForm<EvaluateFormInputs>({ mode: "onChange" });
|
||||
const {
|
||||
control,
|
||||
reset,
|
||||
trigger,
|
||||
formState: { isValid },
|
||||
|
@ -179,9 +178,6 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
|
|||
}
|
||||
};
|
||||
|
||||
const user = useWatch({ control, name: "user", defaultValue: [] });
|
||||
const roles = useWatch({ control, name: "roleIds", defaultValue: [] });
|
||||
|
||||
if (evaluateResult) {
|
||||
return (
|
||||
<Results
|
||||
|
@ -213,7 +209,7 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
|
|||
helpText={t("selectUser")}
|
||||
defaultValue={[]}
|
||||
variant="typeahead"
|
||||
isRequired={roles?.length === 0}
|
||||
isRequired
|
||||
/>
|
||||
<SelectControl
|
||||
name="roleIds"
|
||||
|
@ -224,10 +220,7 @@ const AuthorizationEvaluateContent = ({ client }: Props) => {
|
|||
controller={{
|
||||
defaultValue: [],
|
||||
rules: {
|
||||
required: {
|
||||
value: user.length === 0,
|
||||
message: t("required"),
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
}}
|
||||
options={clientRoles.map((role) => role.name!)}
|
||||
|
|
Loading…
Reference in a new issue