fix: ora le ricerche lavorano nuovamente in cache. feat: aggiunto pulsante per eliminare rapidamente una ricerca testuale. feat: la ricerca in alto a destra rimanda alla ricerca spudorata ed il campo viene liberato.

This commit is contained in:
Gabriele Cimaschi committed 2026-08-26 14:23:20 +02:00
1 parent c5e17ca57a
commit c0c8a2531c
4 files changed
+57 -54

No files matched your search

+20 -13
View File
@@ -9,15 +9,20 @@ const TicketListView = {
sortDir: 'DESC',
selectedIds: new Set(),
selectedOrder: [],
rawTickets: null,
rawTicketsByMode: {
general: null,
my: null
},
lastSearchTermByMode: {
general: '',
my: ''
},
otrsBaseUrl: null,
lastMode: null,
lastSearchTerm: '',
needsRefresh: false,
invalidateCache() {
this.rawTickets = null;
this.lastMode = null;
this.rawTicketsByMode.general = null;
this.rawTicketsByMode.my = null;
this.needsRefresh = true;
},
@@ -38,11 +43,13 @@ const TicketListView = {
const container = document.getElementById('view-container');
if (!container) return;
const cachedTickets = this.rawTicketsByMode[newMode];
const cachedSearchTerm = this.lastSearchTermByMode[newMode];
const shouldFetch = force ||
this.needsRefresh ||
!this.rawTickets ||
this.lastMode !== newMode ||
this.lastSearchTerm !== globalSearchVal;
!cachedTickets ||
cachedSearchTerm !== globalSearchVal;
if (shouldFetch) {
if (!container.querySelector('.ticket-table-wrapper') && !container.querySelector('.ticket-table')) {
@@ -78,10 +85,9 @@ const TicketListView = {
return;
}
this.rawTickets = data.tickets || [];
this.rawTicketsByMode[newMode] = data.tickets || [];
this.lastSearchTermByMode[newMode] = globalSearchVal;
this.otrsBaseUrl = data.otrsBaseUrl || '';
this.lastMode = newMode;
this.lastSearchTerm = globalSearchVal;
this.needsRefresh = false;
} catch (err) {
const currentHash = (window.location.hash || '#/dashboard').split('?')[0];
@@ -133,8 +139,9 @@ const TicketListView = {
},
getFilteredTickets() {
if (!this.rawTickets) return [];
let list = [...this.rawTickets];
const rawTickets = this.rawTicketsByMode[Filters.currentMode] || [];
if (!rawTickets || rawTickets.length === 0) return [];
let list = [...rawTickets];
const s = Filters.state;
// Sub-search text filter