From 681f7d468a2acf88aa44c86b98a66488d9e98250 Mon Sep 17 00:00:00 2001 From: Tomas Kracmar Date: Wed, 22 Apr 2026 06:41:33 +0200 Subject: [PATCH] ui: persist filters, default exclude noisy services, true=green - Add 'true' to result pill success keywords (pill--ok) - Persist filter state to localStorage (loadSavedFilters/saveFilters) - Default service selection excludes Exchange and SharePoint - clearFilters resets to default selection (excluding noisy services) - Restore saved services only if they still exist in current options --- backend/frontend/index.html | 43 ++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/backend/frontend/index.html b/backend/frontend/index.html index 221de12..a2caf97 100644 --- a/backend/frontend/index.html +++ b/backend/frontend/index.html @@ -147,7 +147,7 @@
- +

Summary:

@@ -174,7 +174,7 @@
- +

Summary:

@@ -268,6 +268,7 @@ async initApp() { await this.loadVersion(); await this.initAuth(); + this.loadSavedFilters(); if (!this.authConfig?.auth_enabled || this.accessToken) { await this.loadFilterOptions(); await this.loadSourceHealth(); @@ -275,6 +276,24 @@ } }, + loadSavedFilters() { + try { + const saved = localStorage.getItem('aoc_filters'); + if (!saved) return; + const parsed = JSON.parse(saved); + const fields = ['actor', 'selectedServices', 'search', 'operation', 'result', 'start', 'end', 'limit', 'includeTags', 'excludeTags']; + fields.forEach((f) => { + if (parsed[f] !== undefined) this.filters[f] = parsed[f]; + }); + } catch {} + }, + + saveFilters() { + try { + localStorage.setItem('aoc_filters', JSON.stringify(this.filters)); + } catch {} + }, + async loadVersion() { try { const res = await fetch('/api/version'); @@ -449,6 +468,7 @@ this.nextCursor = body.next_cursor || null; this.countText = body.total >= 0 ? `${body.total} event${body.total === 1 ? '' : 's'}` : ''; this.statusText = this.events.length ? '' : 'No events found for these filters.'; + this.saveFilters(); } catch (err) { this.statusText = err.message || 'Failed to load events.'; } @@ -484,8 +504,19 @@ this.options.services = (opts.services || []).slice(0, 200); this.options.operations = (opts.operations || []).slice(0, 200); this.options.results = (opts.results || []).slice(0, 200); - if (!this.filters.selectedServices.length && this.options.services.length) { - this.filters.selectedServices = [...this.options.services]; + + const saved = localStorage.getItem('aoc_filters'); + if (!saved && this.options.services.length) { + // Default: exclude noisy high-volume services + const noisy = ['Exchange', 'SharePoint']; + this.filters.selectedServices = this.options.services.filter((s) => !noisy.includes(s)); + } else if (saved) { + try { + const parsed = JSON.parse(saved); + if (parsed.selectedServices) { + this.filters.selectedServices = parsed.selectedServices.filter((s) => this.options.services.includes(s)); + } + } catch {} } } catch {} }, @@ -519,7 +550,9 @@ }, clearFilters() { - this.filters = { actor: '', selectedServices: [...this.options.services], search: '', operation: '', result: '', start: '', end: '', limit: 100, includeTags: '', excludeTags: '' }; + const noisy = ['Exchange', 'SharePoint']; + this.filters = { actor: '', selectedServices: this.options.services.filter((s) => !noisy.includes(s)), search: '', operation: '', result: '', start: '', end: '', limit: 100, includeTags: '', excludeTags: '' }; + this.saveFilters(); this.resetPagination(); this.loadEvents(); },