2026-03-01 23:03:18 -05:00
<!DOCTYPE html>
2026-04-18 21:01:20 -04:00
< html lang = "en" data-theme = "dark" >
2026-03-01 23:03:18 -05:00
< head >
< meta charset = "UTF-8" >
2026-04-18 21:42:04 -04:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0, viewport-fit=cover" >
2026-04-18 21:01:20 -04:00
< meta name = "theme-color" content = "#030508" >
2026-04-18 21:42:04 -04:00
< meta name = "robots" content = "noindex, nofollow" >
2026-11-15 14:56:13 -05:00
< meta name = "description" content = "GANDALF: Global Advanced Network Detection And Link Facilitator" >
2026-11-04 23:40:17 -05:00
< link rel = "icon" href = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='%23030508'/%3E%3Cpath d='M8 2l5 3v6l-5 3-5-3V5z' fill='none' stroke='%2300e5ff' stroke-width='1.5'/%3E%3C/svg%3E" >
2026-11-10 23:37:56 -05:00
< title > {% block title %}Network Monitor{% endblock %} | GANDALF</ title >
2026-04-18 21:42:04 -04:00
2026-04-18 21:01:20 -04:00
< link rel = "preconnect" href = "https://fonts.googleapis.com" >
2026-04-18 21:42:04 -04:00
< link rel = "preconnect" href = "https://fonts.gstatic.com" crossorigin >
< link href = "https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,600;0,700;1,400&family=VT323&display=swap" rel = "stylesheet" >
2026-03-14 21:40:20 -04:00
< link rel = "stylesheet" href = "{{ url_for('static', filename='base.css') }}" >
2026-03-01 23:03:18 -05:00
< link rel = "stylesheet" href = "{{ url_for('static', filename='style.css') }}" >
2026-04-18 21:42:04 -04:00
<!-- base.js loaded in head so lt.* is available for inline scripts -->
< script src = "{{ url_for('static', filename='base.js') }}" ></ script >
2026-03-01 23:03:18 -05:00
</ head >
< body >
2026-04-18 21:01:20 -04:00
2026-04-18 21:42:04 -04:00
< a class = "lt-skip-link" href = "#main-content" > Skip to main content</ a >
<!-- BOOT OVERLAY -->
< div id = "lt-boot" class = "lt-boot-overlay" data-app-name = "GANDALF" style = "display:none" aria-hidden = "true" >
2026-03-14 21:40:20 -04:00
< pre id = "lt-boot-text" class = "lt-boot-text" ></ pre >
</ div >
2026-04-18 21:01:20 -04:00
2026-04-18 21:42:04 -04:00
<!-- MOBILE NAV DRAWER -->
< div id = "lt-nav-drawer" class = "lt-nav-drawer" aria-hidden = "true" role = "dialog" aria-modal = "true" aria-label = "Navigation menu" >
< div class = "lt-nav-drawer-header" >
2026-11-15 14:56:13 -05:00
< span class = "lt-brand-title" title = "Global Advanced Network Detection And Link Facilitator" > GANDALF</ span >
2026-04-18 21:42:04 -04:00
< button type = "button" class = "lt-nav-drawer-close" id = "lt-nav-drawer-close" aria-label = "Close navigation" > ✕ </ button >
</ div >
< nav class = "lt-nav-drawer-links" aria-label = "Mobile navigation" >
< a href = "{{ url_for('index') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'index' %} active{% endif %}"
{% if request . endpoint = = ' index ' %} aria-current = "page" {% endif %} > Dashboard</ a >
2026-11-14 19:30:59 -05:00
< a href = "{{ url_for('topology_page') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'topology_page' %} active{% endif %}"
{% if request . endpoint = = ' topology_page ' %} aria-current = "page" {% endif %} > Topology</ a >
2026-11-15 15:04:34 -05:00
< a href = "{{ url_for('rack_page') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
{% if request . endpoint = = ' rack_page ' %} aria-current = "page" {% endif %} > Rack</ a >
< a href = "{{ url_for('cutsheet_page') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
{% if request . endpoint = = ' cutsheet_page ' %} aria-current = "page" {% endif %} > Cutsheet</ a >
< span class = "g-drawer-group" > More</ span >
< a href = "{{ url_for('events_page') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'events_page' %} active{% endif %}"
{% if request . endpoint = = ' events_page ' %} aria-current = "page" {% endif %} > Alert history</ a >
2026-04-18 23:54:01 -04:00
{% if user.groups and 'admin' in user.groups %}
2026-04-18 21:42:04 -04:00
< a href = "{{ url_for('suppressions_page') }}"
class = "lt-nav-drawer-link{% if request.endpoint == 'suppressions_page' %} active{% endif %}"
{% if request . endpoint = = ' suppressions_page ' %} aria-current = "page" {% endif %} > Suppressions</ a >
2026-11-15 15:04:34 -05:00
{% if not maintenance %}
< button type = "button" class = "lt-nav-drawer-link g-drawer-action" data-action = "start-maintenance" > Start maintenance</ button >
{% endif %}
2026-04-18 23:54:01 -04:00
{% endif %}
2026-04-18 21:42:04 -04:00
</ nav >
</ div >
< div id = "lt-nav-overlay" class = "lt-nav-drawer-overlay" ></ div >
<!-- PRIMARY HEADER -->
< header class = "lt-header" role = "banner" >
2026-04-18 21:01:20 -04:00
< div class = "lt-header-left" >
2026-04-18 21:42:04 -04:00
<!-- Hamburger (mobile) -->
< button type = "button"
class = "lt-menu-btn"
id = "lt-menu-btn"
data-action = "open-nav-drawer"
aria-label = "Open navigation menu"
aria-expanded = "false"
aria-controls = "lt-nav-drawer" >
< span class = "lt-menu-btn-bar" ></ span >
< span class = "lt-menu-btn-bar" ></ span >
< span class = "lt-menu-btn-bar" ></ span >
</ button >
<!-- Brand -->
2026-04-18 21:01:20 -04:00
< div class = "lt-brand" >
2026-04-18 21:42:04 -04:00
< a href = "{{ url_for('index') }}"
class = "lt-brand-title lt-glitch"
data-text = "GANDALF"
aria-label = "GANDALF home" > GANDALF</ a >
2026-11-15 14:56:13 -05:00
< span class = "lt-brand-subtitle g-brand-expansion" title = "GANDALF: Global Advanced Network Detection And Link Facilitator" >< b > G</ b > lobal < b > A</ b > dvanced < b > N</ b > etwork< br >< b > D</ b > etection < b > A</ b > nd < b > L</ b > ink < b > F</ b > acilitator</ span >
2026-03-02 12:43:11 -05:00
</ div >
2026-04-18 21:42:04 -04:00
2026-11-15 15:04:34 -05:00
<!-- Desktop nav: the four pages used daily, the rest under More -->
2026-04-18 21:01:20 -04:00
< nav class = "lt-nav" aria-label = "Main navigation" >
2026-03-02 12:43:11 -05:00
< a href = "{{ url_for('index') }}"
2026-04-18 21:42:04 -04:00
class = "lt-nav-link{% if request.endpoint == 'index' %} active{% endif %}"
2026-11-15 15:04:34 -05:00
{% if request . endpoint = = ' index ' %} aria-current = "page" {% endif %} > Dashboard</ a >
2026-11-14 19:30:59 -05:00
< a href = "{{ url_for('topology_page') }}"
class = "lt-nav-link{% if request.endpoint == 'topology_page' %} active{% endif %}"
2026-11-15 15:04:34 -05:00
{% if request . endpoint = = ' topology_page ' %} aria-current = "page" {% endif %} > Topology</ a >
< a href = "{{ url_for('rack_page') }}"
class = "lt-nav-link{% if request.endpoint == 'rack_page' %} active{% endif %}"
{% if request . endpoint = = ' rack_page ' %} aria-current = "page" {% endif %} > Rack</ a >
< a href = "{{ url_for('cutsheet_page') }}"
class = "lt-nav-link{% if request.endpoint == 'cutsheet_page' %} active{% endif %}"
{% if request . endpoint = = ' cutsheet_page ' %} aria-current = "page" {% endif %} > Cutsheet</ a >
{% set _more = request.endpoint in ('events_page', 'suppressions_page') %}
< details class = "g-nav-more" >
< summary class = "lt-nav-link{% if _more %} active{% endif %}" > More ▾</ summary >
< div class = "g-nav-more-menu" >
< a href = "{{ url_for('events_page') }}"
class = "g-nav-more-link{% if request.endpoint == 'events_page' %} active{% endif %}"
{% if request . endpoint = = ' events_page ' %} aria-current = "page" {% endif %} > Alert history</ a >
{% if user.groups and 'admin' in user.groups %}
< a href = "{{ url_for('suppressions_page') }}"
class = "g-nav-more-link{% if request.endpoint == 'suppressions_page' %} active{% endif %}"
{% if request . endpoint = = ' suppressions_page ' %} aria-current = "page" {% endif %} > Suppressions</ a >
{% endif %}
</ div >
</ details >
2026-03-02 12:43:11 -05:00
</ nav >
2026-03-01 23:03:18 -05:00
</ div >
2026-04-18 21:42:04 -04:00
2026-04-18 21:01:20 -04:00
< div class = "lt-header-right" >
2026-04-18 23:46:44 -04:00
{% set _uname = user.name or user.username %}
2026-04-18 23:54:01 -04:00
{% set _words = _uname.split() %}
{% set _initials = (_words[0][0] ~ (_words[1][0] if _words|length > 1 else ''))|upper %}
< div class = "lt-avatar lt-avatar--sm {{ _uname | avatar_color }}"
aria-hidden = "true" title = "{{ _uname }}" >
2026-04-30 21:09:56 -04:00
< img src = "{{ url_for('api_avatar') }}" alt = "" class = "lt-avatar-img" >
2026-04-18 23:54:01 -04:00
< span class = "lt-avatar-initials" > {{ _initials }}</ span >
</ div >
2026-04-18 23:46:44 -04:00
< span class = "lt-header-user" > {{ _uname }}</ span >
{% if user.groups and 'admin' in user.groups %}
2026-04-18 23:54:01 -04:00
< span class = "lt-badge lt-badge-admin" aria-label = "Administrator" > ADMIN</ span >
2026-11-12 12:53:22 -05:00
{% if not maintenance %}
< button type = "button" class = "lt-btn lt-btn-ghost lt-btn-sm" data-action = "start-maintenance"
title = "Pause all tickets while you work on the network" > Maintenance</ button >
{% endif %}
2026-04-18 23:46:44 -04:00
{% endif %}
2026-04-30 21:33:02 -04:00
2026-11-10 23:37:56 -05:00
<!-- Notification bell: shows active monitoring alerts -->
2026-04-30 21:33:02 -04:00
< div class = "lt-notif-dropdown-wrap" id = "lt-notif-wrap" >
< button type = "button"
class = "lt-btn lt-btn-ghost lt-btn-sm lt-notif-bell-btn"
id = "lt-notif-bell"
aria-label = "Active alerts"
aria-expanded = "false"
aria-controls = "lt-notif-panel"
title = "Active alerts" > 🔔 </ button >
< div class = "lt-notif-panel" id = "lt-notif-panel" aria-hidden = "true" role = "dialog" aria-label = "Active alerts" >
< div class = "lt-notif-panel-header" >
< span > Active Alerts</ span >
< button type = "button" class = "lt-notif-panel-clear" id = "lt-notif-clear-btn" > Mark all read</ button >
</ div >
< div class = "lt-notif-panel-list" id = "lt-notif-list" >
2026-05-10 23:18:33 -04:00
< div class = "lt-notif-empty" > Loading… </ div >
2026-04-30 21:33:02 -04:00
</ div >
< div class = "lt-notif-panel-footer" >
2026-05-10 23:18:33 -04:00
< a href = "{{ url_for('index') }}" class = "lt-btn lt-btn-ghost lt-btn-sm lt-notif-view-all" > View dashboard</ a >
2026-04-30 21:33:02 -04:00
</ div >
</ div >
</ div >
<!-- ⌘K affordance -->
< button type = "button"
2026-05-10 23:07:53 -04:00
class = "lt-btn lt-btn-ghost lt-btn-sm lt-cmd-hint-btn"
2026-05-10 23:45:09 -04:00
data-action = "open-cmdpalette"
2026-04-30 21:33:02 -04:00
title = "Command palette (Ctrl+K)"
2026-05-10 23:45:09 -04:00
aria-label = "Open command palette" > ⌕ K</ button >
2026-04-30 21:33:02 -04:00
2026-04-18 21:42:04 -04:00
< button type = "button" class = "lt-theme-btn" id = "lt-theme-btn"
aria-label = "Toggle theme" title = "Toggle light/dark mode" > ☀ </ button >
2026-03-01 23:03:18 -05:00
</ div >
2026-03-02 12:43:11 -05:00
</ header >
2026-03-01 23:03:18 -05:00
2026-04-18 21:42:04 -04:00
<!-- COMMAND PALETTE -->
< div id = "lt-cmd-overlay" class = "lt-cmd-overlay" role = "dialog" aria-modal = "true" aria-label = "Command palette" aria-hidden = "true" >
< div class = "lt-cmd-palette" id = "lt-cmd-palette" >
< div class = "lt-cmd-input-wrap" >
< span class = "lt-cmd-prompt" > > </ span >
< input id = "lt-cmd-input" class = "lt-cmd-input" type = "text"
placeholder = "Search commands…" autocomplete = "off"
spellcheck = "false" aria-label = "Search commands" >
</ div >
< div class = "lt-cmd-results" id = "lt-cmd-results" >
< div class = "lt-cmd-empty" > Start typing to search… </ div >
</ div >
< div class = "lt-cmd-footer" >
< span >< kbd > ↑ </ kbd >< kbd > ↓ </ kbd > Navigate</ span >
< span >< kbd > Enter</ kbd > Select</ span >
< span >< kbd > Esc</ kbd > Close</ span >
</ div >
</ div >
</ div >
<!-- MAIN CONTENT -->
< main class = "lt-main lt-container" id = "main-content" >
2026-11-12 12:53:22 -05:00
{% if maintenance %}
< div class = "maint-banner" role = "status" >
< span class = "maint-banner-text" >
< strong > Maintenance:</ strong > Gandalf is not opening tickets
{% if maintenance.expires_at %}until < time class = "maint-until" datetime = "{{ maintenance.expires_at }}" > {{ maintenance.expires_at }}</ time > {% else %}until it is ended{% endif %}.
Alerts are still recorded, and anything still failing afterwards gets a ticket.
< span class = "maint-reason" > {{ maintenance.reason }}{% if maintenance.suppressed_by %} ({{ maintenance.suppressed_by }}){% endif %}</ span >
</ span >
{% if user.groups and 'admin' in user.groups %}
< button type = "button" class = "lt-btn lt-btn-secondary lt-btn-sm" data-action = "end-maintenance"
data-sup-id = "{{ maintenance.id }}" > End now</ button >
{% endif %}
</ div >
{% endif %}
2026-03-01 23:03:18 -05:00
{% block content %}{% endblock %}
</ main >
2026-11-10 23:37:56 -05:00
<!-- FOOTER: context-sensitive per page -->
2026-04-18 21:42:04 -04:00
< footer class = "lt-footer" role = "contentinfo" >
< nav class = "lt-footer-hints" aria-label = "Keyboard shortcuts" >
2026-04-30 21:33:02 -04:00
{% if request.endpoint == 'index' %}
< span class = "lt-footer-hint" >< span class = "lt-footer-key" > [ R ]</ span > REFRESH</ span >
< span class = "lt-footer-sep" > |</ span >
< span class = "lt-footer-hint" >< span class = "lt-footer-key" > [ S ]</ span > SUPPRESS</ span >
< span class = "lt-footer-sep" > |</ span >
2026-11-05 10:11:11 -05:00
{% elif request.endpoint == 'device_page' %}
2026-04-30 21:33:02 -04:00
< span class = "lt-footer-hint" >< span class = "lt-footer-key" > [ R ]</ span > REFRESH</ span >
< span class = "lt-footer-sep" > |</ span >
{% endif %}
< button type = "button" class = "lt-footer-hint" data-action = "open-settings" >< span class = "lt-footer-key" > [ * ]</ span > CFG</ button >
2026-04-18 21:42:04 -04:00
< span class = "lt-footer-sep" > |</ span >
< button type = "button" class = "lt-footer-hint" data-action = "show-keyboard-help" >< span class = "lt-footer-key" > [ ? ]</ span > HELP</ button >
</ nav >
2026-11-15 14:56:13 -05:00
< span > GANDALF: Global Advanced Network Detection And Link Facilitator | TDS v1.2</ span >
2026-04-18 21:42:04 -04:00
</ footer >
2026-11-12 12:53:22 -05:00
{% if user.groups and 'admin' in user.groups and not maintenance %}
<!-- MAINTENANCE MODAL: pause every ticket for a while -->
< div id = "maint-modal" class = "lt-modal-overlay"
role = "dialog" aria-modal = "true" aria-labelledby = "maint-modal-title" aria-hidden = "true" >
< div class = "lt-modal" >
< div class = "lt-modal-header" >
< h3 class = "lt-modal-title" id = "maint-modal-title" > Start maintenance</ h3 >
< button type = "button" class = "lt-modal-close" data-modal-close aria-label = "Close" > ✕ </ button >
</ div >
< form id = "maint-form" >
< div class = "lt-modal-body" >
< p class = "lt-field-hint maint-intro" > Gandalf keeps checking and recording alerts but opens no tickets
until this ends. Anything still failing afterwards gets a ticket as usual.</ p >
< div class = "lt-form-group" >
< label class = "lt-label" for = "maint-reason" > Reason < span class = "required" > *</ span ></ label >
< input type = "text" class = "lt-input" id = "maint-reason" name = "reason" maxlength = "500"
value = "Maintenance" required aria-required = "true"
placeholder = "e.g. UniFi Network update" >
</ div >
< div class = "lt-form-group lt-form-group--last" >
< span class = "lt-label" id = "maint-len-label" > How long</ span >
< div class = "duration-pills" role = "group" aria-labelledby = "maint-len-label" >
< button type = "button" class = "maint-pill" data-minutes = "30" aria-pressed = "false" > 30 min</ button >
< button type = "button" class = "maint-pill active" data-minutes = "60" aria-pressed = "true" > 1 hr</ button >
< button type = "button" class = "maint-pill" data-minutes = "120" aria-pressed = "false" > 2 hr</ button >
< button type = "button" class = "maint-pill" data-minutes = "240" aria-pressed = "false" > 4 hr</ button >
</ div >
</ div >
</ div >
< div class = "lt-modal-footer" >
< button type = "button" class = "lt-btn lt-btn-secondary" data-modal-close > Cancel</ button >
< button type = "submit" class = "lt-btn lt-btn-primary" > Start</ button >
</ div >
</ form >
</ div >
</ div >
{% endif %}
2026-11-10 23:37:56 -05:00
<!-- QUICK-SUPPRESS MODAL: available on all pages via [S] shortcut -->
2026-05-10 23:07:53 -04:00
< div id = "suppress-modal" class = "lt-modal-overlay"
role = "dialog" aria-modal = "true" aria-labelledby = "suppress-modal-title" aria-hidden = "true" >
< div class = "lt-modal" >
< div class = "lt-modal-header" >
< h3 class = "lt-modal-title" id = "suppress-modal-title" > Suppress Alert</ h3 >
< button type = "button" class = "lt-modal-close" data-modal-close aria-label = "Close" > ✕ </ button >
</ div >
< form id = "suppress-form" >
< div class = "lt-modal-body" >
2026-05-10 23:15:15 -04:00
< div class = "lt-form-group" >
2026-05-10 23:07:53 -04:00
< label class = "lt-label" for = "sup-type" > Target Type</ label >
< select class = "lt-select" id = "sup-type" name = "target_type" >
< option value = "host" > Host (all interfaces)</ option >
< option value = "interface" > Specific Interface</ option >
< option value = "unifi_device" > UniFi Device</ option >
< option value = "all" > Global Maintenance</ option >
</ select >
</ div >
2026-05-10 23:15:15 -04:00
< div class = "lt-form-group" id = "sup-name-group" >
2026-05-10 23:07:53 -04:00
< label class = "lt-label" for = "sup-name" > Target Name</ label >
< input type = "text" class = "lt-input" id = "sup-name" name = "target_name" placeholder = "e.g. large1" >
</ div >
2026-05-10 23:15:15 -04:00
< div class = "lt-form-group" id = "sup-detail-group" style = "display:none" >
2026-05-10 23:07:53 -04:00
< label class = "lt-label" for = "sup-detail" > Interface < span class = "lt-field-hint" > (interface type only)</ span ></ label >
< input type = "text" class = "lt-input" id = "sup-detail" name = "target_detail" placeholder = "e.g. enp35s0" >
</ div >
2026-05-10 23:15:15 -04:00
< div class = "lt-form-group" >
2026-05-10 23:07:53 -04:00
< label class = "lt-label" for = "sup-reason" > Reason < span class = "required" > *</ span ></ label >
< input type = "text" class = "lt-input" id = "sup-reason" name = "reason"
2026-05-11 12:58:32 -04:00
placeholder = "e.g. Planned switch reboot" required aria-required = "true" >
2026-05-10 23:07:53 -04:00
</ div >
2026-05-10 23:15:15 -04:00
< div class = "lt-form-group lt-form-group--last" >
2026-05-10 23:07:53 -04:00
< label class = "lt-label" > Duration</ label >
2026-05-10 23:34:16 -04:00
< div class = "duration-pills" role = "group" aria-label = "Select suppression duration" >
2026-05-11 12:58:32 -04:00
< button type = "button" class = "pill" data-duration = "30" aria-pressed = "false" aria-label = "30 minutes" > 30 min</ button >
< button type = "button" class = "pill" data-duration = "60" aria-pressed = "false" aria-label = "1 hour" > 1 hr</ button >
< button type = "button" class = "pill" data-duration = "240" aria-pressed = "false" aria-label = "4 hours" > 4 hr</ button >
< button type = "button" class = "pill" data-duration = "480" aria-pressed = "false" aria-label = "8 hours" > 8 hr</ button >
< button type = "button" class = "pill pill-manual active" data-duration = "" aria-pressed = "true" aria-label = "Manual, no expiry" > Manual ∞ </ button >
2026-05-10 23:07:53 -04:00
</ div >
< input type = "hidden" id = "sup-expires" name = "expires_minutes" value = "" >
< div class = "lt-field-hint" id = "duration-hint" > Persists until manually removed.</ div >
</ div >
</ div >
< div class = "lt-modal-footer" >
< button type = "button" class = "lt-btn lt-btn-secondary" data-modal-close > Cancel</ button >
< button type = "submit" class = "lt-btn lt-btn-primary" > Apply</ button >
</ div >
</ form >
</ div >
</ div >
2026-04-18 21:42:04 -04:00
<!-- KEYBOARD SHORTCUTS MODAL -->
< div id = "lt-keys-help" class = "lt-modal-overlay" aria-hidden = "true" >
< div class = "lt-modal" role = "dialog" aria-modal = "true" aria-labelledby = "keys-help-title" >
< div class = "lt-modal-header" >
< span class = "lt-modal-title" id = "keys-help-title" > Keyboard Shortcuts</ span >
< button type = "button" class = "lt-modal-close" data-modal-close aria-label = "Close" > ✕ </ button >
</ div >
< div class = "lt-modal-body" >
2026-11-15 14:56:13 -05:00
< p class = "g-help-about" >< strong > GANDALF</ strong > : < b > G</ b > lobal < b > A</ b > dvanced < b > N</ b > etwork < b > D</ b > etection < b > A</ b > nd < b > L</ b > ink < b > F</ b > acilitator. It watches the UniFi switches and the hosts' links, works out what is plugged in where, and raises a ticket when something breaks.</ p >
2026-05-10 23:15:15 -04:00
< table class = "lt-table" >
2026-04-18 21:42:04 -04:00
< thead >< tr >< th > Shortcut</ th >< th > Action</ th ></ tr ></ thead >
< tbody >
< tr >< td > Ctrl / ⌘ + K</ td >< td > Command palette</ td ></ tr >
2026-11-05 10:11:11 -05:00
< tr >< td > R</ td >< td > Refresh data (Dashboard / Device)</ td ></ tr >
2026-11-04 23:40:17 -05:00
< tr >< td > /</ td >< td > Search devices (Dashboard)</ td ></ tr >
2026-04-30 21:33:02 -04:00
< tr >< td > S</ td >< td > Quick-suppress alert (Dashboard)</ td ></ tr >
< tr >< td > *</ td >< td > Open settings</ td ></ tr >
2026-04-18 21:42:04 -04:00
< tr >< td > ?</ td >< td > Show this help</ td ></ tr >
2026-04-30 21:33:02 -04:00
< tr >< td > ESC</ td >< td > Close modal / panel</ td ></ tr >
2026-04-18 21:42:04 -04:00
</ tbody >
</ table >
</ div >
< div class = "lt-modal-footer" >
< button type = "button" class = "lt-btn" data-modal-close > Close</ button >
</ div >
</ div >
</ div >
2026-04-30 21:33:02 -04:00
<!-- SETTINGS MODAL -->
< div id = "lt-settings-modal" class = "lt-modal-overlay" aria-hidden = "true" >
< div class = "lt-modal" role = "dialog" aria-modal = "true" aria-labelledby = "settings-modal-title" >
< div class = "lt-modal-header" >
< span class = "lt-modal-title" id = "settings-modal-title" > Settings</ span >
< button type = "button" class = "lt-modal-close" data-modal-close aria-label = "Close" > ✕ </ button >
</ div >
< div class = "lt-modal-body" >
< div class = "lt-form-group" >
< label class = "lt-label" > Auto-refresh interval</ label >
2026-05-10 23:34:16 -04:00
< div class = "duration-pills" id = "settings-refresh-pills" role = "group" aria-label = "Select auto-refresh interval" >
< button type = "button" class = "pill" data-refresh-interval = "15" aria-pressed = "false" > 15 s</ button >
< button type = "button" class = "pill" data-refresh-interval = "30" aria-pressed = "false" > 30 s</ button >
< button type = "button" class = "pill" data-refresh-interval = "60" aria-pressed = "false" > 1 min</ button >
< button type = "button" class = "pill" data-refresh-interval = "300" aria-pressed = "false" > 5 min</ button >
< button type = "button" class = "pill" data-refresh-interval = "0" aria-pressed = "false" > Off</ button >
2026-04-30 21:33:02 -04:00
</ div >
< div class = "lt-field-hint" id = "settings-refresh-hint" ></ div >
</ div >
2026-05-10 23:15:15 -04:00
< div class = "lt-divider lt-divider--compact" ></ div >
2026-04-30 21:33:02 -04:00
< div class = "lt-kv-grid" >
2026-05-10 23:07:53 -04:00
< span class = "lt-kv-key" > User</ span >
< span class = "lt-kv-val lt-kv-val--cyan" > {{ user.name or user.username }}</ span >
2026-04-30 21:33:02 -04:00
{% if user.groups %}
2026-05-10 23:07:53 -04:00
< span class = "lt-kv-key" > Groups</ span >
< span class = "lt-kv-val" > {{ user.groups | join(', ') }}</ span >
2026-04-30 21:33:02 -04:00
{% endif %}
</ div >
</ div >
< div class = "lt-modal-footer" >
< button type = "button" class = "lt-btn" data-modal-close > Close</ button >
</ div >
</ div >
</ div >
2026-03-14 14:31:57 -04:00
< script >
const GANDALF_CONFIG = {
2026-05-11 09:05:53 -04:00
ticket_web_url : {{ config . get ( 'ticket_api' , {}). get ( 'web_url' , 'http://t.lotusguild.org/ticket/' ) | tojson }}
2026-03-14 14:31:57 -04:00
};
</ script >
2026-04-18 21:42:04 -04:00
< script src = "{{ url_for('static', filename='app.js') }}" ></ script >
{% block scripts %}{% endblock %}
2026-04-18 21:01:20 -04:00
< script >
2026-04-18 21:42:04 -04:00
if ( window . lt ) {
2026-04-18 21:01:20 -04:00
lt . init ({ bootName : 'GANDALF' });
2026-04-18 21:42:04 -04:00
// Theme toggle
2026-05-10 23:37:32 -04:00
const themeBtn = document . getElementById ( 'lt-theme-btn' );
2026-04-18 21:42:04 -04:00
if ( themeBtn ) themeBtn . addEventListener ( 'click' , function () { lt . theme . toggle (); });
// Command palette
lt . cmdPalette . init ([
2026-04-30 21:33:02 -04:00
{ id : 'nav-dashboard' , group : 'Navigate' , icon : '~' , label : 'Dashboard' , action : function () { window . location . href = '/' ; } },
2026-11-10 20:29:09 -05:00
{ id : 'nav-history' , group : 'Navigate' , icon : '⏱' , label : 'Alert History' , action : function () { window . location . href = '/events' ; } },
2026-11-10 16:05:08 -05:00
{ id : 'nav-cutsheet' , group : 'Navigate' , icon : '🔌' , label : 'Cutsheet' , action : function () { window . location . href = '/cutsheet' ; } },
2026-11-10 20:59:30 -05:00
{ id : 'nav-rack' , group : 'Navigate' , icon : '🗄' , label : 'Rack' , action : function () { window . location . href = '/rack' ; } },
2026-11-14 19:30:59 -05:00
{ id : 'nav-topology' , group : 'Navigate' , icon : '⛓' , label : 'Topology' , action : function () { window . location . href = '/topology' ; } },
2026-04-30 21:33:02 -04:00
{ id : 'nav-suppressions' , group : 'Navigate' , icon : '🔕' , label : 'Suppressions' , action : function () { window . location . href = '/suppressions' ; } },
{ id : 'action-refresh' , group : 'Actions' , icon : '↻' , label : 'Refresh Data' , kbd : 'R' , action : function () { lt . autoRefresh . now (); } },
{ id : 'action-suppress' , group : 'Actions' , icon : '🔕' , label : 'New Suppression' , kbd : 'S' , action : function () { if ( typeof openSuppressModal === 'function' ) openSuppressModal ( 'host' , '' , '' ); else window . location . href = '/suppressions' ; } },
{ id : 'help-shortcuts' , group : 'Help' , icon : '?' , label : 'Keyboard Shortcuts' , kbd : '?' , action : function () { lt . modal . open ( 'lt-keys-help' ); } },
{ id : 'help-settings' , group : 'Help' , icon : '*' , label : 'Settings' , kbd : '*' , action : function () { lt . modal . open ( 'lt-settings-modal' ); } },
{ id : 'help-theme' , group : 'Help' , icon : '☀' , label : 'Toggle Theme' , action : function () { lt . theme . toggle (); } },
2026-04-18 21:42:04 -04:00
]);
}
2026-11-15 15:04:34 -05:00
// ── More menu: close on a click elsewhere or Escape ───────────────────
document . addEventListener ( 'click' , function ( e ) {
document . querySelectorAll ( '.g-nav-more[open]' ). forEach ( function ( d ) {
if ( ! d . contains ( e . target )) d . removeAttribute ( 'open' );
});
});
document . addEventListener ( 'keydown' , function ( e ) {
if ( e . key !== 'Escape' ) return ;
document . querySelectorAll ( '.g-nav-more[open]' ). forEach ( function ( d ) {
d . removeAttribute ( 'open' );
d . querySelector ( 'summary' ). focus ();
});
});
2026-04-30 21:33:02 -04:00
// ── Global footer + key actions ───────────────────────────────────────
2026-04-18 21:42:04 -04:00
document . addEventListener ( 'click' , function ( e ) {
2026-05-10 23:37:32 -04:00
const btn = e . target . closest ( '[data-action]' );
2026-04-18 21:42:04 -04:00
if ( ! btn ) return ;
2026-05-10 23:37:32 -04:00
const action = btn . getAttribute ( 'data-action' );
2026-05-10 23:45:09 -04:00
if ( action === 'open-cmdpalette' && window . lt && lt . cmdPalette ) lt . cmdPalette . open ();
if ( action === 'show-keyboard-help' && window . lt ) lt . modal . open ( 'lt-keys-help' );
if ( action === 'open-settings' && window . lt ) lt . modal . open ( 'lt-settings-modal' );
2026-04-18 21:42:04 -04:00
});
2026-04-30 21:33:02 -04:00
lt . keys . on ( 'r' , function () { lt . autoRefresh . now (); });
lt . keys . on ( '?' , function () { if ( window . lt ) lt . modal . open ( 'lt-keys-help' ); });
lt . keys . on ( '*' , function () { if ( window . lt ) lt . modal . open ( 'lt-settings-modal' ); });
lt . keys . on ( 's' , function () {
if ( typeof openSuppressModal === 'function' ) openSuppressModal ( 'host' , '' , '' );
2026-04-18 21:01:20 -04:00
});
2026-04-30 21:09:56 -04:00
2026-04-30 21:33:02 -04:00
// ── Avatar image error fallback ───────────────────────────────────────
2026-04-30 21:09:56 -04:00
document . addEventListener ( 'error' , function ( e ) {
if ( e . target . tagName === 'IMG' && e . target . closest ( '.lt-avatar' )) {
e . target . classList . add ( 'lt-avatar-img-err' );
}
}, true );
2026-04-30 21:33:02 -04:00
// ── Settings modal ────────────────────────────────────────────────────
( function () {
2026-05-10 23:37:32 -04:00
const LS_KEY = 'gandalf_settings' ;
const DEFAULT = { refreshInterval : 30 };
2026-04-30 21:33:02 -04:00
function loadSettings () {
try { return Object . assign ({}, DEFAULT , JSON . parse ( localStorage . getItem ( LS_KEY ) || '{}' )); }
catch ( _ ) { return Object . assign ({}, DEFAULT ); }
}
function saveSettings ( s ) {
try { localStorage . setItem ( LS_KEY , JSON . stringify ( s )); } catch ( _ ) {}
if ( typeof window . onGandalfSettingsChanged === 'function' ) window . onGandalfSettingsChanged ( s );
}
function applyRefreshPillUI ( interval ) {
document . querySelectorAll ( '#settings-refresh-pills .pill' ). forEach ( function ( p ) {
2026-05-10 23:37:32 -04:00
const isActive = parseInt ( p . dataset . refreshInterval ) === interval ;
2026-05-10 23:34:16 -04:00
p . classList . toggle ( 'active' , isActive );
p . setAttribute ( 'aria-pressed' , isActive ? 'true' : 'false' );
2026-04-30 21:33:02 -04:00
});
2026-05-10 23:37:32 -04:00
const hint = document . getElementById ( 'settings-refresh-hint' );
2026-04-30 21:33:02 -04:00
if ( hint ) {
if ( interval === 0 ) hint . textContent = 'Auto-refresh disabled.' ;
else if ( interval < 60 ) hint . textContent = 'Refreshes every ' + interval + ' seconds.' ;
else hint . textContent = 'Refreshes every ' + Math . floor ( interval / 60 ) + ' minute' + ( interval > 60 ? 's' : '' ) + '.' ;
}
}
// Init pill UI from saved settings
2026-05-10 23:37:32 -04:00
const _settings = loadSettings ();
2026-04-30 21:33:02 -04:00
applyRefreshPillUI ( _settings . refreshInterval );
// Expose for pages that need to read it (e.g. index.html for autoRefresh)
window . gandalfSettings = _settings ;
document . addEventListener ( 'click' , function ( e ) {
2026-05-10 23:37:32 -04:00
const pill = e . target . closest ( '#settings-refresh-pills .pill[data-refresh-interval]' );
2026-04-30 21:33:02 -04:00
if ( ! pill ) return ;
2026-05-10 23:37:32 -04:00
const interval = parseInt ( pill . dataset . refreshInterval );
2026-04-30 21:33:02 -04:00
_settings . refreshInterval = interval ;
saveSettings ( _settings );
applyRefreshPillUI ( interval );
});
})();
2026-11-10 23:37:56 -05:00
// ── Notification Bell: shows active monitoring alerts ────────────────
2026-04-30 21:33:02 -04:00
( function () {
2026-05-10 23:37:32 -04:00
const bell = document . getElementById ( 'lt-notif-bell' );
const panel = document . getElementById ( 'lt-notif-panel' );
const list = document . getElementById ( 'lt-notif-list' );
const clearBtn = document . getElementById ( 'lt-notif-clear-btn' );
const wrapEl = document . getElementById ( 'lt-notif-wrap' );
2026-04-30 21:33:02 -04:00
if ( ! bell || ! panel ) return ;
2026-05-10 23:37:32 -04:00
let _open = false ;
let _lastEvents = [];
const LS_READ_KEY = 'gandalf_notif_read_before' ;
2026-04-30 21:33:02 -04:00
function getReadBefore () {
try { return parseInt ( localStorage . getItem ( LS_READ_KEY ) || '0' ); } catch ( _ ) { return 0 ; }
}
function setReadBefore ( ts ) {
try { localStorage . setItem ( LS_READ_KEY , String ( ts )); } catch ( _ ) {}
}
function esc ( s ) {
return ( window . lt && lt . escHtml ) ? lt . escHtml ( String ( s )) : String ( s ). replace ( /&/g , '&' ). replace ( /</g , '<' ). replace ( />/g , '>' );
}
function toMs ( dateStr ) {
if ( ! dateStr ) return 0 ;
return new Date ( dateStr . replace ( ' UTC' , 'Z' ). replace ( ' ' , 'T' )). getTime ();
}
function fmtAgo ( dateStr ) {
2026-05-10 23:37:32 -04:00
const diff = Math . floor (( Date . now () - toMs ( dateStr )) / 1000 );
2026-04-30 21:33:02 -04:00
if ( diff < 60 ) return diff + 's ago' ;
if ( diff < 3600 ) return Math . floor ( diff / 60 ) + 'm ago' ;
if ( diff < 86400 ) return Math . floor ( diff / 3600 ) + 'h ago' ;
return Math . floor ( diff / 86400 ) + 'd ago' ;
}
2026-05-10 23:37:32 -04:00
const SEV_DOT = { critical : 'var(--red)' , warning : 'var(--amber)' };
2026-04-30 21:33:02 -04:00
function renderAlerts ( events ) {
_lastEvents = events || [];
2026-05-10 23:37:32 -04:00
const readBefore = getReadBefore ();
const active = _lastEvents . filter ( function ( e ) { return e . severity !== 'info' ; });
const unreadCount = active . filter ( function ( e ) { return toMs ( e . last_seen ) > readBefore ; }). length ;
2026-04-30 21:33:02 -04:00
lt . notif . set ( bell , unreadCount );
if ( ! active . length ) {
2026-05-10 23:18:33 -04:00
list . innerHTML = '<div class="lt-notif-empty">✔ No active alerts</div>' ;
2026-04-30 21:33:02 -04:00
return ;
}
list . innerHTML = active . slice ( 0 , 25 ). map ( function ( e ) {
2026-05-10 23:37:32 -04:00
const isUnread = toMs ( e . last_seen ) > readBefore ;
const dotColor = SEV_DOT [ e . severity ] || 'var(--text-muted)' ;
2026-04-30 21:33:02 -04:00
return '<div class="lt-notif-item' + ( isUnread ? ' lt-notif-item--unread' : '' ) + '">' +
2026-05-10 23:18:33 -04:00
'<div class="lt-notif-dot' + ( isUnread ? '' : ' lt-notif-dot--read' ) + '" style="background:' + dotColor + '"></div>' +
2026-04-30 21:33:02 -04:00
'<div class="lt-notif-item-body">' +
'<div class="lt-notif-item-title">' + esc ( e . target_name ) + ( e . target_detail ? ' · ' + esc ( e . target_detail ) : '' ) + '</div>' +
'<div class="lt-notif-item-time">' + esc ( e . event_type . replace ( /_/g , ' ' )) + ' · ' + fmtAgo ( e . last_seen ) + '</div>' +
'</div></div>' ;
}). join ( '' );
}
function fetchAlerts ( andRender ) {
fetch ( '/api/status' , { credentials : 'same-origin' })
. then ( function ( r ) { return r . json (); })
. then ( function ( data ) {
2026-05-10 23:37:32 -04:00
const events = data . events || [];
2026-04-30 21:33:02 -04:00
if ( andRender ) {
renderAlerts ( events );
} else {
_lastEvents = events ;
2026-05-10 23:37:32 -04:00
const readBefore = getReadBefore ();
const active = events . filter ( function ( e ) { return e . severity !== 'info' ; });
const unread = active . filter ( function ( e ) { return toMs ( e . last_seen ) > readBefore ; }). length ;
2026-04-30 21:33:02 -04:00
lt . notif . set ( bell , unread );
}
})
. catch ( function () {
2026-05-10 23:18:33 -04:00
if ( andRender ) list . innerHTML = '<div class="lt-notif-empty">Could not load</div>' ;
2026-04-30 21:33:02 -04:00
});
}
function openPanel () { _open = true ; panel . removeAttribute ( 'aria-hidden' ); bell . setAttribute ( 'aria-expanded' , 'true' ); fetchAlerts ( true ); }
function closePanel () { _open = false ; panel . setAttribute ( 'aria-hidden' , 'true' ); bell . setAttribute ( 'aria-expanded' , 'false' ); }
bell . addEventListener ( 'click' , function ( e ) { e . stopPropagation (); _open ? closePanel () : openPanel (); });
if ( clearBtn ) {
clearBtn . addEventListener ( 'click' , function () {
setReadBefore ( Date . now ());
renderAlerts ( _lastEvents );
});
}
document . addEventListener ( 'click' , function ( e ) { if ( _open && wrapEl && ! wrapEl . contains ( e . target )) closePanel (); });
document . addEventListener ( 'keydown' , function ( e ) { if ( e . key === 'Escape' && _open ) closePanel (); });
// Initial badge load + poll every 60 s
fetchAlerts ( false );
setInterval ( function () { fetchAlerts ( _open ); }, 60000 );
// Allow refreshAll() to also push fresh events to the bell
window . gandalfNotifUpdate = function ( events ) { renderAlerts ( events ); };
})();
2026-04-18 21:01:20 -04:00
</ script >
2026-04-18 21:42:04 -04:00
2026-03-01 23:03:18 -05:00
</ body >
</ html >