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} />
|
<LdapSettingsGeneral form={form} vendorEdit={!!id} />
|
||||||
<LdapSettingsConnection form={form} edit={!!id} />
|
<LdapSettingsConnection form={form} id={id} />
|
||||||
<LdapSettingsSearching form={form} />
|
<LdapSettingsSearching form={form} />
|
||||||
<LdapSettingsSynchronization form={form} />
|
<LdapSettingsSynchronization form={form} />
|
||||||
<LdapSettingsKerberosIntegration form={form} />
|
<LdapSettingsKerberosIntegration form={form} />
|
||||||
|
|
|
@ -25,9 +25,9 @@ import { useAlerts } from "../../components/alert/Alerts";
|
||||||
|
|
||||||
export type LdapSettingsConnectionProps = {
|
export type LdapSettingsConnectionProps = {
|
||||||
form: UseFormMethods;
|
form: UseFormMethods;
|
||||||
|
id?: string;
|
||||||
showSectionHeading?: boolean;
|
showSectionHeading?: boolean;
|
||||||
showSectionDescription?: boolean;
|
showSectionDescription?: boolean;
|
||||||
edit?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const testLdapProperties: Array<keyof TestLdapConnectionRepresentation> = [
|
const testLdapProperties: Array<keyof TestLdapConnectionRepresentation> = [
|
||||||
|
@ -50,22 +50,21 @@ const convertFormToSettings = (form: UseFormMethods) => {
|
||||||
settings[key] = Array.isArray(value) ? value[0] : "";
|
settings[key] = Array.isArray(value) ? value[0] : "";
|
||||||
});
|
});
|
||||||
|
|
||||||
settings["componentId"] = get(form.getValues(), "id");
|
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LdapSettingsConnection = ({
|
export const LdapSettingsConnection = ({
|
||||||
form,
|
form,
|
||||||
|
id,
|
||||||
showSectionHeading = false,
|
showSectionHeading = false,
|
||||||
showSectionDescription = false,
|
showSectionDescription = false,
|
||||||
edit = false,
|
|
||||||
}: LdapSettingsConnectionProps) => {
|
}: LdapSettingsConnectionProps) => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const { t: helpText } = useTranslation("user-federation-help");
|
const { t: helpText } = useTranslation("user-federation-help");
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
const edit = !!id;
|
||||||
|
|
||||||
const testLdap = async (testType: TestTypes) => {
|
const testLdap = async (testType: TestTypes) => {
|
||||||
if (!(await form.trigger())) return;
|
if (!(await form.trigger())) return;
|
||||||
|
@ -73,7 +72,7 @@ export const LdapSettingsConnection = ({
|
||||||
const settings = convertFormToSettings(form);
|
const settings = convertFormToSettings(form);
|
||||||
await adminClient.realms.testLDAPConnection(
|
await adminClient.realms.testLDAPConnection(
|
||||||
{ realm },
|
{ realm },
|
||||||
{ ...settings, action: testType }
|
{ ...settings, action: testType, componentId: id }
|
||||||
);
|
);
|
||||||
addAlert(t("testSuccess"), AlertVariant.success);
|
addAlert(t("testSuccess"), AlertVariant.success);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -117,7 +117,6 @@ export const LdapSettingsGeneral = ({
|
||||||
helperTextInvalid={form.errors.name?.message}
|
helperTextInvalid={form.errors.name?.message}
|
||||||
>
|
>
|
||||||
{/* These hidden fields are required so data object written back matches data retrieved */}
|
{/* These hidden fields are required so data object written back matches data retrieved */}
|
||||||
<TextInput hidden type="text" id="kc-console-id" name="id" />
|
|
||||||
<TextInput
|
<TextInput
|
||||||
hidden
|
hidden
|
||||||
type="text"
|
type="text"
|
||||||
|
|
Loading…
Reference in a new issue