User events configuration fine tuning - #1562 (#4076)

* removed header title

* fixed showing events list on save click

* feedback

Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
agagancarczyk 2022-12-22 08:33:44 +00:00 committed by GitHub
parent 62c170f765
commit 0f426ee76d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 21 deletions

View file

@ -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."
}

View file

@ -34,7 +34,6 @@ export const EventConfigForm = ({
setValue,
formState: { isDirty },
} = form;
const eventKey = type === "admin" ? "adminEventsEnabled" : "eventsEnabled";
const eventsEnabled: boolean = watch(eventKey);

View file

@ -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<EventsConfigForm>();
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 (
<>
<DeleteConfirm />
@ -180,11 +178,6 @@ export const EventsTab = ({ realm }: EventsTabProps) => {
title={<TabTitleText>{t("userEventsSettings")}</TabTitleText>}
data-testid="rs-events-tab"
>
<PageSection>
<Title headingLevel="h1" size="xl">
{t("userEventsConfig")}
</Title>
</PageSection>
<PageSection>
<FormAccess
role="manage-events"
@ -199,20 +192,20 @@ export const EventsTab = ({ realm }: EventsTabProps) => {
/>
</FormAccess>
</PageSection>
{eventsEnabled && (
{events?.eventsEnabled && (
<PageSection>
<EventsTypeTable
key={tableKey}
addTypes={() => 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={<TabTitleText>{t("adminEventsSettings")}</TabTitleText>}
data-testid="rs-admin-events-tab"
>
<PageSection>
<Title headingLevel="h4" size="xl">
{t("adminEventsConfig")}
</Title>
</PageSection>
<PageSection>
<FormAccess
role="manage-events"

View file

@ -52,7 +52,7 @@ export function EventsTypeTable({
? []
: [
{
title: t("common:delete"),
title: t("common:remove"),
onRowClick: onDelete,
},
]