From adad072eae992ebb224512ca20682cc30300daea Mon Sep 17 00:00:00 2001 From: mfrances Date: Fri, 16 Apr 2021 16:28:52 -0400 Subject: [PATCH] hide mappers tab on ldap provider create --- .../UserFederationLdapSettings.tsx | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/user-federation/UserFederationLdapSettings.tsx b/src/user-federation/UserFederationLdapSettings.tsx index 0be9a47bde..3333d3bf2a 100644 --- a/src/user-federation/UserFederationLdapSettings.tsx +++ b/src/user-federation/UserFederationLdapSettings.tsx @@ -123,7 +123,7 @@ const LdapSettingsHeader = ({ return ( <> - {id === "new" ? ( + {!id ? ( ) : ( { useEffect(() => { (async () => { - if (id !== "new") { + if (id) { const fetchedComponent = await adminClient.components.findOne({ id }); if (fetchedComponent) { setupForm(fetchedComponent); @@ -218,13 +218,10 @@ export const UserFederationLdapSettings = () => { await adminClient.components.update({ id }, component); } setupForm(component as ComponentRepresentation); - addAlert( - t(id === "new" ? "createSuccess" : "saveSuccess"), - AlertVariant.success - ); + addAlert(t(id ? "saveSuccess" : "createSuccess"), AlertVariant.success); } catch (error) { addAlert( - `${t(id === "new" ? "createError" : "saveError")} '${error}'`, + `${t(id ? "saveError" : "createError")} '${error}'`, AlertVariant.danger ); } @@ -324,13 +321,15 @@ export const UserFederationLdapSettings = () => { - {t("common:mappers")}} - > - - + {id && ( + {t("common:mappers")}} + > + + + )}