set alias to read only in IdPs (#1144)

This commit is contained in:
Jenny 2021-09-13 05:15:04 -04:00 committed by GitHub
parent 779056bef2
commit 7414e174b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -77,6 +77,7 @@ export const IdentityProvidersSection = () => {
realm, realm,
providerId: identityProvider.providerId, providerId: identityProvider.providerId,
alias: identityProvider.alias!, alias: identityProvider.alias!,
tab: "settings",
})} })}
> >
{identityProvider.displayName {identityProvider.displayName
@ -140,7 +141,7 @@ export const IdentityProvidersSection = () => {
{manageDisplayDialog && ( {manageDisplayDialog && (
<ManageOderDialog <ManageOderDialog
onClose={() => setManageDisplayDialog(false)} onClose={() => setManageDisplayDialog(false)}
providers={providers?.filter((p) => p.enabled)} providers={providers.filter((p) => p.enabled)}
/> />
)} )}
<ViewHeader <ViewHeader

View file

@ -7,10 +7,13 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { RedirectUrl } from "../component/RedirectUrl"; import { RedirectUrl } from "../component/RedirectUrl";
import { TextField } from "../component/TextField"; import { TextField } from "../component/TextField";
import { DisplayOrder } from "../component/DisplayOrder"; import { DisplayOrder } from "../component/DisplayOrder";
import type { IdentityProviderTabParams } from "../routes/IdentityProviderTab";
import { useParams } from "react-router-dom";
export const OIDCGeneralSettings = ({ id }: { id: string }) => { export const OIDCGeneralSettings = ({ id }: { id: string }) => {
const { t } = useTranslation("identity-providers"); const { t } = useTranslation("identity-providers");
const { t: th } = useTranslation("identity-providers-help"); const { t: th } = useTranslation("identity-providers-help");
const { tab } = useParams<IdentityProviderTabParams>();
const { register, errors } = useFormContext(); const { register, errors } = useFormContext();
@ -35,6 +38,7 @@ export const OIDCGeneralSettings = ({ id }: { id: string }) => {
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
<TextInput <TextInput
isReadOnly={tab === "settings"}
isRequired isRequired
type="text" type="text"
id="alias" id="alias"

View file

@ -7,10 +7,13 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { RedirectUrl } from "../component/RedirectUrl"; import { RedirectUrl } from "../component/RedirectUrl";
import { TextField } from "../component/TextField"; import { TextField } from "../component/TextField";
import { DisplayOrder } from "../component/DisplayOrder"; import { DisplayOrder } from "../component/DisplayOrder";
import { useParams } from "react-router";
import type { IdentityProviderTabParams } from "../routes/IdentityProviderTab";
export const SamlGeneralSettings = ({ id }: { id: string }) => { export const SamlGeneralSettings = ({ id }: { id: string }) => {
const { t } = useTranslation("identity-providers"); const { t } = useTranslation("identity-providers");
const { t: th } = useTranslation("identity-providers-help"); const { t: th } = useTranslation("identity-providers-help");
const { tab } = useParams<IdentityProviderTabParams>();
const { register, errors } = useFormContext(); const { register, errors } = useFormContext();
@ -40,6 +43,7 @@ export const SamlGeneralSettings = ({ id }: { id: string }) => {
id="alias" id="alias"
data-testid="alias" data-testid="alias"
name="alias" name="alias"
isReadOnly={tab === "settings"}
validated={ validated={
errors.alias ? ValidatedOptions.error : ValidatedOptions.default errors.alias ? ValidatedOptions.error : ValidatedOptions.default
} }