@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
14 lines • 4.15 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FormGroup, Switch } from "@patternfly/react-core";
import { Controller, FormProvider } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { HelpItem, TextControl } from "../../ui-shared";
import { FormAccess } from "../../components/form/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
export const LdapSettingsSynchronization = ({ form, showSectionHeading = false, showSectionDescription = false, }) => {
const { t } = useTranslation();
const watchPeriodicSync = form.watch("config.periodicFullSync", false);
const watchChangedSync = form.watch("config.periodicChangedUsersSync", false);
return (_jsxs(FormProvider, { ...form, children: [showSectionHeading && (_jsx(WizardSectionHeader, { title: t("synchronizationSettings"), description: t("ldapSynchronizationSettingsDescription"), showDescription: showSectionDescription })), _jsxs(FormAccess, { role: "manage-realm", isHorizontal: true, children: [_jsx(FormGroup, { hasNoPaddingTop: true, label: t("importUsers"), labelIcon: _jsx(HelpItem, { helpText: t("importUsersHelp"), fieldLabelId: "importUsers" }), fieldId: "kc-import-users", children: _jsx(Controller, { name: "config.importEnabled", defaultValue: ["true"], control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-import-users", "data-testid": "import-users", name: "importEnabled", label: t("on"), labelOff: t("off"), onChange: (_event, value) => field.onChange([`${value}`]), isChecked: field.value[0] === "true", isDisabled: false, "aria-label": t("importUsers") })) }) }), _jsx(FormGroup, { hasNoPaddingTop: true, label: t("syncRegistrations"), labelIcon: _jsx(HelpItem, { helpText: t("syncRegistrations"), fieldLabelId: "syncRegistrations" }), fieldId: "syncRegistrations", children: _jsx(Controller, { name: "config.syncRegistrations", defaultValue: ["true"], control: form.control, render: ({ field }) => (_jsx(Switch, { id: "syncRegistrations", "data-testid": "syncRegistrations", label: t("on"), labelOff: t("off"), onChange: (_event, value) => field.onChange([`${value}`]), isChecked: field.value[0] === "true", "aria-label": t("syncRegistrations") })) }) }), _jsx(TextControl, { name: "config.batchSizeForSync.0", type: "number", min: 0, label: t("batchSize"), labelIcon: t("batchSizeHelp") }), _jsx(FormGroup, { label: t("periodicFullSync"), labelIcon: _jsx(HelpItem, { helpText: t("periodicFullSyncHelp"), fieldLabelId: "periodicFullSync" }), fieldId: "kc-periodic-full-sync", hasNoPaddingTop: true, children: _jsx(Controller, { name: "config.periodicFullSync", defaultValue: false, control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-periodic-full-sync", "data-testid": "periodic-full-sync", isDisabled: false, onChange: (_event, value) => field.onChange(value), isChecked: field.value === true, label: t("on"), labelOff: t("off"), "aria-label": t("periodicFullSync") })) }) }), watchPeriodicSync && (_jsx(TextControl, { name: "config.fullSyncPeriod.0", label: t("fullSyncPeriod"), labelIcon: t("fullSyncPeriodHelp"), type: "number", min: -1, defaultValue: 604800 })), _jsx(FormGroup, { label: t("periodicChangedUsersSync"), labelIcon: _jsx(HelpItem, { helpText: t("periodicChangedUsersSyncHelp"), fieldLabelId: "periodicChangedUsersSync" }), fieldId: "kc-periodic-changed-users-sync", hasNoPaddingTop: true, children: _jsx(Controller, { name: "config.periodicChangedUsersSync", defaultValue: false, control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-periodic-changed-users-sync", "data-testid": "periodic-changed-users-sync", isDisabled: false, onChange: (_event, value) => field.onChange(value), isChecked: field.value === true, label: t("on"), labelOff: t("off"), "aria-label": t("periodicChangedUsersSync") })) }) }), watchChangedSync && (_jsx(TextControl, { name: "config.changedSyncPeriod.0", label: t("changedUsersSyncPeriod"), labelIcon: t("changedUsersSyncHelp"), type: "number", min: -1, defaultValue: 86400 }))] })] }));
};
//# sourceMappingURL=LdapSettingsSynchronization.js.map