diff --git a/monitor.py b/monitor.py index e8b77c2..c44373d 100644 --- a/monitor.py +++ b/monitor.py @@ -789,7 +789,7 @@ class NetworkMonitor: f'Please inspect the cable/SFP/switch port for {host}/{iface}.' ) tid = self.tickets.create(title, desc, priority='2') - if tid and is_new: + if tid: db.set_ticket_id(event_id, tid) # ------------------------------------------------------------------ @@ -831,7 +831,7 @@ class NetworkMonitor: f'Please check power and cable connectivity.' ) tid = self.tickets.create(title, desc, priority='2') - if tid and is_new: + if tid: db.set_ticket_id(event_id, tid) # ------------------------------------------------------------------ @@ -873,7 +873,7 @@ class NetworkMonitor: f'Please check the host power, management interface, and network connectivity.' ) tid = self.tickets.create(title, desc, priority='2') - if tid and is_new: + if tid: db.set_ticket_id(event_id, tid) # ------------------------------------------------------------------ diff --git a/templates/links.html b/templates/links.html index 9d3a978..3ce5229 100644 --- a/templates/links.html +++ b/templates/links.html @@ -372,14 +372,16 @@ function togglePanel(panel) { if (title) title.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true'); const id = panel.id; if (id) { - const collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); + let collapsed = {}; + try { collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); } catch(_) {} collapsed[id] = panel.classList.contains('collapsed'); - sessionStorage.setItem('linksCollapsed', JSON.stringify(collapsed)); + try { sessionStorage.setItem('linksCollapsed', JSON.stringify(collapsed)); } catch(_) {} } } function restoreCollapseState() { - const collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); + let collapsed = {}; + try { collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); } catch(_) {} for (const [id, isCollapsed] of Object.entries(collapsed)) { const panel = document.getElementById(id); if (!panel) continue; @@ -507,9 +509,11 @@ function collapseAll() { if (btn) btn.textContent = '[+]'; if (title) title.setAttribute('aria-expanded', 'false'); }); - sessionStorage.setItem('linksCollapsed', JSON.stringify( - Object.fromEntries([...document.querySelectorAll('.link-host-panel')].map(p => [p.id, true])) - )); + try { + sessionStorage.setItem('linksCollapsed', JSON.stringify( + Object.fromEntries([...document.querySelectorAll('.link-host-panel')].map(p => [p.id, true])) + )); + } catch(_) {} } function expandAll() { @@ -520,7 +524,7 @@ function expandAll() { if (btn) btn.textContent = '[–]'; if (title) title.setAttribute('aria-expanded', 'true'); }); - sessionStorage.setItem('linksCollapsed', '{}'); + try { sessionStorage.setItem('linksCollapsed', '{}'); } catch(_) {} } // ── Stale data warning ────────────────────────────────────────────