@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
69 lines • 3.93 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, Form } from "@patternfly/react-core";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { ScrollForm } from "../ui-shared";
import { FixedButtonsGroup } from "../components/form/FixedButtonGroup";
import { useRealm } from "../context/realm-context/RealmContext";
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
import { LdapSettingsAdvanced } from "../user-federation/ldap/LdapSettingsAdvanced";
import { LdapSettingsConnection } from "../user-federation/ldap/LdapSettingsConnection";
import { LdapSettingsGeneral } from "../user-federation/ldap/LdapSettingsGeneral";
import { LdapSettingsKerberosIntegration } from "../user-federation/ldap/LdapSettingsKerberosIntegration";
import { LdapSettingsSearching } from "../user-federation/ldap/LdapSettingsSearching";
import { LdapSettingsSynchronization } from "../user-federation/ldap/LdapSettingsSynchronization";
import { toUserFederation } from "../user-federation/routes/UserFederation";
import { SettingsCache } from "../user-federation/shared/SettingsCache";
export const UserFederationLdapForm = ({ id, onSubmit, }) => {
const { t } = useTranslation();
const form = useFormContext();
const navigate = useNavigate();
const { realm } = useRealm();
const isFeatureEnabled = useIsFeatureEnabled();
return (_jsxs(_Fragment, { children: [_jsx(ScrollForm, { label: t("jumpToSection"), sections: [
{
title: t("generalOptions"),
panel: _jsx(LdapSettingsGeneral, { form: form, vendorEdit: !!id }),
},
{
title: t("connectionAndAuthenticationSettings"),
panel: _jsx(LdapSettingsConnection, { form: form, id: id }),
},
{
title: t("ldapSearchingAndUpdatingSettings"),
panel: _jsx(LdapSettingsSearching, { form: form }),
},
{
title: t("synchronizationSettings"),
panel: _jsx(LdapSettingsSynchronization, { form: form }),
},
{
title: t("kerberosIntegration"),
panel: _jsx(LdapSettingsKerberosIntegration, { form: form }),
isHidden: !isFeatureEnabled(Feature.Kerberos),
},
{ title: t("cacheSettings"), panel: _jsx(SettingsCache, { form: form }) },
{
title: t("advancedSettings"),
panel: _jsx(LdapSettingsAdvanced, { form: form, id: id }),
},
] }), _jsx(Form, { onSubmit: form.handleSubmit(onSubmit), children: _jsx(FixedButtonsGroup, { name: "ldap", isDisabled: !form.formState.isDirty, isSubmit: true, children: _jsx(Button, { variant: "link", onClick: () => navigate(toUserFederation({ realm })), "data-testid": "ldap-cancel", children: t("cancel") }) }) })] }));
};
export function serializeFormData(formData) {
const { config } = formData;
if ((config === null || config === void 0 ? void 0 : config.periodicChangedUsersSync) !== undefined) {
if (config.periodicChangedUsersSync === false) {
config.changedSyncPeriod = ["-1"];
}
delete config.periodicChangedUsersSync;
}
if ((config === null || config === void 0 ? void 0 : config.periodicFullSync) !== undefined) {
if (config.periodicFullSync === false) {
config.fullSyncPeriod = ["-1"];
}
delete config.periodicFullSync;
}
return formData;
}
//# sourceMappingURL=UserFederationLdapForm.js.map