From 0f426ee76d7f7a5dbbad2fefd4920545c56dca6d Mon Sep 17 00:00:00 2001 From: agagancarczyk Date: Thu, 22 Dec 2022 08:33:44 +0000 Subject: [PATCH] User events configuration fine tuning - #1562 (#4076) * removed header title * fixed showing events list on save click * feedback Co-authored-by: Agnieszka Gancarczyk --- .../public/resources/en/realm-settings.json | 3 --- .../event-config/EventConfigForm.tsx | 1 - .../realm-settings/event-config/EventsTab.tsx | 20 ++++--------------- .../event-config/EventsTypeTable.tsx | 2 +- 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/apps/admin-ui/public/resources/en/realm-settings.json b/apps/admin-ui/public/resources/en/realm-settings.json index f19b66ebc5..0ab9285079 100644 --- a/apps/admin-ui/public/resources/en/realm-settings.json +++ b/apps/admin-ui/public/resources/en/realm-settings.json @@ -57,9 +57,7 @@ "saveEventListeners": "Save Event Listeners", "saveEventListenersSuccess": "Event listener has been updated.", "saveEventListenersError": "Error saving event listener: {{error}}", - "userEventsConfig": "User events configuration", "userEventsSettings": "User events settings", - "adminEventsConfig": "Admin events configuration", "adminEventsSettings": "Admin events settings", "saveEvents": "Save events", "expiration": "Expiration", @@ -894,5 +892,4 @@ "importSkipped_zero": "No records skipped.", "importSkipped_one": "One record skipped.", "importSkipped_other": "{{count}} records skipped." - } diff --git a/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx b/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx index 5e743ea73e..1c4f5ddbd8 100644 --- a/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx +++ b/apps/admin-ui/src/realm-settings/event-config/EventConfigForm.tsx @@ -34,7 +34,6 @@ export const EventConfigForm = ({ setValue, formState: { isDirty }, } = form; - const eventKey = type === "admin" ? "adminEventsEnabled" : "eventsEnabled"; const eventsEnabled: boolean = watch(eventKey); diff --git a/apps/admin-ui/src/realm-settings/event-config/EventsTab.tsx b/apps/admin-ui/src/realm-settings/event-config/EventsTab.tsx index b53fb4ab45..66173e5210 100644 --- a/apps/admin-ui/src/realm-settings/event-config/EventsTab.tsx +++ b/apps/admin-ui/src/realm-settings/event-config/EventsTab.tsx @@ -8,7 +8,6 @@ import { Tab, Tabs, TabTitleText, - Title, } from "@patternfly/react-core"; import type RealmRepresentation from "@keycloak/keycloak-admin-client/lib/defs/realmRepresentation"; @@ -35,7 +34,7 @@ type EventsConfigForm = RealmEventsConfigRepresentation & { export const EventsTab = ({ realm }: EventsTabProps) => { const { t } = useTranslation("realm-settings"); const form = useForm(); - const { setValue, handleSubmit, watch } = form; + const { setValue, handleSubmit } = form; const [key, setKey] = useState(0); const refresh = () => setKey(new Date().getTime()); @@ -145,7 +144,6 @@ export const EventsTab = ({ realm }: EventsTabProps) => { refresh(); }; - const eventsEnabled: boolean = watch("eventsEnabled") || false; return ( <> @@ -180,11 +178,6 @@ export const EventsTab = ({ realm }: EventsTabProps) => { title={{t("userEventsSettings")}} data-testid="rs-events-tab" > - - - {t("userEventsConfig")} - - { /> - {eventsEnabled && ( + {events?.eventsEnabled && ( setAddEventType(true)} loader={() => Promise.resolve( - events?.enabledEventTypes?.map((id) => { + events.enabledEventTypes?.map((id) => { return { id }; }) || [] ) } onDelete={(value) => { - const enabledEventTypes = events?.enabledEventTypes?.filter( + const enabledEventTypes = events.enabledEventTypes?.filter( (e) => e !== value.id ); addEvents(enabledEventTypes); @@ -227,11 +220,6 @@ export const EventsTab = ({ realm }: EventsTabProps) => { title={{t("adminEventsSettings")}} data-testid="rs-admin-events-tab" > - - - {t("adminEventsConfig")} - -