fixed the wrong comment

This commit is contained in:
Erik Jan de Wit 2021-04-26 09:40:59 +02:00
parent 2a02b38888
commit 1521024abf
2 changed files with 8 additions and 7 deletions

View file

@ -26,7 +26,7 @@ export const CapabilityConfig = ({
const { control, watch, setValue } = useFormContext<ClientForm>(); const { control, watch, setValue } = useFormContext<ClientForm>();
const protocol = type || watch("protocol"); const protocol = type || watch("protocol");
const clientAuthentication = watch("publicClient"); const clientAuthentication = watch("publicClient");
const clientAuthorization = watch("authorizationServicesEnabled"); const authorization = watch("authorizationServicesEnabled");
return ( return (
<FormAccess isHorizontal role="manage-clients" unWrap={unWrap}> <FormAccess isHorizontal role="manage-clients" unWrap={unWrap}>
@ -47,7 +47,7 @@ export const CapabilityConfig = ({
> >
<Controller <Controller
name="publicClient" name="publicClient"
defaultValue={true} defaultValue={false}
control={control} control={control}
render={({ onChange, value }) => ( render={({ onChange, value }) => (
<Switch <Switch
@ -85,7 +85,7 @@ export const CapabilityConfig = ({
name="authorizationServicesEnabled" name="authorizationServicesEnabled"
label={t("common:on")} label={t("common:on")}
labelOff={t("common:off")} labelOff={t("common:off")}
isChecked={value} isChecked={value && !clientAuthentication}
onChange={(value) => { onChange={(value) => {
onChange(value); onChange(value);
if (value) { if (value) {
@ -188,11 +188,13 @@ export const CapabilityConfig = ({
id="kc-flow-service-account" id="kc-flow-service-account"
name="serviceAccountsEnabled" name="serviceAccountsEnabled"
isChecked={ isChecked={
value || value || (clientAuthentication && authorization)
(clientAuthentication && clientAuthorization)
} }
onChange={onChange} onChange={onChange}
isDisabled={clientAuthorization} isDisabled={
(clientAuthentication && !authorization) ||
(!clientAuthentication && authorization)
}
/> />
<HelpItem <HelpItem
helpText="clients-help:serviceAccount" helpText="clients-help:serviceAccount"

View file

@ -7,7 +7,6 @@ import {
WizardFooter, WizardFooter,
WizardContextConsumer, WizardContextConsumer,
Button, Button,
WizardStepFunctionType,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form"; import { FormProvider, useForm } from "react-hook-form";