import { useTranslation } from "react-i18next";
import { Controller, useFormContext } from "react-hook-form";
import { FormGroup, Switch } from "@patternfly/react-core";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";
export const SyncSettings = () => {
const { t } = useTranslation("user-federation");
const { control, register, watch } = useFormContext();
const watchPeriodicSync = watch("config.fullSyncPeriod", "-1");
const watchChangedSync = watch("config.changedSyncPeriod", "-1");
return (
<>
}
fieldId="kc-periodic-full-sync"
hasNoPaddingTop
>
(
{
onChange(value ? "604800" : "-1");
}}
isChecked={value !== "-1"}
label={t("common:on")}
labelOff={t("common:off")}
aria-label={t("periodicFullSync")}
/>
)}
/>
{watchPeriodicSync !== "-1" && (
}
fieldId="kc-full-sync-period"
>
)}
}
fieldId="kc-periodic-changed-users-sync"
hasNoPaddingTop
>
(
{
onChange(value ? "86400" : "-1");
}}
isChecked={value !== "-1"}
label={t("common:on")}
labelOff={t("common:off")}
aria-label={t("periodicChangedUsersSync")}
/>
)}
/>
{watchChangedSync !== "-1" && (
}
fieldId="kc-changed-users-sync-period"
hasNoPaddingTop
>
)}
>
);
};