hide mappers tab on ldap provider create

This commit is contained in:
mfrances 2021-04-16 16:28:52 -04:00
parent 9155b8bfc7
commit adad072eae

View file

@ -123,7 +123,7 @@ const LdapSettingsHeader = ({
return ( return (
<> <>
<DisableConfirm /> <DisableConfirm />
{id === "new" ? ( {!id ? (
<ViewHeader titleKey="LDAP" subKey="" /> <ViewHeader titleKey="LDAP" subKey="" />
) : ( ) : (
<ViewHeader <ViewHeader
@ -178,7 +178,7 @@ export const UserFederationLdapSettings = () => {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
if (id !== "new") { if (id) {
const fetchedComponent = await adminClient.components.findOne({ id }); const fetchedComponent = await adminClient.components.findOne({ id });
if (fetchedComponent) { if (fetchedComponent) {
setupForm(fetchedComponent); setupForm(fetchedComponent);
@ -218,13 +218,10 @@ export const UserFederationLdapSettings = () => {
await adminClient.components.update({ id }, component); await adminClient.components.update({ id }, component);
} }
setupForm(component as ComponentRepresentation); setupForm(component as ComponentRepresentation);
addAlert( addAlert(t(id ? "saveSuccess" : "createSuccess"), AlertVariant.success);
t(id === "new" ? "createSuccess" : "saveSuccess"),
AlertVariant.success
);
} catch (error) { } catch (error) {
addAlert( addAlert(
`${t(id === "new" ? "createError" : "saveError")} '${error}'`, `${t(id ? "saveError" : "createError")} '${error}'`,
AlertVariant.danger AlertVariant.danger
); );
} }
@ -324,6 +321,7 @@ export const UserFederationLdapSettings = () => {
</ActionGroup> </ActionGroup>
</Form> </Form>
</Tab> </Tab>
{id && (
<Tab <Tab
id="mappers" id="mappers"
eventKey="mappers" eventKey="mappers"
@ -331,6 +329,7 @@ export const UserFederationLdapSettings = () => {
> >
<LdapMapperList /> <LdapMapperList />
</Tab> </Tab>
)}
</KeycloakTabs> </KeycloakTabs>
</PageSection> </PageSection>
</> </>