From d3a216c9878106e3b71a728f7b1ab5533588a311 Mon Sep 17 00:00:00 2001 From: Bruce Schultz Date: Thu, 19 Feb 2026 08:55:48 +0100 Subject: [PATCH 1/5] feat: update event filtering and bind to meter group --- components/events/EventViewer.vue | 56 ++++++++++++++++++++----------- composables/useAPIFetch.ts | 3 ++ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/components/events/EventViewer.vue b/components/events/EventViewer.vue index 9d21401..436e51f 100644 --- a/components/events/EventViewer.vue +++ b/components/events/EventViewer.vue @@ -52,21 +52,27 @@ onMounted(() => { parseData(); }); -function updateLogLevelCounts() { - // Reset counts - logLevelDistributions.value.forEach((dist) => (dist.value = 0)); +function updateLogLevelCounts(eventList: EventLog[] = events.value) { + // Reset counts with new array to force MeterGroup reactivity + const updatedCounts = new Map( + logLevelDistributions.value.map((dist) => [ + dist.label, + { ...dist, value: 0 }, + ]), + ); - // Count occurrences - if (events.value) { - events.value.forEach((event) => { + if (eventList) { + // Count occurrences + eventList.forEach((event) => { const tags = event.attributes?.tags || []; - logLevelDistributions.value.forEach((dist) => { + updatedCounts.forEach((dist) => { if (tags.includes(dist.label)) { dist.value++; } }); }); + logLevelDistributions.value = Array.from(updatedCounts.values()); } } @@ -117,16 +123,25 @@ function getLogLevelColor(tags: string[]): string | undefined { // Table filters FilterService.register("tagsContainsAny", (value, filter) => { - if (!filter || filter.length === 0) { - return true; - } + if (!filter || filter.length === 0) return true; + if (!value || value.length === 0) return false; - if (!value || value.length === 0) { - return false; - } + const selectedServices = filter.filter((f: EventTag) => + Object.values(EventServiceTag).includes(f), + ); + const selectedLogLevels = filter.filter((f: EventTag) => + Object.values(EventLogLevelTag).includes(f), + ); + + const matchesService = + selectedServices.length === 0 || + selectedServices.some((f: EventTag) => value.includes(f)); - // Check if any element in the filter array exists in the value array - return filter.some((filterItem: EventTag) => value.includes(filterItem)); + const matchesLogLevel = + selectedLogLevels.length === 0 || + selectedLogLevels.some((f: EventTag) => value.includes(f)); + + return matchesService && matchesLogLevel; }); const defaultFilters = { @@ -165,9 +180,9 @@ function handleShowRequestEvents(requestedEvents: EventLogResponse) { } function handleFilter(event: DataTableFilterEvent) { - filteredEventCount.value = event.filteredValue - ? event.filteredValue.length - : 0; + const filtered = event.filteredValue ?? []; + filteredEventCount.value = filtered.length; + updateLogLevelCounts(filtered); } watch( @@ -194,7 +209,10 @@ watch( />
- +
diff --git a/composables/useAPIFetch.ts b/composables/useAPIFetch.ts index e7d222e..b18b189 100644 --- a/composables/useAPIFetch.ts +++ b/composables/useAPIFetch.ts @@ -30,6 +30,9 @@ export function getEvents(opts?) { return useAPIFetch("/events", { ...opts, method: "GET", + query: { + limit: 100, + }, }); } From d237fb0f41e0d7fba12a99563e71f6eb429bd647 Mon Sep 17 00:00:00 2001 From: Bruce Schultz Date: Thu, 19 Feb 2026 10:44:05 +0100 Subject: [PATCH 2/5] test: fix unit tests and imports --- components/events/DateFilterGraph.vue | 1 + components/events/EventViewer.vue | 2 + components/events/TagFilterSidePanel.vue | 1 + components/header/AvatarButton.vue | 1 + .../analysis/AnalysisControlButtons.spec.ts | 4 +- .../components/events/DateFilterGraph.spec.ts | 39 +++++++++ test/components/events/EventViewer.spec.ts | 84 +++++++++++++++++++ .../events/TagFilterSidePanel.spec.ts | 18 ++++ test/components/events/constants.ts | 29 +++++++ test/components/header/AvatarButton.spec.ts | 2 +- test/components/header/MenuHeader.spec.ts | 18 +++- test/mockapi/handlers.ts | 20 ++++- 12 files changed, 211 insertions(+), 8 deletions(-) create mode 100644 test/components/events/DateFilterGraph.spec.ts create mode 100644 test/components/events/EventViewer.spec.ts create mode 100644 test/components/events/TagFilterSidePanel.spec.ts create mode 100644 test/components/events/constants.ts diff --git a/components/events/DateFilterGraph.vue b/components/events/DateFilterGraph.vue index 6554218..56fce35 100644 --- a/components/events/DateFilterGraph.vue +++ b/components/events/DateFilterGraph.vue @@ -1,4 +1,5 @@