import { FormGroup, Switch } from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import React from "react";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { UseFormMethods, Controller } from "react-hook-form";
import { FormAccess } from "../../components/form-access/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export type LdapSettingsSynchronizationProps = {
form: UseFormMethods;
showSectionHeading?: boolean;
showSectionDescription?: boolean;
};
export const LdapSettingsSynchronization = ({
form,
showSectionHeading = false,
showSectionDescription = false,
}: LdapSettingsSynchronizationProps) => {
const { t } = useTranslation("user-federation");
const { t: helpText } = useTranslation("user-federation-help");
const watchPeriodicSync = form.watch("config.periodicFullSync", false);
const watchChangedSync = form.watch("config.periodicChangedUsersSync", false);
return (
<>
{showSectionHeading && (
)}
}
fieldId="kc-import-users"
>
(
onChange([`${value}`])}
isChecked={value[0] === "true"}
isDisabled={false}
/>
)}
>
}
fieldId="kc-batch-size"
>
}
fieldId="kc-periodic-full-sync"
hasNoPaddingTop
>
(
onChange(value)}
isChecked={value === true}
label={t("common:on")}
labelOff={t("common:off")}
ref={form.register}
/>
)}
>
{watchPeriodicSync && (
}
fieldId="kc-full-sync-period"
>
)}
}
fieldId="kc-periodic-changed-users-sync"
hasNoPaddingTop
>
(
onChange(value)}
isChecked={value === true}
label={t("common:on")}
labelOff={t("common:off")}
ref={form.register}
/>
)}
>
{watchChangedSync && (
}
fieldId="kc-changed-users-sync-period"
hasNoPaddingTop
>
)}
>
);
};