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 f57add052d..01727d83fe 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 @@ -3098,4 +3098,8 @@ noLanguagesSearchResultsInstructions=Click on the search bar above to search for addTranslationDialogOkBtn=Ok translationError=Please add translations before saving fetchRoles=Fetch Roles -fetchRolesHelp=By default, only the roles available from the token sent with the authorization requests are used to check if the user is granted with a role. If this setting is enabled, the policy will ignore roles from the token and check any role associated with the user instead. \ No newline at end of file +fetchRolesHelp=By default, only the roles available from the token sent with the authorization requests are used to check if the user is granted with a role. If this setting is enabled, the policy will ignore roles from the token and check any role associated with the user instead. +emptyAdminEvents=No admin events +emptyAdminEventsInstructions=There are no admin events in this realm. +emptyUserEvents=No user events +emptyUserEventsInstructions=There are no user events in this realm. diff --git a/js/apps/admin-ui/src/events/AdminEvents.tsx b/js/apps/admin-ui/src/events/AdminEvents.tsx index cb8e22a414..aafe612e94 100644 --- a/js/apps/admin-ui/src/events/AdminEvents.tsx +++ b/js/apps/admin-ui/src/events/AdminEvents.tsx @@ -528,8 +528,8 @@ export const AdminEvents = () => { ]} emptyState={ } isSearching={Object.keys(activeFilters).length > 0} diff --git a/js/apps/admin-ui/src/events/EventsSection.tsx b/js/apps/admin-ui/src/events/EventsSection.tsx index effd659d0d..5fc66d9249 100644 --- a/js/apps/admin-ui/src/events/EventsSection.tsx +++ b/js/apps/admin-ui/src/events/EventsSection.tsx @@ -27,12 +27,11 @@ import { CheckCircleIcon, WarningTriangleIcon } from "@patternfly/react-icons"; import { cellWidth, expandable } from "@patternfly/react-table"; import { pickBy } from "lodash-es"; import { useState } from "react"; -import { Controller, useForm } from "react-hook-form"; +import { Controller, FormProvider, useForm } from "react-hook-form"; import { Trans, useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { adminClient } from "../admin-client"; -import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { RoutableTabs, @@ -49,6 +48,7 @@ import { useFetch } from "../utils/useFetch"; import useFormatDate, { FORMAT_DATE_AND_TIME } from "../utils/useFormatDate"; import { AdminEvents } from "./AdminEvents"; import { EventsTab, toEvents } from "./routes/Events"; +import { TextControl } from "ui-shared"; import "./events.css"; @@ -145,17 +145,18 @@ export default function EventsSection() { ipAddress: t("ipAddress"), }; + const form = useForm({ + mode: "onChange", + defaultValues, + }); + const { getValues, - register, reset, formState: { isDirty }, control, handleSubmit, - } = useForm({ - mode: "onChange", - defaultValues, - }); + } = form; useFetch( () => adminClient.realms.getConfigEvents({ realm }), @@ -222,212 +223,196 @@ export default function EventsSection() { const userEventSearchFormDisplay = () => { return ( - - - -
+ + + - - - - - ( - - )} - /> - - - - - - ( - field.onChange(value)} - inputProps={{ id: "kc-dateFrom" }} - /> - )} - /> - - - ( - field.onChange(value)} - inputProps={{ id: "kc-dateTo" }} - /> - )} - /> - - - - - - - - - - - - - {Object.entries(activeFilters).length > 0 && ( -
- {Object.entries(activeFilters).map((filter) => { - const [key, value] = filter as [ - keyof UserEventSearchForm, - string | EventType[], - ]; + ( + )} - - ); - })} -
- )} -
-
+ /> + + + + ( + field.onChange(value)} + inputProps={{ id: "kc-dateFrom" }} + /> + )} + /> + + + ( + field.onChange(value)} + inputProps={{ id: "kc-dateTo" }} + /> + )} + /> + + + + + + + +
+
+ + {Object.entries(activeFilters).length > 0 && ( +
+ {Object.entries(activeFilters).map((filter) => { + const [key, value] = filter as [ + keyof UserEventSearchForm, + string | EventType[], + ]; + + return ( + removeFilter(key)} + > + {typeof value === "string" ? ( + {value} + ) : ( + value.map((entry) => ( + removeFilterValue(key, entry)} + > + {t(`eventTypes.${entry}.name`)} + + )) + )} + + ); + })} +
+ )} +
+
+ ); }; @@ -501,8 +486,8 @@ export default function EventsSection() { ]} emptyState={ } isSearching={Object.keys(activeFilters).length > 0}