Add id to the form (#2400)
This commit is contained in:
parent
0f48da11e7
commit
36cf7022f5
3 changed files with 5 additions and 7 deletions
|
@ -65,7 +65,7 @@ const AddLdapFormContent = ({
|
|||
]}
|
||||
>
|
||||
<LdapSettingsGeneral form={form} vendorEdit={!!id} />
|
||||
<LdapSettingsConnection form={form} edit={!!id} />
|
||||
<LdapSettingsConnection form={form} id={id} />
|
||||
<LdapSettingsSearching form={form} />
|
||||
<LdapSettingsSynchronization form={form} />
|
||||
<LdapSettingsKerberosIntegration form={form} />
|
||||
|
|
|
@ -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<keyof TestLdapConnectionRepresentation> = [
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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 */}
|
||||
<TextInput hidden type="text" id="kc-console-id" name="id" />
|
||||
<TextInput
|
||||
hidden
|
||||
type="text"
|
||||
|
|
Loading…
Reference in a new issue