diff --git a/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx b/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx index 59d6b5355a..688e7cdc1b 100644 --- a/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx +++ b/js/apps/admin-ui/src/components/time-selector/TimeSelector.tsx @@ -22,7 +22,10 @@ const allTimes: TimeUnit[] = [ { unit: "day", label: "times.days", multiplier: 86400 }, ]; -export type TimeSelectorProps = Omit & +export type TimeSelectorProps = Omit< + TextInputProps, + "onChange" | "defaultValue" +> & Pick & { value?: number; units?: Unit[]; diff --git a/js/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx b/js/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx index 4aee77516f..fadb94cd8c 100644 --- a/js/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx +++ b/js/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx @@ -5,12 +5,12 @@ import { FormGroup, Switch, } from "@patternfly/react-core"; -import { Controller, UseFormReturn } from "react-hook-form"; +import { Controller, FormProvider, UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; - -import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog"; import { HelpItem } from "ui-shared"; -import { TimeSelector } from "../../components/time-selector/TimeSelector"; +import { DefaultSwitchControl } from "../../components/SwitchControl"; +import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog"; +import { TimeSelectorControl } from "../../components/time-selector/TimeSelectorControl"; export type EventsType = "admin" | "user"; @@ -45,7 +45,7 @@ export const EventConfigForm = ({ }); return ( - <> + {type === "admin" && ( - - } - > - ( - - )} - /> - - )} - - } - > - ( - - )} + labelIcon={t("includeRepresentationHelp")} /> - + )} + )} @@ -174,6 +138,6 @@ export const EventConfigForm = ({ {type === "user" ? t("clearUserEvents") : t("clearAdminEvents")} - + ); }; diff --git a/js/apps/admin-ui/src/realm-settings/event-config/EventListenersForm.tsx b/js/apps/admin-ui/src/realm-settings/event-config/EventListenersForm.tsx index bf3d74e3f7..745b061983 100644 --- a/js/apps/admin-ui/src/realm-settings/event-config/EventListenersForm.tsx +++ b/js/apps/admin-ui/src/realm-settings/event-config/EventListenersForm.tsx @@ -1,16 +1,7 @@ -import { - ActionGroup, - Button, - FormGroup, - Select, - SelectOption, - SelectVariant, -} from "@patternfly/react-core"; -import { useState } from "react"; -import { Controller, UseFormReturn } from "react-hook-form"; +import { ActionGroup, Button, SelectVariant } from "@patternfly/react-core"; +import { FormProvider, UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; - -import { HelpItem } from "ui-shared"; +import { SelectControl } from "ui-shared"; import { useServerInfo } from "../../context/server-info/ServerInfoProvider"; type EventListenersFormProps = { @@ -24,66 +15,31 @@ export const EventListenersForm = ({ }: EventListenersFormProps) => { const { t } = useTranslation(); const { - control, formState: { isDirty }, } = form; - const [selectEventListenerOpen, setSelectEventListenerOpen] = useState(false); const serverInfo = useServerInfo(); const eventListeners = serverInfo.providers?.eventsListener.providers; return ( - <> - + - } - > - ( - - )} - /> - + labelIcon={t("eventListenersHelpTextHelp")} + controller={{ + defaultValue: "", + }} + className="kc_eventListeners_select" + chipGroupProps={{ + numChips: 3, + expandedText: t("hide"), + collapsedText: t("showRemaining"), + }} + variant={SelectVariant.typeaheadMulti} + options={Object.keys(eventListeners!)} + typeAheadAriaLabel="Select" + />