diff --git a/src/user-federation/UserFederationLdapSettings.tsx b/src/user-federation/UserFederationLdapSettings.tsx
index 68a0accfcc..3f35d89225 100644
--- a/src/user-federation/UserFederationLdapSettings.tsx
+++ b/src/user-federation/UserFederationLdapSettings.tsx
@@ -65,7 +65,7 @@ const AddLdapFormContent = ({
]}
>
-
+
diff --git a/src/user-federation/ldap/LdapSettingsConnection.tsx b/src/user-federation/ldap/LdapSettingsConnection.tsx
index 6eefaaa60e..54c636830a 100644
--- a/src/user-federation/ldap/LdapSettingsConnection.tsx
+++ b/src/user-federation/ldap/LdapSettingsConnection.tsx
@@ -25,9 +25,9 @@ import { useAlerts } from "../../components/alert/Alerts";
export type LdapSettingsConnectionProps = {
form: UseFormMethods;
+ id?: string;
showSectionHeading?: boolean;
showSectionDescription?: boolean;
- edit?: boolean;
};
const testLdapProperties: Array = [
@@ -50,22 +50,21 @@ const convertFormToSettings = (form: UseFormMethods) => {
settings[key] = Array.isArray(value) ? value[0] : "";
});
- settings["componentId"] = get(form.getValues(), "id");
-
return settings;
};
export const LdapSettingsConnection = ({
form,
+ id,
showSectionHeading = false,
showSectionDescription = false,
- edit = false,
}: LdapSettingsConnectionProps) => {
const { t } = useTranslation("user-federation");
const { t: helpText } = useTranslation("user-federation-help");
const adminClient = useAdminClient();
const { realm } = useRealm();
const { addAlert, addError } = useAlerts();
+ const edit = !!id;
const testLdap = async (testType: TestTypes) => {
if (!(await form.trigger())) return;
@@ -73,7 +72,7 @@ export const LdapSettingsConnection = ({
const settings = convertFormToSettings(form);
await adminClient.realms.testLDAPConnection(
{ realm },
- { ...settings, action: testType }
+ { ...settings, action: testType, componentId: id }
);
addAlert(t("testSuccess"), AlertVariant.success);
} catch (error) {
diff --git a/src/user-federation/ldap/LdapSettingsGeneral.tsx b/src/user-federation/ldap/LdapSettingsGeneral.tsx
index 68a8726d55..ffd9c8e1ca 100644
--- a/src/user-federation/ldap/LdapSettingsGeneral.tsx
+++ b/src/user-federation/ldap/LdapSettingsGeneral.tsx
@@ -117,7 +117,6 @@ export const LdapSettingsGeneral = ({
helperTextInvalid={form.errors.name?.message}
>
{/* These hidden fields are required so data object written back matches data retrieved */}
-