2020-11-25 16:17:50 +00:00
|
|
|
import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
|
2020-10-30 20:15:37 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2021-01-26 01:41:14 +00:00
|
|
|
import React from "react";
|
2020-12-16 07:02:41 +00:00
|
|
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
2021-01-26 01:41:14 +00:00
|
|
|
import { UseFormMethods, Controller } from "react-hook-form";
|
2020-12-16 07:02:41 +00:00
|
|
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
2021-01-04 21:33:18 +00:00
|
|
|
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
|
2020-10-30 20:15:37 +00:00
|
|
|
|
2021-01-04 21:33:18 +00:00
|
|
|
export type LdapSettingsSynchronizationProps = {
|
2021-01-26 01:41:14 +00:00
|
|
|
form: UseFormMethods;
|
2021-01-04 21:33:18 +00:00
|
|
|
showSectionHeading?: boolean;
|
|
|
|
showSectionDescription?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LdapSettingsSynchronization = ({
|
2021-01-26 01:41:14 +00:00
|
|
|
form,
|
2021-01-04 21:33:18 +00:00
|
|
|
showSectionHeading = false,
|
|
|
|
showSectionDescription = false,
|
|
|
|
}: LdapSettingsSynchronizationProps) => {
|
2020-10-30 20:15:37 +00:00
|
|
|
const { t } = useTranslation("user-federation");
|
|
|
|
const helpText = useTranslation("user-federation-help").t;
|
2020-11-25 14:50:40 +00:00
|
|
|
|
2020-10-30 20:15:37 +00:00
|
|
|
return (
|
|
|
|
<>
|
2021-01-04 21:33:18 +00:00
|
|
|
{showSectionHeading && (
|
|
|
|
<WizardSectionHeader
|
|
|
|
title={t("synchronizationSettings")}
|
|
|
|
description={helpText("ldapSynchronizationSettingsDescription")}
|
|
|
|
showDescription={showSectionDescription}
|
|
|
|
/>
|
|
|
|
)}
|
2020-11-25 16:17:50 +00:00
|
|
|
<FormAccess role="manage-realm" isHorizontal>
|
2020-10-30 20:15:37 +00:00
|
|
|
<FormGroup
|
2020-12-16 07:02:41 +00:00
|
|
|
hasNoPaddingTop
|
2020-10-30 20:15:37 +00:00
|
|
|
label={t("importUsers")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={helpText("importUsersHelp")}
|
|
|
|
forLabel={t("importUsers")}
|
|
|
|
forID="kc-import-users"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="kc-import-users"
|
|
|
|
>
|
2020-11-25 14:50:40 +00:00
|
|
|
<Controller
|
2020-12-16 07:02:41 +00:00
|
|
|
name="config.importEnabled"
|
2021-02-19 23:13:07 +00:00
|
|
|
defaultValue={["false"]}
|
2021-01-26 01:41:14 +00:00
|
|
|
control={form.control}
|
2020-11-25 14:50:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id={"kc-import-users"}
|
2020-12-16 07:02:41 +00:00
|
|
|
name="importEnabled"
|
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
2021-01-26 01:41:14 +00:00
|
|
|
onChange={(value) => onChange([`${value}`])}
|
2020-12-16 07:02:41 +00:00
|
|
|
isChecked={value[0] === "true"}
|
2020-11-25 14:50:40 +00:00
|
|
|
isDisabled={false}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
></Controller>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("batchSize")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
|
|
|
helpText={helpText("batchSizeHelp")}
|
|
|
|
forLabel={t("batchSize")}
|
|
|
|
forID="kc-batch-size"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
fieldId="kc-batch-size"
|
|
|
|
>
|
2020-11-25 14:50:40 +00:00
|
|
|
<TextInput
|
|
|
|
type="text"
|
|
|
|
id="kc-batch-size"
|
2021-01-26 01:41:14 +00:00
|
|
|
name="config.batchSizeForSync[0]"
|
|
|
|
ref={form.register}
|
2020-11-25 14:50:40 +00:00
|
|
|
/>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
2021-01-26 01:41:14 +00:00
|
|
|
|
|
|
|
{/* Enter -1 to switch off, otherwise enter value */}
|
2020-10-30 20:15:37 +00:00
|
|
|
<FormGroup
|
2020-12-16 07:02:41 +00:00
|
|
|
hasNoPaddingTop
|
2021-01-26 01:41:14 +00:00
|
|
|
label={t("fullSyncPeriod")}
|
2020-10-30 20:15:37 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-01-26 01:41:14 +00:00
|
|
|
helpText={helpText("fullSyncPeriodHelp")}
|
|
|
|
forLabel={t("fullSyncPeriod")}
|
|
|
|
forID="kc-full-sync-period"
|
2020-10-30 20:15:37 +00:00
|
|
|
/>
|
|
|
|
}
|
2021-01-26 01:41:14 +00:00
|
|
|
fieldId="kc-full-sync-period"
|
2020-10-30 20:15:37 +00:00
|
|
|
>
|
2020-12-16 07:02:41 +00:00
|
|
|
<TextInput
|
|
|
|
type="text"
|
2021-01-26 01:41:14 +00:00
|
|
|
id="kc-full-sync-period"
|
|
|
|
name="config.fullSyncPeriod[0]"
|
|
|
|
ref={form.register}
|
2020-12-16 07:02:41 +00:00
|
|
|
/>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
2021-01-26 01:41:14 +00:00
|
|
|
|
|
|
|
{/* Enter -1 to switch off, otherwise enter value */}
|
2020-10-30 20:15:37 +00:00
|
|
|
<FormGroup
|
2021-01-26 01:41:14 +00:00
|
|
|
label={t("changedUsersSyncPeriod")}
|
2020-10-30 20:15:37 +00:00
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-01-26 01:41:14 +00:00
|
|
|
helpText={helpText("changedUsersSyncHelp")}
|
|
|
|
forLabel={t("changedUsersSyncPeriod")}
|
|
|
|
forID="kc-changed-users-sync-period"
|
2020-10-30 20:15:37 +00:00
|
|
|
/>
|
|
|
|
}
|
2021-01-26 01:41:14 +00:00
|
|
|
fieldId="kc-changed-users-sync-period"
|
2020-10-30 20:15:37 +00:00
|
|
|
hasNoPaddingTop
|
|
|
|
>
|
2020-12-16 07:02:41 +00:00
|
|
|
<TextInput
|
|
|
|
type="text"
|
2021-01-26 01:41:14 +00:00
|
|
|
id="kc-changed-users-sync-period"
|
|
|
|
name="config.changedSyncPeriod[0]"
|
|
|
|
ref={form.register}
|
2020-12-16 07:02:41 +00:00
|
|
|
/>
|
2020-10-30 20:15:37 +00:00
|
|
|
</FormGroup>
|
2020-11-25 16:17:50 +00:00
|
|
|
</FormAccess>
|
2020-10-30 20:15:37 +00:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|