diff --git a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties index 9c4467c48e9..f5923a7f1c6 100644 --- a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties +++ b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties @@ -3333,4 +3333,6 @@ downloadThemeJar=Download theme JAR themeColorInfo=Here you can set the patternfly color variables and create a "theme jar" file that you can download and put in your providers folder to apply the theme to your realm. permissionsSubTitle=Fine-grained admin permissions allow assigning detailed, specific access rights, controlling which resources and actions can be managed. connectionTrace=Connection trace -connectionTraceHelp=If enabled, incoming and outgoing LDAP ASN.1 BER packets will be dumped to the error output stream. Be careful when enabling this option in production as it will expose all data sent to and from the LDAP server. \ No newline at end of file +connectionTraceHelp=If enabled, incoming and outgoing LDAP ASN.1 BER packets will be dumped to the error output stream. Be careful when enabling this option in production as it will expose all data sent to and from the LDAP server. +savingUserEventsOff=Saving user events turned off +savingAdminEventsOff=Saving admin events turned off diff --git a/js/apps/admin-ui/src/Banners.tsx b/js/apps/admin-ui/src/Banners.tsx index 7ddd2ef1413..7785c46a90e 100644 --- a/js/apps/admin-ui/src/Banners.tsx +++ b/js/apps/admin-ui/src/Banners.tsx @@ -5,13 +5,21 @@ import { useTranslation } from "react-i18next"; type WarnBannerProps = { msg: string; + className?: string; }; -const WarnBanner = ({ msg }: WarnBannerProps) => { +type EventsBannerType = "userEvents" | "adminEvents"; + +const WarnBanner = ({ msg, className }: WarnBannerProps) => { const { t } = useTranslation(); return ( - + { if (whoAmI.isTemporary()) return ; }; + +export const EventsBanners = ({ type }: { type: EventsBannerType }) => { + const msg = + type === "userEvents" ? "savingUserEventsOff" : "savingAdminEventsOff"; + + return ; +}; diff --git a/js/apps/admin-ui/src/events/AdminEvents.tsx b/js/apps/admin-ui/src/events/AdminEvents.tsx index cf31abcba44..641bff6948c 100644 --- a/js/apps/admin-ui/src/events/AdminEvents.tsx +++ b/js/apps/admin-ui/src/events/AdminEvents.tsx @@ -6,6 +6,7 @@ import { ListEmptyState, SelectVariant, TextControl, + useFetch, } from "@keycloak/keycloak-ui-shared"; import { ActionGroup, @@ -47,6 +48,7 @@ import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { prettyPrintJSON } from "../util"; import useFormatDate, { FORMAT_DATE_AND_TIME } from "../utils/useFormatDate"; import { CellResourceLinkRenderer } from "./ResourceLinks"; +import { EventsBanners } from "../Banners"; import "./events.css"; @@ -135,6 +137,7 @@ export const AdminEvents = () => { >({}); const [authEvent, setAuthEvent] = useState(); + const [adminEventsEnabled, setAdminEventsEnabled] = useState(); const [representationEvent, setRepresentationEvent] = useState(); @@ -161,6 +164,14 @@ export const AdminEvents = () => { control, } = form; + useFetch( + () => adminClient.realms.getConfigEvents({ realm }), + (events) => { + setAdminEventsEnabled(events?.adminEventsEnabled!); + }, + [], + ); + function loader(first?: number, max?: number) { return adminClient.realms.findAdminEvents({ // The admin client wants 'dateFrom' and 'dateTo' to be Date objects, however it cannot actually handle them so we need to cast to any. @@ -271,8 +282,8 @@ export const AdminEvents = () => { /> )} + {!adminEventsEnabled && } { const [searchDropdownOpen, setSearchDropdownOpen] = useState(false); const [selectOpen, setSelectOpen] = useState(false); const [events, setEvents] = useState(); + const [userEventsEnabled, setUserEventsEnabled] = useState(); const [activeFilters, setActiveFilters] = useState< Partial >({}); @@ -164,8 +166,10 @@ export const UserEvents = ({ user, client }: UserEventsProps) => { useFetch( () => adminClient.realms.getConfigEvents({ realm }), - (events) => - setEvents(localeSort(events?.enabledEventTypes || [], (e) => e)), + (events) => { + setUserEventsEnabled(events?.eventsEnabled!); + setEvents(localeSort(events?.enabledEventTypes || [], (e) => e)); + }, [], ); @@ -429,7 +433,8 @@ export const UserEvents = ({ user, client }: UserEventsProps) => { }; return ( -
+ <> + {!userEventsEnabled && } { } isSearching={Object.keys(activeFilters).length > 0} /> -
+ ); }; diff --git a/js/apps/admin-ui/src/realm-settings/NewAttributeSettings.tsx b/js/apps/admin-ui/src/realm-settings/NewAttributeSettings.tsx index baa684c3948..1d48f0d079c 100644 --- a/js/apps/admin-ui/src/realm-settings/NewAttributeSettings.tsx +++ b/js/apps/admin-ui/src/realm-settings/NewAttributeSettings.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import type { UserProfileAttribute, UserProfileConfig,