add isDisabled to components (#17508)
This commit is contained in:
parent
d69c580850
commit
9bd0e156a4
5 changed files with 26 additions and 4 deletions
|
@ -26,7 +26,10 @@ export const ClientDescription = ({
|
||||||
<FormAccess role="manage-clients" fineGrainedAccess={configure} unWrap>
|
<FormAccess role="manage-clients" fineGrainedAccess={configure} unWrap>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
labelIcon={
|
labelIcon={
|
||||||
<HelpItem helpText="clients-help:clientId" fieldLabelId="clientId" />
|
<HelpItem
|
||||||
|
helpText={t("clients-help:clientId")}
|
||||||
|
fieldLabelId="clientId"
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
label={t("common:clientId")}
|
label={t("common:clientId")}
|
||||||
fieldId="kc-client-id"
|
fieldId="kc-client-id"
|
||||||
|
|
|
@ -12,10 +12,12 @@ import { FormFields } from "../ClientDetails";
|
||||||
|
|
||||||
type LoginSettingsProps = {
|
type LoginSettingsProps = {
|
||||||
protocol?: string;
|
protocol?: string;
|
||||||
|
isDisabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LoginSettings = ({
|
export const LoginSettings = ({
|
||||||
protocol = "openid-connect",
|
protocol = "openid-connect",
|
||||||
|
...rest
|
||||||
}: LoginSettingsProps) => {
|
}: LoginSettingsProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { register, watch } = useFormContext<FormFields>();
|
const { register, watch } = useFormContext<FormFields>();
|
||||||
|
@ -40,6 +42,7 @@ export const LoginSettings = ({
|
||||||
id="kc-root-url"
|
id="kc-root-url"
|
||||||
type="url"
|
type="url"
|
||||||
{...register("rootUrl")}
|
{...register("rootUrl")}
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -56,6 +59,7 @@ export const LoginSettings = ({
|
||||||
id="kc-home-url"
|
id="kc-home-url"
|
||||||
type="url"
|
type="url"
|
||||||
{...register("baseUrl")}
|
{...register("baseUrl")}
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -73,6 +77,7 @@ export const LoginSettings = ({
|
||||||
name="redirectUris"
|
name="redirectUris"
|
||||||
aria-label={t("validRedirectUri")}
|
aria-label={t("validRedirectUri")}
|
||||||
addButtonLabel="clients:addRedirectUri"
|
addButtonLabel="clients:addRedirectUri"
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -93,6 +98,7 @@ export const LoginSettings = ({
|
||||||
aria-label={t("validPostLogoutRedirectUri")}
|
aria-label={t("validPostLogoutRedirectUri")}
|
||||||
addButtonLabel="clients:addPostLogoutRedirectUri"
|
addButtonLabel="clients:addPostLogoutRedirectUri"
|
||||||
stringify
|
stringify
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
{protocol === "saml" && (
|
{protocol === "saml" && (
|
||||||
|
@ -117,6 +123,7 @@ export const LoginSettings = ({
|
||||||
id="idpInitiatedSsoUrlName"
|
id="idpInitiatedSsoUrlName"
|
||||||
data-testid="idpInitiatedSsoUrlName"
|
data-testid="idpInitiatedSsoUrlName"
|
||||||
{...register("attributes.saml_idp_initiated_sso_url_name")}
|
{...register("attributes.saml_idp_initiated_sso_url_name")}
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -133,6 +140,7 @@ export const LoginSettings = ({
|
||||||
id="idpInitiatedSsoRelayState"
|
id="idpInitiatedSsoRelayState"
|
||||||
data-testid="idpInitiatedSsoRelayState"
|
data-testid="idpInitiatedSsoRelayState"
|
||||||
{...register("attributes.saml_idp_initiated_sso_relay_state")}
|
{...register("attributes.saml_idp_initiated_sso_relay_state")}
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -150,6 +158,7 @@ export const LoginSettings = ({
|
||||||
type="url"
|
type="url"
|
||||||
data-testid="masterSamlProcessingUrl"
|
data-testid="masterSamlProcessingUrl"
|
||||||
{...register("adminUrl")}
|
{...register("adminUrl")}
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</>
|
</>
|
||||||
|
@ -170,6 +179,7 @@ export const LoginSettings = ({
|
||||||
name="webOrigins"
|
name="webOrigins"
|
||||||
aria-label={t("webOrigins")}
|
aria-label={t("webOrigins")}
|
||||||
addButtonLabel="clients:addWebOrigins"
|
addButtonLabel="clients:addWebOrigins"
|
||||||
|
{...rest}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -7,7 +7,11 @@ import { KeycloakTextInput } from "../../components/keycloak-text-input/Keycloak
|
||||||
import { convertAttributeNameToForm } from "../../util";
|
import { convertAttributeNameToForm } from "../../util";
|
||||||
import { FormFields } from "../ClientDetails";
|
import { FormFields } from "../ClientDetails";
|
||||||
|
|
||||||
export const ApplicationUrls = () => {
|
type ApplicationUrlsProps = {
|
||||||
|
isDisabled?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ApplicationUrls = (props: ApplicationUrlsProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { register } = useFormContext();
|
const { register } = useFormContext();
|
||||||
|
|
||||||
|
@ -30,6 +34,7 @@ export const ApplicationUrls = () => {
|
||||||
{...register(
|
{...register(
|
||||||
convertAttributeNameToForm<FormFields>("attributes.logoUri")
|
convertAttributeNameToForm<FormFields>("attributes.logoUri")
|
||||||
)}
|
)}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -49,6 +54,7 @@ export const ApplicationUrls = () => {
|
||||||
{...register(
|
{...register(
|
||||||
convertAttributeNameToForm<FormFields>("attributes.policyUri")
|
convertAttributeNameToForm<FormFields>("attributes.policyUri")
|
||||||
)}
|
)}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
|
@ -68,6 +74,7 @@ export const ApplicationUrls = () => {
|
||||||
{...register(
|
{...register(
|
||||||
convertAttributeNameToForm<FormFields>("attributes.tosUri")
|
convertAttributeNameToForm<FormFields>("attributes.tosUri")
|
||||||
)}
|
)}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -96,7 +96,7 @@ export const MultiLineInput = ({
|
||||||
onClick={() => remove(index)}
|
onClick={() => remove(index)}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
aria-label={t("common:remove")}
|
aria-label={t("common:remove")}
|
||||||
isDisabled={fields.length === 1}
|
isDisabled={fields.length === 1 || isDisabled}
|
||||||
>
|
>
|
||||||
<MinusCircleIcon />
|
<MinusCircleIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -108,7 +108,7 @@ export const MultiLineInput = ({
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
aria-label={t("common:add")}
|
aria-label={t("common:add")}
|
||||||
data-testid="addValue"
|
data-testid="addValue"
|
||||||
isDisabled={!value}
|
isDisabled={!value || isDisabled}
|
||||||
>
|
>
|
||||||
<PlusCircleIcon /> {t(addButtonLabel || "common:add")}
|
<PlusCircleIcon /> {t(addButtonLabel || "common:add")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -16,6 +16,7 @@ export type TextControlProps<
|
||||||
> = UseControllerProps<T, P> & {
|
> = UseControllerProps<T, P> & {
|
||||||
label: string;
|
label: string;
|
||||||
labelIcon?: string;
|
labelIcon?: string;
|
||||||
|
isDisabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TextControl = <
|
export const TextControl = <
|
||||||
|
@ -53,6 +54,7 @@ export const TextControl = <
|
||||||
validated={
|
validated={
|
||||||
fieldState.error ? ValidatedOptions.error : ValidatedOptions.default
|
fieldState.error ? ValidatedOptions.error : ValidatedOptions.default
|
||||||
}
|
}
|
||||||
|
isDisabled={props.isDisabled}
|
||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
Loading…
Reference in a new issue