diff --git a/static/css/style.css b/static/css/style.css index 0ff6aaf..b73d7ae 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,36 +1,55 @@ -/* --- TEMA MODERNO (Soft UI / Tailwind inspired) --- */ +/* --- TEMA SCHEMATIC / BLUEPRINT (Disegno Tecnico CAD) --- */ :root { - --primary: #3b82f6; --success: #10b981; --danger: #ef4444; --accent: #8b5cf6; - --bg-gradient: #0f172a; - --card-bg: #1e293b; - --border-color: rgba(255, 255, 255, 0.1); - --text-main: #f8fafc; - --text-muted: #94a3b8; - --topbar-bg: #1e293b; + --bg-base: #06246f; + --grid-color: rgba(123, 198, 255, 0.15); + + --border-main: #7bc6ff; + --border-light: rgba(123, 198, 255, 0.4); + + --primary: #7bc6ff; + --success: #00ffcc; + --danger: #ff3366; + --accent: #ffcc00; + + --text-main: #ffffff; + --text-muted: rgba(255, 255, 255, 0.6); } * { box-sizing: border-box; } -body { font-family: 'Inter', sans-serif; background: var(--bg-gradient); margin: 0; padding: 0; color: var(--text-main); min-height: 100vh; } +body { + font-family: 'Inter', sans-serif; + background-color: var(--bg-base); + background-image: + linear-gradient(var(--grid-color) 1px, transparent 1px), + linear-gradient(90deg, var(--grid-color) 1px, transparent 1px); + background-size: 20px 20px; + margin: 0; padding: 0; color: var(--text-main); min-height: 100vh; +} -#top-bar-container { position: sticky; top: 0; z-index: 100; padding: 15px 20px; display: flex; justify-content: center; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(10px); margin-bottom: 30px; } -#top-bar { background: var(--topbar-bg); padding: 12px 30px; display: flex; justify-content: space-between; align-items: center; border-radius: 12px; border: 1px solid var(--border-color); width: 100%; max-width: 1400px; box-shadow: 0 4px 15px rgba(0,0,0,0.3); } -.title-brand { font-size: 1.2rem; font-weight: 800; letter-spacing: 2px; color: var(--text-main); font-family: 'JetBrains Mono', monospace; } +/* TOP BAR */ +#top-bar-container { position: sticky; top: 0; z-index: 100; padding: 15px 20px; display: flex; justify-content: center; background: rgba(6, 36, 111, 0.8); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-main); margin-bottom: 30px; } +/* Modified #top-bar for specific alignment */ +#top-bar { padding: 12px 30px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border-main); width: 100%; max-width: 1400px; background: rgba(6, 36, 111, 0.5); } +.title-brand { font-size: 1.2rem; font-weight: 300; letter-spacing: 4px; color: var(--text-main); text-transform: uppercase; white-space: nowrap; flex-shrink: 0;} -.nav-tabs { display: flex; gap: 15px; margin-left: 30px; flex: 1; } -.nav-tab { background: transparent; border: none; color: var(--text-muted); font-size: 0.95rem; font-weight: 800; cursor: pointer; padding: 8px 16px; border-radius: 8px; transition: all 0.2s ease; font-family: 'Inter', sans-serif; letter-spacing: 1px; } -.nav-tab:hover { color: var(--text-main); background: rgba(255,255,255,0.05); } -.nav-tab.active { color: var(--primary); background: rgba(59, 130, 246, 0.1); } +.nav-tabs { display: flex; gap: 15px; margin-left: 30px; flex: 1; flex-wrap: wrap; justify-content: flex-start;} +.nav-tab { background: transparent; border: 1px solid transparent; color: var(--text-muted); font-size: 0.85rem; font-weight: 300; letter-spacing: 2px; cursor: pointer; padding: 6px 16px; transition: all 0.2s ease; text-transform: uppercase; white-space: nowrap;} +.nav-tab:hover { color: var(--text-main); border: 1px solid var(--border-light); } +.nav-tab.active { color: var(--text-main); border: 1px solid var(--border-main); } -.theme-switch { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; font-family: 'Inter', sans-serif; transition: all 0.2s; } -.theme-switch:hover { color: var(--text-main); border-color: var(--text-main); } +.theme-switch { background: transparent; border: 1px dashed var(--border-main); color: var(--text-main); padding: 6px 14px; cursor: pointer; font-weight: 300; font-size: 0.75rem; letter-spacing: 1px; transition: all 0.2s; text-transform: uppercase; white-space: nowrap;} +.theme-switch:hover { background: rgba(255,255,255,0.1); } + +/* Container for right side items (auth and other buttons) */ +.top-bar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0;} /* FILTRI E CONTROLLI VIEW */ -.filter-bar { background: var(--topbar-bg); border-radius: 12px; border: 1px solid var(--border-color); padding: 10px 20px; display: flex; gap: 15px; flex-wrap: wrap; align-items: center; justify-content: space-between; box-shadow: 0 4px 12px rgba(0,0,0,0.2); margin-bottom: 20px; } -.filter-pill { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; } -.filter-pill:hover { background: rgba(255,255,255,0.05); color: var(--text-main); } -.filter-pill.active { background: rgba(59, 130, 246, 0.15); color: var(--primary); border-color: var(--primary); } -.filter-pill.pill-warn { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); } -.filter-pill.pill-warn.active { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #f59e0b; } +.filter-bar { background: rgba(6, 36, 111, 0.6); border: 1px solid var(--border-main); padding: 10px 20px; display: flex; gap: 15px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 20px; } +.filter-pill { background: transparent; border: 1px dashed var(--border-light); color: var(--text-muted); padding: 6px 14px; font-size: 0.75rem; font-weight: 300; letter-spacing: 1px; cursor: pointer; transition: all 0.2s ease; text-transform: uppercase; font-family: 'JetBrains Mono', monospace; } +.filter-pill:hover { border-style: solid; border-color: var(--border-main); color: var(--text-main); } +.filter-pill.active { background: rgba(123, 198, 255, 0.15); color: var(--text-main); border: 1px solid var(--text-main); } +.filter-pill.pill-warn { color: var(--accent); border-color: rgba(255, 204, 0, 0.4); } +.filter-pill.pill-warn.active { background: rgba(255, 204, 0, 0.15); border: 1px solid var(--accent); color: var(--accent); } /* GRIGLIA E LISTA */ .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; max-width: 1400px; margin: 0 auto; padding: 0 20px; } @@ -45,108 +64,125 @@ body { font-family: 'Inter', sans-serif; background: var(--bg-gradient); margin: .list-view .node-meta { margin-bottom: 0; text-align: left; } .list-view .admin-dropdown { width: auto; flex: 0 0 auto; } -.card { background: var(--card-bg) !important; border-radius: 12px; padding: 20px; border: 1px solid var(--border-color); border-top: 3px solid var(--border-color) !important; display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important; filter: none !important; opacity: 1 !important; transition: all 0.3s ease; } +/* CARDS */ +.card { background: rgba(6, 36, 111, 0.6) !important; padding: 20px; border: 1px solid var(--border-main) !important; display: flex; flex-direction: column; transition: all 0.3s ease; backdrop-filter: blur(2px); box-shadow: none !important; border-radius: 0; } +.card:hover { border-color: #fff !important; } /* HEADER FISSO SU 2 RIGHE ALLINEATO A SINISTRA */ -.card-header { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px; } -.client-name { font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; line-height: 1.2; padding-top: 2px; } +.card-header { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 8px; margin-bottom: 15px; border-bottom: 1px dashed var(--border-main); padding-bottom: 12px; } +.client-name { font-size: 1.6rem; font-weight: 300; letter-spacing: -1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; line-height: 1.2; padding-top: 2px; } .header-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-start; width: 100%; } -.badge-id { font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; background: rgba(0,0,0,0.3); padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-color); color: var(--text-muted); } +.badge-id { font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; background: transparent; padding: 0; border: none; color: var(--border-main); } +.type-badge { font-size: 0.65rem; padding: 2px 6px; border: 1px solid var(--primary); background: transparent; color: var(--primary); font-weight: 400; text-transform: uppercase; display: inline-block; vertical-align: middle; } -.health-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.75rem; font-weight: 600; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px solid var(--border-color); font-family: 'JetBrains Mono', monospace; text-align: center; } -.health-bar > span { background: rgba(255,255,255,0.03); padding: 6px; border-radius: 6px; } +/* DATI STRUTTURALI */ +.health-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.75rem; font-weight: 300; background: transparent; padding: 10px; margin-bottom: 15px; border: 1px solid var(--border-light); font-family: 'JetBrains Mono', monospace; text-align: left; } +.health-bar > span { background: transparent; padding: 4px; border: 1px dashed rgba(255,255,255,0.1); } -.freq-bar { display: flex; justify-content: space-around; font-size: 0.8rem; font-weight: 800; background: rgba(0,0,0,0.2); padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; border: 1px dashed var(--border-color); font-family: 'JetBrains Mono', monospace; } -.freq-tx { color: #f87171; } .freq-rx { color: #4ade80; } +.freq-bar { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 400; background: transparent; padding: 8px 10px; margin-bottom: 10px; border: 1px dashed var(--border-light); font-family: 'JetBrains Mono', monospace; } +.freq-tx { color: var(--danger); } .freq-rx { color: var(--success); } -.seen-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin: -6px 0 12px 0; } -.seen-item b { font-weight: 700; } +.seen-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.7rem; font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin: -6px 0 12px 0; text-transform: uppercase; } +.seen-item b { font-weight: 400; } .seen-item.ok b { color: var(--success); } -.seen-item.warn, .seen-item.warn b { color: #f59e0b; font-weight: 700; } +.seen-item.warn, .seen-item.warn b { color: var(--accent); font-weight: 400; } -.node-meta { font-size: 0.75rem; color: #8b949e; text-align: center; margin-bottom: 10px; line-height: 1.4; } +.node-meta { font-size: 0.75rem; color: var(--border-main); text-align: left; margin-bottom: 10px; line-height: 1.4; font-family: 'JetBrains Mono', monospace; } .node-meta-item { display: block; } -.type-badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 6px; font-weight: 700; text-transform: uppercase; display: inline-block; margin-left: 0; vertical-align: middle; } -.type-repeater { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid var(--primary); } -.type-hotspot { background: rgba(139, 92, 246, 0.15); color: var(--accent); border: 1px solid var(--accent); } +.status-display { text-align: center; font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 300; letter-spacing: 2px; padding: 8px; background: transparent; border: 1px solid var(--border-light); margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; transition: all 0.3s ease;} +.card.online .status-display { color: var(--success); border-color: var(--success); } +.status-offline { color: var(--danger) !important; border-color: var(--danger) !important; } -.status-display { text-align: center; font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700; padding: 8px; border-radius: 6px; background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); margin-bottom: 10px; color: var(--text-muted); } -.card.online .status-display { color: var(--success); border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1); } -.status-offline { color: var(--danger) !important; border-color: rgba(239, 68, 68, 0.4) !important; } - -.gateway-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; justify-content: center; } +.gateway-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; justify-content: flex-start; min-height: 20px;} .ts-container { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; } -.dmr-info { font-size: 0.85rem; font-weight: 600; font-family: 'JetBrains Mono', monospace; padding: 8px 12px; border-radius: 6px; background: rgba(0,0,0,0.2) !important; border: 1px solid var(--border-color); border-left: 4px solid var(--border-color) !important; color: var(--text-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all 0.3s; } +.dmr-info { font-size: 0.85rem; font-weight: 400; font-family: 'JetBrains Mono', monospace; padding: 8px 12px; background: transparent !important; border: 1px solid var(--border-light); color: var(--text-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all 0.3s; text-align: left; } -.terminal-log { background: #010409; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; border-radius: 6px; padding: 10px; max-height: 90px; overflow-y: auto; border: 1px solid var(--border-color); line-height: 1.4; margin-bottom: 15px; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; } +.terminal-log { background: rgba(0,0,0,0.3); color: var(--border-main); font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; padding: 10px; max-height: 90px; overflow-y: auto; border: 1px dashed var(--border-light); line-height: 1.4; margin-bottom: 15px; scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; } .actions { display: none; gap: 8px; flex-wrap: wrap; margin-top: auto; } -.btn-cmd { flex: 1; padding: 8px 10px; border: 1px solid transparent; background: rgba(255,255,255,0.05) !important; border-radius: 6px; font-weight: 600; font-size: 0.75rem; cursor: pointer; color: var(--text-main) !important; font-family: 'Inter', sans-serif; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; gap: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important; } -.btn-cmd:hover { filter: brightness(1.2); } +.btn-cmd { flex: 1; padding: 8px 10px; background: transparent !important; border: 1px solid var(--border-main); color: var(--text-main) !important; font-weight: 300; font-size: 0.75rem; cursor: pointer; font-family: 'Inter', sans-serif; letter-spacing: 1px; transition: all 0.2s ease; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;} +.btn-cmd:hover { background: rgba(255,255,255,0.1) !important; border-color: #fff; } -details.admin-dropdown summary { list-style: none; display: flex; justify-content: center; align-items: center; } +details.admin-dropdown summary { list-style: none; display: flex; justify-content: center; align-items: center; border: 1px dashed var(--border-main) !important; } details.admin-dropdown summary::-webkit-details-marker { display: none; } -.mqtt-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; transition: all 0.3s ease; border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; height: 30px;} -.mqtt-online { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: var(--success); } -.mqtt-offline { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: var(--danger); animation: danger-glow 2s infinite; } +.mqtt-badge { padding: 4px 10px; font-size: 0.75rem; font-weight: 400; font-family: 'JetBrains Mono', monospace; transition: all 0.3s ease; border: 1px solid var(--border-main); display: flex; align-items: center; justify-content: center; height: 30px; white-space: nowrap;} +.mqtt-online { background: transparent; color: var(--success); border-color: var(--success); } +.mqtt-offline { background: transparent; color: var(--danger); border-color: var(--danger); animation: danger-glow 2s infinite; } -.table-container { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color); overflow-x: auto; overflow-y: auto; max-height: 500px; margin: 0 20px 40px 20px; -webkit-overflow-scrolling: touch; box-shadow: 0 4px 12px rgba(0,0,0,0.2); } -thead th { position: sticky; top: 0; z-index: 10; background: #0f172a; border-bottom: 2px solid var(--primary); } +.table-container { background: rgba(6, 36, 111, 0.6); border: 1px solid var(--border-main); overflow-x: auto; overflow-y: auto; max-height: 500px; margin: 0 20px 40px 20px; -webkit-overflow-scrolling: touch; } +thead th { position: sticky; top: 0; z-index: 10; background: var(--bg-base); border-bottom: 1px dashed var(--border-main); font-weight: 400; letter-spacing: 1px; color: var(--border-main); } table { width: 100%; min-width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; font-family: 'Inter', sans-serif; white-space: nowrap; } -th, td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); line-height: 1.6; vertical-align: middle; } -th { background-color: rgba(255, 255, 255, 0.02); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.75rem; color: var(--text-muted); } -tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.015); } +th, td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); line-height: 1.6; vertical-align: middle; } +th { text-transform: uppercase; font-size: 0.75rem; } +tbody tr:hover { background-color: rgba(123, 198, 255, 0.1); } -@keyframes soft-glow { 0% { box-shadow: 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } 50% { box-shadow: 0 0 15px var(--pulse-color, var(--primary)); border-color: var(--pulse-color, var(--primary)); } 100% { box-shadow: 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } } -.tx-active-unified { animation: soft-glow 2s infinite !important; color: var(--text-main) !important; background: rgba(0,0,0,0.3) !important; border-left: 4px solid var(--pulse-color, var(--primary)) !important; } +@keyframes soft-glow { 0% { box-shadow: inset 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } 50% { box-shadow: inset 0 0 15px var(--pulse-color, var(--primary)); border-color: var(--pulse-color, var(--primary)); } 100% { box-shadow: inset 0 0 5px var(--pulse-color, var(--primary)); border-color: var(--border-color); } } +.tx-active-unified { animation: soft-glow 2s infinite !important; color: var(--text-main) !important; background: rgba(0,0,0,0.3) !important; border: 1px solid var(--pulse-color, var(--primary)) !important; } -@keyframes danger-glow { 0% { box-shadow: 0 0 5px var(--danger); border-color: var(--border-color); } 50% { box-shadow: 0 0 15px var(--danger); border-color: var(--danger); } 100% { box-shadow: 0 0 5px var(--danger); border-color: var(--border-color); } } +@keyframes danger-glow { 0% { box-shadow: inset 0 0 5px var(--danger); border-color: var(--border-light); } 50% { box-shadow: inset 0 0 15px var(--danger); border-color: var(--danger); } 100% { box-shadow: inset 0 0 5px var(--danger); border-color: var(--border-light); } } .blink { animation: danger-glow 1.5s infinite; color: var(--danger) !important; border: 1px solid var(--danger) !important; } -.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(15, 23, 42, 0.9); z-index:1000; align-items:center; justify-content:center; backdrop-filter: blur(5px); } +.modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(6, 36, 111, 0.85); z-index:1000; align-items:center; justify-content:center; backdrop-filter: blur(8px); } .modal-top { z-index: 5000 !important; } -.modal-content { background:var(--card-bg); border:1px solid var(--border-color); padding:25px; border-radius:12px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.5); } +/* FONDAMENTALE: width: 90% in modo che prenda lo spazio massimo e spinga gli elementi allineati a dx verso il bordo */ +.modal-content { background: var(--bg-base); border: 1px solid var(--border-main); padding: 25px; max-height: 90vh; overflow-y: auto; width: 90%; } -.auth-btn { background: rgba(255,255,255,0.05); color: var(--text-main); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.8rem; font-family: 'Inter', sans-serif; transition: all 0.2s; } -.auth-btn:hover { border-color: var(--text-main); background: rgba(255,255,255,0.1); } -input, select { background: rgba(0,0,0,0.2); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 12px; border-radius: 6px; font-family: 'Inter', sans-serif; outline: none; } -input:focus, select:focus { border-color: var(--primary); } +.auth-btn { background: transparent; color: var(--text-main); border: 1px solid var(--border-main); padding: 6px 12px; font-weight: 300; cursor: pointer; font-size: 0.8rem; font-family: 'Inter', sans-serif; transition: all 0.2s; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap;} +.auth-btn:hover { background: rgba(255,255,255,0.1); border-color: #fff; } +input, select { background: transparent; border: 1px dashed var(--border-main); color: var(--text-main); padding: 8px 12px; font-family: 'JetBrains Mono', monospace; outline: none; } +input:focus, select:focus { border-color: #fff; border-style: solid; } input:disabled { opacity: 0.5; cursor: not-allowed; } -option { background: var(--card-bg); color: var(--text-main); } +option { background: var(--bg-base); color: var(--text-main); } -.mini-card { background: var(--card-bg); border-radius: 10px; border: 1px solid var(--border-color); padding: 15px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); height: 105px; width: 160px; overflow: hidden; } -.mini-card:hover { transform: translateY(-4px); box-shadow: 0 8px 15px rgba(0,0,0,0.3); } +.mini-card { background: rgba(6, 36, 111, 0.6); border: 1px solid var(--border-main); padding: 15px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; transition: all 0.2s ease; cursor: pointer; height: 105px; width: 160px; overflow: hidden; backdrop-filter: blur(2px); } +.mini-card:hover { background: rgba(123, 198, 255, 0.15); border-color: #fff; } .mini-card-content { width: 100%; overflow: hidden; } -.mini-card-name { font-weight: 800; font-size: 0.95rem; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.mini-card-status { font-size: 0.65rem; font-weight: 800; padding: 4px 6px; border-radius: 6px; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.mini-card-name { font-weight: 300; font-size: 1.1rem; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.5px; } +.mini-card-status { font-size: 0.65rem; font-weight: 400; padding: 4px; border: 1px dashed var(--border-light); width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 1px; margin-top: 5px; transition: all 0.3s ease;} /* --- STILI FLEET MAP & DIAGNOSTICA --- */ -#map-container { max-width: 1400px; height: calc(100vh - 200px); min-height: 550px; margin: 0 auto; border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 8px 25px rgba(0,0,0,0.4); } -.dark-tiles { filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7); } -.custom-map-pin { display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid white; font-size: 1rem; color: white; box-shadow: 0 0 10px rgba(0,0,0,0.5); transition: all 0.3s ease; } -.pin-online { background: var(--success); border-color: rgba(255,255,255,0.8); } -.pin-offline { background: #64748b; border-color: rgba(255,255,255,0.3); opacity: 0.7; } -.pin-warn { background: #f59e0b !important; border-color: #fbbf24 !important; animation: danger-glow 2s infinite !important; } -.pin-tx { background: var(--primary) !important; animation: soft-glow 1.5s infinite !important; transform: scale(1.15); } -.leaflet-popup-content-wrapper { background: var(--card-bg) !important; color: var(--text-main) !important; border-radius: 10px !important; border: 1px solid var(--border-color) !important; box-shadow: 0 6px 20px rgba(0,0,0,0.6) !important; } -.leaflet-popup-tip { background: var(--card-bg) !important; } +#map-container { max-width: 1400px; height: calc(100vh - 200px); min-height: 550px; margin: 0 auto; border: 1px solid var(--border-main); overflow: hidden; } +/* Filtro CAD per la mappa */ +.dark-tiles { filter: invert(1) sepia(1) hue-rotate(180deg) saturate(3) brightness(0.8) contrast(1.2); } +.custom-map-pin { display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid white; font-size: 0.9rem; background: transparent; backdrop-filter: blur(2px); font-family: 'JetBrains Mono', monospace; font-weight: normal; transition: all 0.3s ease;} +.pin-online { border-color: var(--success); color: var(--success); } +.pin-offline { border-color: var(--text-muted); color: var(--text-muted); border-style: dashed; } +.pin-warn { border-color: var(--accent) !important; color: var(--accent) !important; } +.pin-tx { border-color: var(--primary) !important; color: var(--primary) !important; box-shadow: inset 0 0 8px var(--primary); border-width: 2px; } +.leaflet-popup-content-wrapper { background: var(--bg-base) !important; color: var(--text-main) !important; border-radius: 0 !important; border: 1px solid var(--border-main) !important; box-shadow: none !important; } +.leaflet-popup-tip { background: var(--border-main) !important; } + +/* Responsive rules */ +@media (max-width: 1200px) { + #top-bar { flex-direction: column; align-items: stretch;} + .title-brand { text-align: center; margin-bottom: 10px;} + .nav-tabs { justify-content: center; margin-left: 0; margin-bottom: 10px;} + .top-bar-right { justify-content: center;} +} @media (max-width: 768px) { - #top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; } - #top-bar { flex-direction: column; padding: 15px; gap: 12px; border-radius: 12px; } + #top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border-main); } + #top-bar { padding: 15px; gap: 12px; } .title-brand { font-size: 1.1rem; text-align: center; width: 100%; } - #top-bar > div { width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px !important; } - #auth-container { width: 100%; justify-content: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border-color); } + .top-bar-right { width: 100%; flex-wrap: wrap; justify-content: center; gap: 8px !important; } + #auth-container { width: 100%; justify-content: center; flex-wrap: wrap; padding-top: 12px; border-top: 1px dashed var(--border-main); margin-top: 5px;} #auth-container > span { width: 100%; text-align: center; margin-bottom: 8px; font-family: 'Inter', sans-serif; } .auth-btn, .theme-switch { flex: 1 1 auto; text-align: center; } - .nav-tabs { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--topbar-bg); border-top: 1px solid var(--border-color); margin: 0; padding: 10px 0; justify-content: space-around; z-index: 1000; flex-direction: row; gap: 0; padding-bottom: env(safe-area-inset-bottom, 10px); box-shadow: 0 -4px 15px rgba(0,0,0,0.3); } - .nav-tab { font-size: 0.95rem; padding: 10px; flex: 1; text-align: center; border-radius: 0; } + .nav-tabs { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-base); border-top: 1px solid var(--border-main); margin: 0; padding: 10px 0; justify-content: space-around; z-index: 1000; flex-direction: row; gap: 0; padding-bottom: env(safe-area-inset-bottom, 10px); } + .nav-tab { font-size: 0.85rem; padding: 10px; flex: 1; text-align: center; } body { padding-bottom: 70px; } - .filter-bar { flex-direction: column; } - .list-view .card { flex-direction: column; align-items: stretch; } - #map-container { height: calc(100vh - 220px); min-height: 400px; margin: 0 10px; } + .filter-bar { flex-direction: column; clip-path: none; border: 1px solid var(--border-light); margin-bottom: 10px;} + .list-view .card { flex-direction: column; align-items: stretch; clip-path: none;} + #map-container { height: calc(100vh - 220px); min-height: 400px; margin: 0 10px; clip-path: none;} + + .table-container { clip-path: none; border: 1px solid var(--border-light); margin: 0 10px 20px 10px; } + .table-container table, .table-container thead, .table-container tbody, .table-container th, .table-container td, .table-container tr { display: block; width: 100%; } + .table-container thead tr { position: absolute; top: -9999px; left: -9999px; } + .table-container tr { border-bottom: 2px dashed var(--border-light); margin-bottom: 15px; background: var(--bg-base); padding: 10px; } + .table-container td { border: none; position: relative; padding-left: 40%; text-align: left; min-height: 30px; display: flex; align-items: center; } + .table-container td:before { position: absolute; top: 50%; transform: translateY(-50%); left: 10px; width: 35%; padding-right: 10px; font-weight: 800; color: var(--accent); content: attr(data-label); font-size: 0.75rem; } } diff --git a/static/js/app.js b/static/js/app.js index 9ed1be2..046c90c 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -71,10 +71,10 @@ function applyViewMode() { const btnToggle = document.getElementById('view-toggle-btn'); if (viewMode === 'list') { gridDiv.className = 'list-view'; - btnToggle.innerText = '๐Ÿ“„ LIST'; + btnToggle.innerText = '[ LIST ]'; } else { gridDiv.className = 'grid'; - btnToggle.innerText = '๐Ÿ”ฒ GRID'; + btnToggle.innerText = '[ GRID ]'; } } @@ -119,7 +119,7 @@ function fmtAge(sec) { function seenItem(label, age, tip, warn) { const cls = warn ? 'warn' : (age !== undefined && age < 300 ? 'ok' : 'idle'); const txt = age === undefined ? 'โ€”' : fmtAge(age); - return `${warn ? 'โš  ' : ''}${label} ${txt}`; + return `${warn ? '[!] ' : ''}${label} ${txt}`; } function renderSeen(c, data, isOnline) { @@ -131,23 +131,17 @@ function renderSeen(c, data, isOnline) { let html = ''; const warnM = ages.mmdvm === undefined && isOnline && upSec > 600; - const tipM = it ? `Ultimo evento dal topic mmdvm/${c.id}/json (TX, cambio modo...). Su un nodo tranquillo puรฒ passare molto tempo.` - : `Last event from topic mmdvm/${c.id}/json (TX, mode change...). It can be a long time on a quiet node.`; - const tipMW = it ? `Nessun evento MMDVM ricevuto da quando il server รจ attivo (${fmtAge(upSec)}): controlla che MMDVMHost sia connesso al broker.` - : `No MMDVM event received since the server started (${fmtAge(upSec)}): check that MMDVMHost is connected to the broker.`; - html += seenItem('MMDVM', ages.mmdvm, warnM ? tipMW : tipM, warnM); + const tipM = it ? `Topic mmdvm/${c.id}/json` : `Topic mmdvm/${c.id}/json`; + html += seenItem('MMDVM', ages.mmdvm, tipM, warnM); if (ages.gateway !== undefined) { - html += seenItem('GW', ages.gateway, it ? 'Ultimo evento dai gateway (DMR/NXDN/YSF/P25/D-Star)' : 'Last event from the gateways (DMR/NXDN/YSF/P25/D-Star)', false); + html += seenItem('GW', ages.gateway, 'Gateway Events', false); } const hObj = (data.health && data.health[c.id.toLowerCase()]) || {}; const iv = Number(hObj.interval) > 0 ? Number(hObj.interval) : 60; const warnA = isOnline && (ages.health === undefined ? upSec > Math.max(300, iv * 5) : ages.health > Math.max(180, iv * 3)); - const tipA = warnA - ? (it ? 'L\'agent del nodo non invia piรน lo stato (devices//services): connessione bloccata?' : 'The node agent stopped sending its status (devices//services): stuck connection?') - : (it ? 'Ultimo stato ricevuto dall\'agent del nodo (devices//services)' : 'Last status received from the node agent (devices//services)'); - html += seenItem('AGENT', ages.health, tipA, warnA); + html += seenItem('AGENT', ages.health, 'Agent Status', warnA); div.innerHTML = html; div.style.display = 'flex'; @@ -169,16 +163,16 @@ function sendCommand(clientId, type, customTitle, customMsg, customColor) { function confirmSwitch(id, mode) { const data = globalHealthData[id.toLowerCase()]; - let profileName = mode === 'A' ? "PROFILE A" : "PROFILE B"; + let profileName = mode === 'A' ? "PROF A" : "PROF B"; if (data && data.profiles && data.profiles[mode]) profileName = data.profiles[mode]; const title = `๐Ÿ”„ ${t('titleSwitch')}`; const msg = `${t('confSwitch')} ${esc(profileName)} -> ${id.toUpperCase()}?`; - const color = mode === 'A' ? "var(--accent)" : "#eab308"; + const color = mode === 'A' ? "var(--accent)" : "var(--primary)"; sendCommand(id, mode, title, msg, color); } function confirmReboot(id) { sendCommand(id, 'REBOOT', `๐Ÿ”„ ${t('titleBoot')}`, `${t('confBoot')}${id.toUpperCase()}?`, "var(--danger)"); } -function confirmUpdateAgent(id) { sendCommand(id, 'UPDATE_AGENT', `โฌ‡๏ธ UPDATE OTA`, `Confermi l'aggiornamento dello script tramite git pull sul nodo ${id.toUpperCase()}?`, "#2563eb"); } +function confirmUpdateAgent(id) { sendCommand(id, 'UPDATE_AGENT', `โฌ‡๏ธ UPDATE OTA`, `Confermi l'aggiornamento dello script tramite git pull sul nodo ${id.toUpperCase()}?`, "var(--primary)"); } function sendTgCommand(clientId, comando) { const msg = (comando === 'TG:ON') ? t('confTgOn') : t('confTgOff'); @@ -204,7 +198,7 @@ async function initUI() { const statSelect = document.getElementById('stat-node-filter'); if (statSelect) { - let opts = ``; + let opts = ``; clients.forEach(c => { opts += ``; }); statSelect.innerHTML = opts; } @@ -212,7 +206,6 @@ async function initUI() { const limitSel = document.getElementById('log-limit-select'); if (limitSel) { limitSel.value = localStorage.getItem('fleetLogLimit') || '60'; - } const grid = document.getElementById('client-grid'); const authContainer = document.getElementById('auth-container'); @@ -221,17 +214,17 @@ async function initUI() { if (isAuthenticated) { let adminBtn = role === 'admin' ? ` - - - - ` : ''; + + + + ` : ''; authContainer.innerHTML = `${adminBtn} - ๐Ÿ‘ค ${esc(String(me.user).toUpperCase())} - - `; + USR: ${esc(String(me.user).toUpperCase())} + + `; } else { - authContainer.innerHTML = ``; + authContainer.innerHTML = ``; } grid.innerHTML = clients.map(c => { @@ -243,8 +236,8 @@ async function initUI() {
${esc(c.name)}
- ID: ${c.id.toUpperCase()} - + NET-ID: ${c.id.toUpperCase()} +
@@ -252,57 +245,57 @@ async function initUI() {
-
Offline
+
OFFLINE
- +
TS1: ...
TS2: ...
- +
${t('waitNet')}
- -
OFFLINE
+
OFFLINE
`).join(''); } @@ -343,7 +336,7 @@ function initOrUpdateMap() { if (!fleetMap) { fleetMap = L.map('map-container').setView([46.06, 13.23], 9); L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap France | © OpenStreetMap', + attribution: '© OpenStreetMap France', maxZoom: 19, className: 'dark-tiles' }).addTo(fleetMap); @@ -373,33 +366,33 @@ function initOrUpdateMap() { let pinClass = isOnline ? (warns.length > 0 ? 'pin-warn' : 'pin-online') : 'pin-offline'; if (isTx) pinClass += ' pin-tx'; - let iconSymbol = (gen && gen.duplex === "0") ? "๐Ÿ“ป" : "๐Ÿ“ก"; - if (warns.length > 0 && !isTx) iconSymbol = "โš ๏ธ"; + let iconSymbol = "+"; + if (warns.length > 0 && !isTx) iconSymbol = "!"; const customIcon = L.divIcon({ className: 'custom-div-icon', - html: `
${iconSymbol}
`, - iconSize: [32, 32], - iconAnchor: [16, 16] + html: `
${iconSymbol}
`, + iconSize: [24, 24], + iconAnchor: [12, 12] }); const call = (gen && gen.callsign) ? gen.callsign : c.name; const warnsHtml = warns.length > 0 ? ` -
+
${warns.map(w => esc(w)).join('
')}
` : ''; const popupContent = ` -
-
${esc(call)}
-
ID: ${c.id.toUpperCase()} | ${isOnline ? 'ONLINE' : 'OFFLINE'}
+
+
${esc(call)}
+
ID: ${c.id.toUpperCase()} | ${isOnline ? 'ONLINE' : 'OFFLINE'}
${warnsHtml} -
๐Ÿ“ ${esc(info.loc)}
-
TX: ${esc(info.tx)}
-
RX: ${esc(info.rx)}
- ${health ? `
๐ŸŒก๏ธ Temp: ${health.temp}ยฐC | CPU: ${health.cpu}%
` : ''} - +
LOC: ${esc(info.loc)}
+
TX: ${esc(info.tx)}
+
RX: ${esc(info.rx)}
+ ${health ? `
TMP: ${health.temp}ยฐC | CPU: ${health.cpu}%
` : ''} +
`; @@ -442,7 +435,7 @@ async function refreshStates() { if (diagDiv) { if (warns.length > 0 && isOnline) { diagDiv.style.display = 'block'; - diagDiv.innerHTML = warns.map(w => `
${esc(w)}
`).join(''); + diagDiv.innerHTML = warns.map(w => `
[!] ${esc(w)}
`).join(''); } else { diagDiv.style.display = 'none'; diagDiv.innerHTML = ''; @@ -455,19 +448,16 @@ async function refreshStates() { const typeBadge = document.getElementById(`type-badge-${c.id}`); if (genObj && isOnline) { - nameSpan.innerText = genObj.callsign; - idBadge.innerText = `ID: ${genObj.radio_id}`; - idBadge.style.background = "var(--primary)"; idBadge.style.color = "#ffffff"; idBadge.style.borderColor = "var(--primary)"; - + nameSpan.innerHTML = `${esc(genObj.callsign)}`; + idBadge.innerText = `NET-ID: ${genObj.radio_id}`; if (typeBadge && genObj.duplex !== undefined) { typeBadge.style.display = 'inline-block'; - if (genObj.duplex === "1") { typeBadge.innerText = "REPEATER"; typeBadge.className = "type-badge type-repeater"; } - else { typeBadge.innerText = "HOTSPOT"; typeBadge.className = "type-badge type-hotspot"; } + if (genObj.duplex === "1") { typeBadge.innerText = "RPT"; typeBadge.className = "type-badge type-repeater"; } + else { typeBadge.innerText = "HST"; typeBadge.className = "type-badge type-hotspot"; } } } else { - nameSpan.innerText = c.name; - idBadge.innerText = `ID: ${c.id.toUpperCase()}`; - idBadge.style.background = "rgba(255,255,255,0.1)"; idBadge.style.color = "var(--text-muted)"; idBadge.style.borderColor = "var(--border-color)"; + nameSpan.innerHTML = `${esc(c.name)}`; + idBadge.innerText = `NET-ID: ${c.id.toUpperCase()}`; if (typeBadge) typeBadge.style.display = 'none'; } @@ -475,18 +465,16 @@ async function refreshStates() { if (typeof telemetryObj === 'string') telemetryObj = { ts1: telemetryObj, ts2: "...", alt: "", idle: true }; const tsContainer = document.getElementById(`ts-container-${c.id}`); const ts1Div = document.getElementById(`dmr-ts1-${c.id}`); const ts2Div = document.getElementById(`dmr-ts2-${c.id}`); const altDiv = document.getElementById(`dmr-alt-${c.id}`); - let isTx = false; let activeModeColor = "var(--success)"; let isIdle = telemetryObj.idle === true; if (telemetryObj.alt && telemetryObj.alt !== "") { if (tsContainer) tsContainer.style.display = "none"; if (altDiv) { altDiv.style.display = "block"; altDiv.innerText = telemetryObj.alt; let altText = telemetryObj.alt.toUpperCase(); - - if (altText.includes("NXDN")) activeModeColor = "#10b981"; else if (altText.includes("YSF")) activeModeColor = "#8b5cf6"; else if (altText.includes("D-STAR")) activeModeColor = "#06b6d4"; else if (altText.includes("P25")) activeModeColor = "#f59e0b"; + if (altText.includes("NXDN")) activeModeColor = "var(--success)"; else if (altText.includes("YSF")) activeModeColor = "var(--primary)"; else if (altText.includes("D-STAR")) activeModeColor = "var(--primary)"; else if (altText.includes("P25")) activeModeColor = "var(--accent)"; isTx = altText.includes("๐ŸŸข") || altText.includes("๐ŸŸฃ") || altText.includes("๐Ÿ”ต") || altText.includes("๐ŸŸ "); - altDiv.style.setProperty('--pulse-color', activeModeColor); - if (isTx) { altDiv.classList.add('tx-active-unified'); } else { altDiv.classList.remove('tx-active-unified'); altDiv.style.setProperty('color', 'var(--text-muted)', 'important'); altDiv.style.setProperty('border-left', `4px solid var(--border-color)`, 'important'); } + if (isTx) { altDiv.style.color = activeModeColor; altDiv.style.borderColor = activeModeColor; } + else { altDiv.style.color = "var(--text-muted)"; altDiv.style.borderColor = "var(--border-light)"; } } } else { if (altDiv) altDiv.style.display = "none"; @@ -498,11 +486,9 @@ async function refreshStates() { [ts1Div, ts2Div].forEach((div, idx) => { if (isSimplex && idx === 0) return; const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? ''); - const fullLabel = `TS${idx + 1}`; - div.innerText = `${fullLabel}: ${val}`; - div.style.setProperty('--pulse-color', activeModeColor); - if (val.includes("๐ŸŽ™๏ธ")) { isTx = true; div.classList.add('tx-active-unified'); } - else { div.classList.remove('tx-active-unified'); div.style.setProperty('color', 'var(--text-muted)', 'important'); div.style.setProperty('border-left', '4px solid var(--border-color)', 'important'); } + div.innerText = `TS${idx + 1}: ${val}`; + if (val.includes("๐ŸŽ™๏ธ") || val.includes("TX")) { isTx = true; div.style.color = activeModeColor; div.style.borderColor = activeModeColor; } + else { div.style.color = "var(--text-muted)"; div.style.borderColor = "var(--border-light)"; } }); } } @@ -530,90 +516,39 @@ async function refreshStates() { } const healthContainer = document.getElementById(`health-${c.id}`); const cpuSpan = document.getElementById(`cpu-${c.id}`); const tempSpan = document.getElementById(`temp-${c.id}`); const ramSpan = document.getElementById(`ram-${c.id}`); const diskSpan = document.getElementById(`disk-${c.id}`); - const gwBar = document.getElementById(`gw-bar-${c.id}`); if (gwBar && healthObj) { - let gwHtml = ""; - let gwData = data.gateway_states && data.gateway_states[c.id.toLowerCase()] ? data.gateway_states[c.id.toLowerCase()] : {}; - let processes = healthObj.processes || {}; - let activeGatewaysStr = ""; - - const gwMap = [ - { id: 'dmrgateway', label: 'DMR', color: '#3b82f6', tint: 'rgba(59, 130, 246, 0.15)', proto: 'DMR' }, - { id: 'ysfgateway', label: 'YSF', color: '#8b5cf6', tint: 'rgba(139, 92, 246, 0.15)', proto: 'YSF' }, - { id: 'dstargateway', label: 'D-STAR', color: '#06b6d4', tint: 'rgba(6, 182, 212, 0.15)', proto: 'D-STAR' }, - { id: 'nxdngateway', label: 'NXDN', color: '#10b981', tint: 'rgba(16, 185, 129, 0.15)', proto: 'NXDN' }, - { id: 'p25gateway', label: 'P25', color: '#f59e0b', tint: 'rgba(245, 158, 11, 0.15)', proto: 'P25' } - ]; + let gwHtml = ""; let gwData = data.gateway_states && data.gateway_states[c.id.toLowerCase()] ? data.gateway_states[c.id.toLowerCase()] : {}; let processes = healthObj.processes || {}; let activeGatewaysStr = ""; + const gwMap = [{ id: 'dmrgateway', label: 'DMR', color: 'var(--primary)', proto: 'DMR' }, { id: 'ysfgateway', label: 'YSF', color: '#8b5cf6', proto: 'YSF' }, { id: 'dstargateway', label: 'D-STAR', color: 'var(--primary)', proto: 'D-STAR' }, { id: 'nxdngateway', label: 'NXDN', color: 'var(--success)', proto: 'NXDN' }, { id: 'p25gateway', label: 'P25', color: 'var(--accent)', proto: 'P25' }]; if (isOnline) { gwMap.forEach(gw => { let isActiveProc = processes[gw.id] && processes[gw.id].toLowerCase() === 'online'; if (isActiveProc) { activeGatewaysStr += gw.proto.toLowerCase() + ","; - let stateInfo = gwData[gw.proto] || { action: 'IDLE', dest: '---' }; - let action = (stateInfo.action || 'IDLE').toLowerCase(); - let dest = stateInfo.dest && stateInfo.dest !== '---' && stateInfo.dest.toUpperCase() !== 'IDLE' ? stateInfo.dest : ''; + let stateInfo = gwData[gw.proto] || { action: 'IDLE', dest: '---' }; let action = (stateInfo.action || 'IDLE').toLowerCase(); let dest = stateInfo.dest && stateInfo.dest !== '---' && stateInfo.dest.toUpperCase() !== 'IDLE' ? stateInfo.dest : ''; + let badgeColor, badgeBorder, suffix = ''; - let badgeBg, badgeColor, badgeBorder, suffix = '', extraClass = ''; - - if (action === 'linking') { - badgeBg = gw.color; - badgeColor = 'white'; - badgeBorder = gw.color; - suffix = dest ? `: ${dest} [LINKING]` : ` [LINKING]`; - } else if (action === 'linked' || (dest !== '' && action !== 'unlinked' && action !== 'failed' && action !== 'status')) { - badgeBg = gw.color; - badgeColor = 'white'; - badgeBorder = gw.color; - if (dest) suffix = `: ${dest}`; - } else if (action === 'failed') { - badgeBg = 'rgba(239, 68, 68, 0.25)'; - badgeColor = '#fca5a5'; - badgeBorder = 'var(--danger)'; - suffix = ' [FAILED]'; - extraClass = 'blink'; - } else if (action === 'unlinked') { - badgeBg = 'transparent'; - badgeColor = 'var(--text-muted)'; - badgeBorder = 'var(--border-color)'; - suffix = ' [UNLINKED]'; - } else { - badgeBg = gw.tint; - badgeColor = gw.color; - badgeBorder = gw.color; - } + if (action === 'linking') { badgeColor = gw.color; badgeBorder = gw.color; suffix = dest ? `: ${dest} [LNK]` : ` [LNK]`; } + else if (action === 'linked' || (dest !== '' && action !== 'unlinked' && action !== 'failed' && action !== 'status')) { badgeColor = '#fff'; badgeBorder = gw.color; if (dest) suffix = `:${dest}`; } + else if (action === 'failed') { badgeColor = 'var(--danger)'; badgeBorder = 'var(--danger)'; suffix = ' [ERR]'; } + else if (action === 'unlinked') { badgeColor = 'var(--text-muted)'; badgeBorder = 'var(--border-light)'; suffix = ' [UNL]'; } + else { badgeColor = gw.color; badgeBorder = gw.color; } if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) { - gwData['DMR_NETS'].forEach(netName => { - let netSuffix = (action === 'linking') ? ' [LINKING]' : (action === 'failed' ? ' [FAILED]' : (dest && action !== 'status' ? `: ${dest}` : '')); - let netText = `DMR: ${esc(netName)}${esc(netSuffix)}`; - gwHtml += `${netText}`; - }); - } else { - let text = `${gw.label}${esc(suffix)}`; - gwHtml += `${text}`; - } + gwData['DMR_NETS'].forEach(netName => { let netSuffix = (action === 'linking') ? ' [LNK]' : (action === 'failed' ? ' [ERR]' : (dest && action !== 'status' ? `:${dest}` : '')); gwHtml += `DMR:${esc(netName)}${esc(netSuffix)}`; }); + } else { gwHtml += `${gw.label}${esc(suffix)}`; } } }); } - cardDiv.dataset.gateways = activeGatewaysStr; - gwBar.innerHTML = gwHtml; - } else if (gwBar) { - gwBar.innerHTML = ""; - cardDiv.dataset.gateways = ""; - } + cardDiv.dataset.gateways = activeGatewaysStr; gwBar.innerHTML = gwHtml; + } else if (gwBar) { gwBar.innerHTML = ""; cardDiv.dataset.gateways = ""; } if (healthObj && isOnline) { - healthContainer.style.display = 'flex'; - let cpu = healthObj.cpu; cpuSpan.innerText = cpu; cpuSpan.style.color = cpu < 50 ? 'var(--success)' : (cpu < 80 ? '#f59e0b' : 'var(--danger)'); - let tempVal = healthObj.temp; tempSpan.innerText = tempVal; tempSpan.style.color = tempVal < 55 ? 'var(--success)' : (tempVal < 70 ? '#f59e0b' : 'var(--danger)'); - ramSpan.innerText = healthObj.ram; let d = healthObj.disk; diskSpan.innerText = d; diskSpan.style.color = d < 85 ? 'inherit' : (d < 95 ? '#f59e0b' : 'var(--danger)'); - - let upSpan = document.getElementById(`up-${c.id}`); - if (upSpan && healthObj.uptime) { upSpan.innerText = fmtAge(healthObj.uptime); } - let agentBadge = document.getElementById(`agent-badge-${c.id}`); - if (agentBadge && healthObj.agent_version) { agentBadge.innerText = `Agent v${healthObj.agent_version}`; agentBadge.style.display = 'inline-block'; } + healthContainer.style.display = 'grid'; + cpuSpan.innerText = healthObj.cpu; tempSpan.innerText = healthObj.temp; ramSpan.innerText = healthObj.ram; diskSpan.innerText = healthObj.disk; + let upSpan = document.getElementById(`up-${c.id}`); if (upSpan && healthObj.uptime) { upSpan.innerText = fmtAge(healthObj.uptime); } + let agentBadge = document.getElementById(`agent-badge-${c.id}`); if (agentBadge && healthObj.agent_version) { agentBadge.innerText = `AGT:v${healthObj.agent_version}`; agentBadge.style.display = 'inline-block'; } const profBtnsDiv = document.getElementById(`prof-btns-${c.id}`); const profKeys = JSON.stringify(healthObj.profiles || {}); @@ -621,10 +556,10 @@ async function refreshStates() { profBtnsDiv.dataset.keys = profKeys; if (healthObj.profiles && Object.keys(healthObj.profiles).length > 0) { profBtnsDiv.style.display = 'flex'; - let html = ''; const colors = ["var(--accent)", "#eab308", "var(--success)", "var(--primary)"]; let idx = 0; + let html = ''; const colors = ["var(--accent)", "var(--success)", "var(--primary)"]; let idx = 0; for (const [pKey, pLabel] of Object.entries(healthObj.profiles)) { let col = colors[idx % colors.length]; - html += ``; + html += ``; idx++; } profBtnsDiv.innerHTML = html; @@ -632,144 +567,71 @@ async function refreshStates() { } } else { if (healthContainer) healthContainer.style.display = 'none'; - let agentBadge = document.getElementById(`agent-badge-${c.id}`); - if (agentBadge) agentBadge.style.display = 'none'; + let agentBadge = document.getElementById(`agent-badge-${c.id}`); if (agentBadge) agentBadge.style.display = 'none'; } globalHealthData[c.id.toLowerCase()] = healthObj; let hasOfflineService = false; - if (healthObj && healthObj.processes) { - for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) { if (svcStatus.toLowerCase() !== 'online') { hasOfflineService = true; break; } } - } + if (healthObj && healthObj.processes) { for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) { if (svcStatus.toLowerCase() !== 'online') { hasOfflineService = true; break; } } } const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`); - if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none'; - if (btnSvc) { - if (hasOfflineService) { btnSvc.style.background = 'var(--danger)'; btnSvc.classList.add('blink'); btnSvc.innerHTML = t('btnSvcKo'); } - else { btnSvc.style.background = '#334155'; btnSvc.classList.remove('blink'); btnSvc.innerHTML = t('btnSvc'); } - } + if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } } - let btnOta = document.getElementById(`btn-ota-${c.id}`); - let adminSummary = document.getElementById(`admin-summary-${c.id}`); - + let btnOta = document.getElementById(`btn-ota-${c.id}`); let adminSummary = document.getElementById(`admin-summary-${c.id}`); if (btnOta) { if (healthObj && healthObj.agent_update_available) { - btnOta.style.setProperty('background', 'var(--danger)', 'important'); - btnOta.style.setProperty('color', 'white', 'important'); - btnOta.style.setProperty('border', '1px solid var(--danger)', 'important'); - btnOta.style.animation = 'danger-glow 1.5s infinite'; - - if (adminSummary) { - adminSummary.innerHTML = "โš ๏ธ ADMIN (UPDATE OTA!)"; - adminSummary.style.setProperty('color', 'var(--danger)', 'important'); - adminSummary.style.setProperty('border-color', 'var(--danger)', 'important'); - adminSummary.style.animation = 'danger-glow 1.5s infinite'; - } + btnOta.style.setProperty('border-color', 'var(--danger)', 'important'); + btnOta.style.setProperty('color', 'var(--danger)', 'important'); + if (adminSummary) { adminSummary.innerHTML = "[ SYS_TOOLS (OTA!) ]"; adminSummary.style.color = "var(--danger)"; adminSummary.style.borderColor = "var(--danger)"; } } else { - btnOta.style.setProperty('background', '#2563eb', 'important'); - btnOta.style.setProperty('color', 'white', 'important'); - btnOta.style.setProperty('border', '1px solid transparent', 'important'); - btnOta.style.animation = 'none'; - - if (adminSummary) { - adminSummary.innerHTML = "โš™๏ธ Admin Tools"; - adminSummary.style.setProperty('color', 'var(--text-muted)', 'important'); - adminSummary.style.setProperty('border-color', 'var(--border-color)', 'important'); - adminSummary.style.animation = 'none'; - } + btnOta.style.setProperty('border-color', 'var(--primary)', 'important'); + btnOta.style.setProperty('color', 'var(--primary)', 'important'); + if (adminSummary) { adminSummary.innerHTML = "[ SYS_TOOLS ]"; adminSummary.style.color = "var(--text-muted)"; adminSummary.style.borderColor = "var(--border-main)"; } } } if (isOnline) { - cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline'); cardDiv.style.opacity = "1"; cardDiv.style.filter = "none"; + cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline'); if (isTx) cardDiv.dataset.lastTx = Date.now(); let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0); let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS); - cardDiv.style.setProperty('border-top-color', showActiveColor ? activeModeColor : "var(--border-color)", 'important'); - if(isTx) { - let shadowRGB = '59, 130, 246'; - if (activeModeColor === '#10b981') shadowRGB = '16, 185, 129'; else if (activeModeColor === '#8b5cf6') shadowRGB = '139, 92, 246'; else if (activeModeColor === '#06b6d4') shadowRGB = '6, 182, 212'; else if (activeModeColor === '#f59e0b') shadowRGB = '245, 158, 11'; - cardDiv.style.boxShadow = `0 0 20px rgba(${shadowRGB}, 0.5) !important`; - } else { cardDiv.style.boxShadow = '0 4px 12px rgba(0,0,0,0.2) !important'; } + + if (showActiveColor) { cardDiv.style.borderColor = activeModeColor; } + else { cardDiv.style.borderColor = "var(--border-main)"; } } else { - cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline'); cardDiv.style.opacity = "0.7"; cardDiv.style.filter = "grayscale(80%)"; - cardDiv.style.setProperty('border-top-color', '#64748b', 'important'); cardDiv.style.boxShadow = 'none !important'; + cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline'); + cardDiv.style.borderColor = "var(--border-light)"; } - const miniCard = document.getElementById(`mini-card-${c.id}`); - const miniStatus = document.getElementById(`mini-status-${c.id}`); - const miniName = document.getElementById(`mini-name-${c.id}`); - const miniId = document.getElementById(`mini-id-${c.id}`); - + const miniCard = document.getElementById(`mini-card-${c.id}`); const miniStatus = document.getElementById(`mini-status-${c.id}`); const miniName = document.getElementById(`mini-name-${c.id}`); const miniId = document.getElementById(`mini-id-${c.id}`); if (miniCard && miniStatus) { - if (genObj && isOnline) { - if (miniName) miniName.innerText = genObj.callsign; - if (miniId) miniId.innerText = `ID: ${genObj.radio_id}`; - } - else { - if (miniName) miniName.innerText = c.name; - if (miniId) miniId.innerText = `ID: ${c.id.toUpperCase()}`; - } + if (genObj && isOnline) { if (miniName) miniName.innerText = genObj.callsign; if (miniId) miniId.innerText = `ID:${genObj.radio_id}`; } + else { if (miniName) miniName.innerText = c.name; if (miniId) miniId.innerText = `ID:${c.id.toUpperCase()}`; } if (isOnline) { let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0); let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS); - - miniCard.style.opacity = "1"; - miniCard.style.filter = "none"; - if (showActiveColor) { - let shadowRGB = '59, 130, 246'; - if (activeModeColor === '#10b981') shadowRGB = '16, 185, 129'; - else if (activeModeColor === '#8b5cf6') shadowRGB = '139, 92, 246'; - else if (activeModeColor === '#06b6d4') shadowRGB = '6, 182, 212'; - else if (activeModeColor === '#f59e0b') shadowRGB = '245, 158, 11'; - miniCard.style.borderColor = activeModeColor; - miniCard.style.boxShadow = `0 0 15px rgba(${shadowRGB}, 0.5)`; - miniStatus.innerText = "๐ŸŽ™๏ธ TX"; - miniStatus.title = "Transmitting..."; - miniStatus.style.color = "#ffffff"; - miniStatus.style.background = activeModeColor; - miniStatus.style.borderColor = activeModeColor; - } - else if (warns.length > 0) { - miniCard.style.borderColor = "#f59e0b"; - miniCard.style.boxShadow = "none"; - miniStatus.innerText = "โš ๏ธ ALERT"; - miniStatus.title = warns.join(" | "); - miniStatus.style.color = "#f59e0b"; - miniStatus.style.background = "rgba(245, 158, 11, 0.15)"; - miniStatus.style.borderColor = "rgba(245, 158, 11, 0.4)"; + miniStatus.innerText = "( TX )"; miniStatus.title = "Transmitting..."; miniStatus.style.color = activeModeColor; miniStatus.style.borderColor = activeModeColor; + } else if (warns.length > 0) { + miniCard.style.borderColor = "var(--accent)"; + miniStatus.innerText = "(!) ALERT"; miniStatus.title = warns.join(" | "); miniStatus.style.color = "var(--accent)"; miniStatus.style.borderColor = "var(--accent)"; } else { - miniCard.style.borderColor = "var(--success)"; - miniCard.style.boxShadow = "none"; - miniStatus.innerText = stateValue; - miniStatus.title = stateValue; - miniStatus.style.color = "var(--success)"; - miniStatus.style.background = "rgba(16, 185, 129, 0.1)"; - miniStatus.style.borderColor = "rgba(16, 185, 129, 0.2)"; + miniCard.style.borderColor = "var(--border-main)"; + miniStatus.innerText = stateValue; miniStatus.title = stateValue; miniStatus.style.color = "var(--success)"; miniStatus.style.borderColor = "var(--border-light)"; } } else { - miniCard.style.borderColor = "var(--border-color)"; - miniCard.style.opacity = "0.6"; - miniCard.style.filter = "grayscale(80%)"; - miniCard.style.boxShadow = "none"; - miniStatus.innerText = "OFFLINE"; - miniStatus.title = "OFFLINE"; - miniStatus.style.color = "var(--danger)"; - miniStatus.style.background = "rgba(239, 68, 68, 0.1)"; - miniStatus.style.borderColor = "rgba(239, 68, 68, 0.2)"; + miniCard.style.borderColor = "var(--border-light)"; + miniStatus.innerText = "OFFLINE"; miniStatus.title = "OFFLINE"; miniStatus.style.color = "var(--danger)"; miniStatus.style.borderColor = "var(--border-light)"; } } }); applyFilters(); - if (document.getElementById('view-map').style.display === 'block') { - initOrUpdateMap(); - } - document.getElementById('last-update').innerText = "Sync: " + new Date().toLocaleTimeString(); + if (document.getElementById('view-map').style.display === 'block') { initOrUpdateMap(); } + document.getElementById('last-update').innerText = "SYNC: " + new Date().toLocaleTimeString(); } catch (e) { console.error(e); } } @@ -784,7 +646,7 @@ async function refreshLogs() { const url = savedLimit ? `/api/logs?limit=${encodeURIComponent(savedLimit)}` : '/api/logs'; const res = await fetch(url); const logs = await res.json(); const tbody = document.getElementById('log-body'); let tableHTML = ""; let networkLogs = {}; - logs.forEach(row => { + logs.forEach(row => { const time = row[0] ? row[0].split(' ')[1] : "--:--"; const clientId = row[1]; const protocol = row[2] || "DMR"; let source = row[3] || "---"; const target = row[4] || "---"; const rawSlot = row[5]; const source_ext = row[8]; const rawRssi = row[9]; const sourceConn = row[10]; const ysfMode = row[11]; @@ -797,50 +659,37 @@ async function refreshLogs() { if (source_ext && source_ext.trim() !== "") { sourceHtml += ` /${esc(source_ext)}`; } let slotDisplay = rawSlot && String(rawSlot).trim() !== "" && rawSlot !== "undefined" ? (protocol === "DMR" && !String(rawSlot).toUpperCase().startsWith("TS") ? `TS${rawSlot}` : rawSlot) : "---"; - let protoColor = "#3b82f6"; if (protocol === "NXDN") protoColor = "#10b981"; else if (protocol === "YSF") protoColor = "#8b5cf6"; else if (protocol === "D-STAR") protoColor = "#06b6d4"; else if (protocol === "P25") protoColor = "#f59e0b"; + let protoColor = "var(--primary)"; if (protocol === "NXDN") protoColor = "var(--success)"; else if (protocol === "YSF") protoColor = "var(--accent)"; else if (protocol === "D-STAR") protoColor = "var(--primary)"; else if (protocol === "P25") protoColor = "var(--accent)"; - let sourceBadge = sourceConn ? (sourceConn.toLowerCase() === 'rf' ? 'RF' : (sourceConn.toLowerCase() === 'network' ? 'NET' : `${esc(sourceConn).toUpperCase()}`)) : "---"; - let modeDisplay = ysfMode && ysfMode.trim() !== "" ? `${esc(ysfMode).toUpperCase()}` : "---"; + let sourceBadge = sourceConn ? (sourceConn.toLowerCase() === 'rf' ? '(RF)' : (sourceConn.toLowerCase() === 'network' ? '(NET)' : `(${esc(sourceConn).toUpperCase()})`)) : "---"; + let modeDisplay = ysfMode && ysfMode.trim() !== "" ? `${esc(ysfMode).toUpperCase()}` : "---"; let rssiDisplay = '---'; if (rawRssi && rawRssi !== 0) { let sLabel = "S0"; - if (rawRssi >= -93) { - let over = Math.round((rawRssi + 93) / 10) * 10; - sLabel = over > 0 ? `S9+${over}` : "S9"; - } else { - let sUnits = Math.floor((rawRssi + 141) / 6) + 1; - sLabel = `S${Math.max(1, Math.min(9, sUnits))}`; - } - let activeSegs = 1; - if (rawRssi >= -53) activeSegs = 9; else if (rawRssi >= -63) activeSegs = 8; else if (rawRssi >= -73) activeSegs = 7; else if (rawRssi >= -83) activeSegs = 6; else if (rawRssi >= -93) activeSegs = 5; else if (rawRssi >= -105) activeSegs = 4; else if (rawRssi >= -117) activeSegs = 3; else if (rawRssi >= -129) activeSegs = 2; - let barsHtml = ''; const heights = [4, 5, 6, 7, 8, 10, 12, 14, 14]; - for (let i = 0; i < 9; i++) { - let color = "rgba(255,255,255,0.1)"; - if (i < activeSegs) { if (i < 5) color = "var(--success)"; else if (i < 7) color = "#f59e0b"; else color = "var(--danger)"; } - barsHtml += `
`; - } - rssiDisplay = `
${sLabel}
${barsHtml}
${esc(rawRssi)} dBm
`; + if (rawRssi >= -93) { let over = Math.round((rawRssi + 93) / 10) * 10; sLabel = over > 0 ? `S9+${over}` : "S9"; } + else { let sUnits = Math.floor((rawRssi + 141) / 6) + 1; sLabel = `S${Math.max(1, Math.min(9, sUnits))}`; } + rssiDisplay = `${sLabel}`; } if (source.includes("๐ŸŒ")) { if (!networkLogs[clientId]) networkLogs[clientId] = ""; - networkLogs[clientId] += `
[${esc(time)}] [${esc(protocol)}] ${esc(source.replace("๐ŸŒ", "").trim())}
`; + networkLogs[clientId] += `
[${esc(time)}] [${esc(protocol)}] ${esc(source.replace("๐ŸŒ", "").trim())}
`; } else { const selectedFilter = document.getElementById('stat-node-filter').value; if (selectedFilter === 'all' || String(clientId).toLowerCase() === selectedFilter) { tableHTML += ` ${esc(time)} ${esc(String(clientId).toUpperCase())} - ${esc(protocol)} + ${esc(protocol)} ${modeDisplay} - ${sourceBadge} - ${esc(slotDisplay)} - ${sourceHtml} - ${esc(target.trim())} + ${sourceBadge} + ${esc(slotDisplay)} + ${sourceHtml} + ${esc(target.trim())} ${esc(row[6])}s ${esc(row[7])}% - ${rssiDisplay} + ${rssiDisplay} `; } } @@ -854,24 +703,24 @@ async function refreshStats() { try { const node = document.getElementById('stat-node-filter').value || 'all'; const res = await fetch(`/api/stats?node=${node}`); const data = await res.json(); - document.getElementById('stat-tgs').innerHTML = data.top_tgs.map((t, i) => `
${i+1}. ${esc(t.target)} ${t.count} tx
`).join('') || t('statNoData'); - document.getElementById('stat-calls').innerHTML = data.top_calls.map((c, i) => `
${i+1}. ${esc(c.call)} ${c.count} tx
`).join('') || t('statNoData'); + document.getElementById('stat-tgs').innerHTML = data.top_tgs.map((t, i) => `
${i+1}. ${esc(t.target)} [ ${t.count} TX ]
`).join('') || t('statNoData'); + document.getElementById('stat-calls').innerHTML = data.top_calls.map((c, i) => `
${i+1}. ${esc(c.call)} [ ${c.count} TX ]
`).join('') || t('statNoData'); document.getElementById('stat-avg').innerText = data.avg_duration; document.getElementById('stat-today').innerText = data.today_tx; - } catch (e) { console.error("Errore statistiche:", e); } + } catch (e) { console.error(e); } } async function subscribeToPush() { - if (!('serviceWorker' in navigator) || !('PushManager' in window)) { customAlert("Error", "Push notifications are not supported by this browser.", true); return; } + if (!('serviceWorker' in navigator) || !('PushManager' in window)) { customAlert("ERR", "PUSH UNSUPPORTED", true); return; } if (!me.logged_in) { openLoginModal(); return; } const permission = await Notification.requestPermission(); - if (permission !== 'granted') { customAlert("Error", "Push notifications permission denied.", true); return; } + if (permission !== 'granted') { customAlert("ERR", "PERMISSION DENIED", true); return; } try { const reg = await navigator.serviceWorker.ready; const res = await fetch('/api/vapid_public_key'); const { public_key } = await res.json(); const subscription = await reg.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: urlB64ToUint8Array(public_key) }); const subRes = await fetch('/api/subscribe', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(subscription) }); - if (!subRes.ok) throw new Error('subscribe failed: HTTP ' + subRes.status); - customAlert("Success", "Push notifications enabled successfully!"); document.getElementById('push-btn').style.color = 'var(--success)'; - } catch (e) { console.error(e); customAlert("Error", "Failed to enable notifications.", true); } + if (!subRes.ok) throw new Error('ERR HTTP ' + subRes.status); + customAlert("OK", "PUSH ENABLED"); document.getElementById('push-btn').style.color = 'var(--success)'; + } catch (e) { console.error(e); customAlert("ERR", "PUSH FAIL", true); } } async function checkPushStatus() { @@ -887,8 +736,8 @@ async function checkServerUpdate() { } function confirmServerUpdate() { - customConfirm("๐Ÿ”„ UPDATE SERVER", "Vuoi scaricare l'ultima versione del server da Gitea/GitHub e riavviare il servizio backend?", "var(--danger)", async () => { - try { const res = await fetch('/api/server_update/apply', { method: 'POST' }); const data = await res.json(); if (data.success) { customAlert("โœ… SUCCESS", "Aggiornamento in corso. La pagina si ricaricherร  a breve."); setTimeout(() => location.reload(), 5000); } else { customAlert("โŒ ERRORE", esc(data.error), true); } } catch (e) { console.error(e); customAlert("โŒ ERRORE", "Errore di rete.", true); } + customConfirm("UPD_SRV", "EXECUTE GIT PULL ON BACKEND?", "var(--danger)", async () => { + try { const res = await fetch('/api/server_update/apply', { method: 'POST' }); const data = await res.json(); if (data.success) { customAlert("OK", "UPD EXECUTED. RELOAD IN 5s."); setTimeout(() => location.reload(), 5000); } else { customAlert("ERR", esc(data.error), true); } } catch (e) { console.error(e); customAlert("ERR", "NET ERR", true); } }); } @@ -898,7 +747,7 @@ const refreshLogsSoon = debounce(() => { refreshLogs(); refreshStats(); }, 500); if (typeof io !== 'undefined') { const socket = io(); - socket.on('mqtt_status', function(data) { const badge = document.getElementById('mqtt-badge'); if (badge) { if (data.connected) { badge.innerText = "MQTT: ONLINE"; badge.className = "mqtt-badge mqtt-online"; } else { badge.innerText = "MQTT: OFFLINE"; badge.className = "mqtt-badge mqtt-offline"; } } }); + socket.on('mqtt_status', function(data) { const badge = document.getElementById('mqtt-badge'); if (badge) { if (data.connected) { badge.innerText = "MQTT: OK"; badge.className = "mqtt-badge mqtt-online"; } else { badge.innerText = "MQTT: ERR"; badge.className = "mqtt-badge mqtt-offline"; } } }); socket.on('connect', () => { refreshStates(); refreshLogs(); refreshStats(); }); socket.on('dati_aggiornati', refreshStatesSoon); socket.on('log_aggiornato', refreshLogsSoon); } diff --git a/static/js/modals.js b/static/js/modals.js index ff368aa..39bd485 100644 --- a/static/js/modals.js +++ b/static/js/modals.js @@ -2,65 +2,65 @@ const i18n = { en: { lblLogLimit: "Rows:", - lastTransits: "Lastheard", loginTitle: "๐Ÿ”’ System Login", + lastTransits: "Lastheard", loginTitle: "SYSTEM_LOGIN", thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration", thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions", - btnReqCfg: "๐Ÿ”„ REQ CONFIG", btnGlobal: "๐Ÿšจ GLOBAL OVERRIDE", btnAdmin: "๐Ÿ› ๏ธ ADMIN", btnPass: "๐Ÿ”‘ PASS", btnLogout: "LOGOUT", - btnSvc: "โš™๏ธ SVC", btnFile: "๐Ÿ“‚ FILE", btnBoot: "๐Ÿ”„ BOOT", btnAdd: "+ ADD", - waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "๐Ÿ”„ FORCE UPDATE", - adminTitle: "๐Ÿ› ๏ธ User & System Management", adminDBSync: "โš™๏ธ Database Sync Config", adminTime: "Daily Update Time:", adminSave: "SAVE CONFIG", roleOp: "Operator", - modSvcTitle: "โš™๏ธ System Daemons:", modFileTitle: "๐Ÿ“‚ Config Files", modEditTitle: "๐Ÿ“ INI Editor:", - warnEdit: "โš ๏ธ WARNING: This editor directly manipulates remote node parameters.", - btnEdit: "๐Ÿ“ EDIT", btnStart: "โ–ถ START", btnRestart: "๐Ÿ”„ RESTART", btnStop: "๐Ÿ›‘ STOP", btnSave: "๐Ÿ’พ SAVE & SEND", - btnHat: "๐Ÿ”Œ RESET HAT", confHat: "Are you sure you want to physically reset the MMDVM board on node ", + btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT", + btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD", + waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "FORCE_UPD", + adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Daily Update Time:", adminSave: "SAVE_CFG", roleOp: "Operator", + modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:", + warnEdit: "[WARN] DIRECT EDIT ACTIVE", + btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE", + btnHat: "RST_HAT", confHat: "PHYSICAL RESET MMDVM ON: ", confOp: "Confirm operation on ", confTgOn: "ENABLE Telegram notifications for ", confTgOff: "MUTE Telegram notifications for ", confOvr: "Are you sure you want to overwrite file on ", - warnDaemon: "โš ๏ธ SVC KO - CHECK DAEMONS โš ๏ธ", + warnDaemon: "[WARN] DAEMON OFFLINE", promptOvr: "GLOBAL OVERRIDE", promptOvrConfirm: "Confirm sending to ENTIRE network?", - modUpdateTitle: "๐Ÿ”„ GLOBAL UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "Request sent successfully!", - btnConfReset: "โš ๏ธ CONFIRM RESET", btnCancel: "CANCEL", promptPass: "Enter the new password:", - titleError: "โŒ ERROR", titleSuccess: "โœ… SUCCESS", titleAction: "โš™๏ธ CONFIRM ACTION", titleDelete: "๐Ÿ—‘๏ธ DELETE USER", titleSave: "๐Ÿ’พ SAVE", titleGlobal: "๐Ÿšจ GLOBAL OVERRIDE", - btnYes: "YES, PROCEED", msgDelUser: "Confirm user deletion?", msgPassOk: "Password updated successfully!", msgPassErr: "Failed to update password.", msgLoginFail: "Login Failed", - msgConfigSaved: "Configuration saved!", msgConfigErr: "Error saving configuration", msgNetErr: "Network Error", msgOvrSel: "Select the profile to send to the ENTIRE network:", - msgOvrOk: "Command successfully sent to the network!", msgMissUser: "Missing Username", msgMissPass: "Password required for new user", btnSvcKo: "โš ๏ธ DAEMON KO", - phNewPass: "New pass (empty to keep)", phPass: "Password", - titleSwitch: "SWITCH PROFILE", confSwitch: "Are you sure you want to switch to", titleBoot: "SYSTEM REBOOT", confBoot: "Are you sure you want to REBOOT node ", - ttReqCfg: "Request immediate data update", ttGlobal: "Force profile switch on network", ttAdmin: "User and system management", ttPass: "Change your password", ttLogout: "Log out", - ttProfA: "Switch to Profile A", ttProfB: "Switch to Profile B", ttTgOn: "Enable Telegram notifications", ttTgOff: "Disable Telegram notifications", ttSvc: "Manage system daemons", ttFile: "Edit .ini configuration files", ttHat: "Send physical reset to modem", ttBoot: "Reboot node operating system", - ttSwitchTo: "Switch to profile: ", ttSvcStart: "Start service", ttSvcRestart: "Restart service", ttSvcEdit: "Edit configuration", ttSvcStop: "Stop service", ttLang: "Change language", - statTopTG: "๐ŸŽฏ TOP TALKGROUPS", statTopCall: "๐Ÿ—ฃ๏ธ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "โฑ๏ธ AVERAGE DURATION", statTodayTx: "๐Ÿ“ก TRANSITS TODAY", statNoData: "No data", - statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES", modVersions: "Software & Firmware", - filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "โš ๏ธ Alerts" + modUpdateTitle: "GBL_UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "ACK", + btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:", + titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR", + btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL", + msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:", + msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR", + phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD", + titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ", + ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT", + ttProfA: "PROF_A", ttProfB: "PROF_B", ttTgOn: "TG_ON", ttTgOff: "TG_OFF", ttSvc: "DAEMONS", ttFile: "FILES", ttHat: "RST_HAT", ttBoot: "REBOOT", + ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG", + statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA", + statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS", + filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS" }, it: { lblLogLimit: "Righe:", - lastTransits: "Ultimi ascolti", loginTitle: "๐Ÿ”’ Login di Sistema", + lastTransits: "Ultimi ascolti", loginTitle: "SYSTEM_LOGIN", thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata", thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni", - btnReqCfg: "๐Ÿ”„ RICHIEDI CONFIG", btnGlobal: "๐Ÿšจ OVERRIDE GLOBALE", btnAdmin: "๐Ÿ› ๏ธ ADMIN", btnPass: "๐Ÿ”‘ PASS", btnLogout: "LOGOUT", - btnSvc: "โš™๏ธ SVC", btnFile: "๐Ÿ“‚ FILE", btnBoot: "๐Ÿ”„ BOOT", btnAdd: "+ AGGIUNGI", - waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "๐Ÿ”„ FORZA AGGIORNAMENTO", - adminTitle: "๐Ÿ› ๏ธ Gestione Utenti e Sistema", adminDBSync: "โš™๏ธ Sincronizzazione Database", adminTime: "Orario Aggiornamento:", adminSave: "SALVA CONFIG", roleOp: "Operatore", - modSvcTitle: "โš™๏ธ Demoni Sistema:", modFileTitle: "๐Ÿ“‚ File di Configurazione", modEditTitle: "๐Ÿ“ Editor INI:", - warnEdit: "โš ๏ธ ATTENZIONE: Questo editor manipola direttamente i parametri del nodo remoto.", - btnEdit: "๐Ÿ“ MODIFICA", btnStart: "โ–ถ START", btnRestart: "๐Ÿ”„ RESTART", btnStop: "๐Ÿ›‘ STOP", btnSave: "๐Ÿ’พ SALVA ED INVIA", - btnHat: "๐Ÿ”Œ RESET HAT", confHat: "Sei sicuro di voler resettare fisicamente la scheda MMDVM sul nodo ", + btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT", + btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD", + waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "FORCE_UPD", + adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Orario Aggiornamento:", adminSave: "SAVE_CFG", roleOp: "Operatore", + modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:", + warnEdit: "[WARN] DIRECT EDIT ACTIVE", + btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE", + btnHat: "RST_HAT", confHat: "PHYSICAL RESET MMDVM ON: ", confOp: "Confermi l'operazione su ", confTgOn: "Vuoi ATTIVARE le notifiche Telegram per il nodo ", confTgOff: "Vuoi SILENZIARE le notifiche Telegram per il nodo ", confOvr: "Sei sicuro di voler sovrascrivere il file su ", - warnDaemon: "โš ๏ธ SVC KO - CONTROLLA DEMONI โš ๏ธ", - promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?", - modUpdateTitle: "๐Ÿ”„ AGGIORNAMENTO GLOBALE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "Richiesta inviata con successo!", - btnConfReset: "โš ๏ธ CONFERMA RESET", btnCancel: "ANNULLA", promptPass: "Inserisci la nuova password:", - titleError: "โŒ ERRORE", titleSuccess: "โœ… OK", titleAction: "โš™๏ธ CONFERMA AZIONE", titleDelete: "๐Ÿ—‘๏ธ ELIMINA UTENTE", titleSave: "๐Ÿ’พ SALVATAGGIO", titleGlobal: "๐Ÿšจ OVERRIDE GLOBALE", - btnYes: "SI, PROCEDI", msgDelUser: "Confermi l'eliminazione dell'utente?", msgPassOk: "Password aggiornata con successo!", msgPassErr: "Errore durante l'aggiornamento della password.", msgLoginFail: "Login Fallito", - msgConfigSaved: "Configurazione salvata!", msgConfigErr: "Errore durante il salvataggio", msgNetErr: "Errore di rete", msgOvrSel: "Seleziona il profilo da inviare a TUTTA la rete:", - msgOvrOk: "Comando inviato con successo a tutta la rete!", msgMissUser: "Username mancante", msgMissPass: "Password obbligatoria per il nuovo utente", btnSvcKo: "โš ๏ธ DEMONE KO", - phNewPass: "Nuova pass (vuota per non cambiare)", phPass: "Password", - titleSwitch: "CAMBIO PROFILO", confSwitch: "Sei sicuro di voler passare al", titleBoot: "RIAVVIO SISTEMA", confBoot: "Sei sicuro di voler RIAVVIARE il nodo ", - ttReqCfg: "Richiedi aggiornamento dati", ttGlobal: "Forza cambio profilo globale", ttAdmin: "Gestione utenti e sistema", ttPass: "Cambia la tua password", ttLogout: "Disconnetti", + warnDaemon: "[WARN] DAEMON OFFLINE", + promptOvr: "GBL_OVR", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?", + modUpdateTitle: "GBL_UPDATE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "ACK", + btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:", + titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR", + btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL", + msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:", + msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR", + phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD", + titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ", + ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT", ttProfA: "Passa al Profilo A", ttProfB: "Passa al Profilo B", ttTgOn: "Abilita notifiche Telegram", ttTgOff: "Disabilita notifiche Telegram", ttSvc: "Gestisci demoni di sistema", ttFile: "Modifica file .ini da remoto", ttHat: "Reset fisico scheda modem", ttBoot: "Riavvia sistema operativo", - ttSwitchTo: "Passa al profilo: ", ttSvcStart: "Avvia servizio", ttSvcRestart: "Riavvia servizio", ttSvcEdit: "Modifica configurazione", ttSvcStop: "Ferma servizio", ttLang: "Cambia lingua", - statTopTG: "๐ŸŽฏ TOP TALKGROUPS", statTopCall: "๐Ÿ—ฃ๏ธ TOP CALLSIGNS", statLoading: "Caricamento...", statAvgDur: "โฑ๏ธ DURATA MEDIA", statTodayTx: "๐Ÿ“ก TRANSITI OGGI", statNoData: "Nessun dato", - statTitle: "STATISTICHE GIORNALIERE", statAllNodes: "TUTTA LA RETE", modVersions: "Software & Firmware", - filtAll: "Tutti i nodi", filtOnline: "Attivi", filtOffline: "Offline", filtAlerts: "โš ๏ธ Allarmi" + ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG", + statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA", + statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS", + filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS" } }; @@ -70,7 +70,7 @@ function toggleLang() { currentLang = currentLang === 'it' ? 'en' : 'it'; localS function applyTranslations() { const langBtn = document.getElementById('lang-btn'); - if (langBtn) langBtn.innerText = currentLang === 'it' ? "๐Ÿ‡ฌ๐Ÿ‡ง ENG" : "๐Ÿ‡ฎ๐Ÿ‡น ITA"; + if (langBtn) langBtn.innerText = currentLang === 'it' ? "ENG" : "ITA"; document.querySelectorAll('[data-i18n]').forEach(el => { const key = el.getAttribute('data-i18n'); if (i18n[currentLang][key]) el.innerHTML = i18n[currentLang][key]; @@ -90,19 +90,20 @@ function q(s) { return esc(JSON.stringify(String(s ?? ''))); } // --- DIALOGHI ALERT & CONFIRM --- function customAlert(title, desc, isError = false) { const color = isError ? 'var(--danger)' : 'var(--success)'; - document.getElementById('alert-title').innerHTML = title; + document.getElementById('alert-title').innerHTML = '> ' + title; document.getElementById('alert-title').style.color = color; - document.getElementById('alert-box').style.borderColor = color; + document.getElementById('alert-box').style.borderTopColor = color; document.getElementById('alert-desc').innerHTML = desc; document.getElementById('alert-modal').style.display = 'flex'; } function customConfirm(title, desc, color, callback) { - document.getElementById('confirm-title').innerHTML = title; + document.getElementById('confirm-title').innerHTML = '> ' + title; document.getElementById('confirm-title').style.color = color; - document.getElementById('confirm-box').style.borderColor = color; + document.getElementById('confirm-box').style.borderTopColor = color; document.getElementById('confirm-desc').innerHTML = desc; - document.getElementById('confirm-yes-btn').style.background = color; + document.getElementById('confirm-yes-btn').style.borderColor = color; + document.getElementById('confirm-yes-btn').style.color = color; document.getElementById('confirm-yes-btn').innerText = t('btnYes'); document.getElementById('confirm-cancel-btn').innerText = t('btnCancel'); confirmActionCallback = callback; @@ -156,10 +157,10 @@ async function loadUsers() { const res = await fetch('/api/users'); if (!res.ok) return; const users = await res.json(); usersCache = {}; users.forEach(u => { usersCache[u.id] = u; }); document.getElementById('users-table-body').innerHTML = users.map(u => ` - ${u.id}${esc(u.username)}${esc(String(u.role).toUpperCase())}${esc(u.allowed_nodes)} - - - + ${u.id}${esc(u.username)}[ ${esc(String(u.role).toUpperCase())} ]${esc(u.allowed_nodes)} + + + `).join(''); } @@ -167,12 +168,12 @@ async function loadUsers() { function startEditUser(id) { const u = usersCache[id]; if (!u) return; editingUserId = id; document.getElementById('new-user').value = u.username; document.getElementById('new-user').disabled = true; document.getElementById('new-pass').value = ""; document.getElementById('new-pass').placeholder = t('phNewPass'); document.getElementById('new-role').value = u.role; document.getElementById('new-nodes').value = u.allowed_nodes; - const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = t('titleSave'); btnSubmit.style.background = "var(--accent)"; document.getElementById('btn-user-cancel').style.display = "block"; + const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = "UPDATE"; btnSubmit.style.borderColor = "var(--accent)"; btnSubmit.style.color = "var(--accent) !important"; document.getElementById('btn-user-cancel').style.display = "block"; } function cancelEdit() { editingUserId = null; document.getElementById('new-user').value = ""; document.getElementById('new-user').disabled = false; document.getElementById('new-pass').value = ""; document.getElementById('new-pass').placeholder = t('phPass'); document.getElementById('new-role').value = "operator"; document.getElementById('new-nodes').value = ""; - const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = t('btnAdd'); btnSubmit.style.background = "var(--success)"; document.getElementById('btn-user-cancel').style.display = "none"; + const btnSubmit = document.getElementById('btn-user-submit'); btnSubmit.innerHTML = "ADD"; btnSubmit.style.borderColor = "var(--success)"; btnSubmit.style.color = "var(--success) !important"; document.getElementById('btn-user-cancel').style.display = "none"; } async function submitUser() { @@ -208,13 +209,13 @@ function triggerGlobalEmergency() { for (const [k, v] of Object.entries(globalHealthData[id].profiles)) { uniqueProfiles[k] = v; } } } - const container = document.getElementById('global-btn-container'); let html = ''; const colors = ["var(--accent)", "#eab308", "var(--success)", "var(--primary)"]; let idx = 0; + const container = document.getElementById('global-btn-container'); let html = ''; const colors = ["var(--accent)", "#00ffcc", "var(--primary)"]; let idx = 0; for (const [k, v] of Object.entries(uniqueProfiles)) { let col = colors[idx % colors.length]; - html += ``; + html += ``; idx++; } - if (Object.keys(uniqueProfiles).length === 0) { html = `

No profiles configured on the network.

`; } + if (Object.keys(uniqueProfiles).length === 0) { html = `

NO_PROFS_FOUND

`; } container.innerHTML = html; document.getElementById('override-desc').innerText = t('msgOvrSel'); document.getElementById('override-modal').style.display = 'flex'; } @@ -241,34 +242,50 @@ async function executePasswordChange() { function fileLabel(stem, names) { const key = String(stem).toLowerCase(); const full = (names || []).find(n => String(n).replace(/\.[^.]*$/, '').toLowerCase() === key); if (full) { const m = String(full).match(/^(.*?)(\.[^.]*)?$/); return String(m[1]).toUpperCase() + (m[2] || ''); } - return String(stem).toUpperCase() + '.ini'; + return String(stem).toUpperCase() + '.INI'; } function openConfigsModal(clientId) { - const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('configs-list'); let listaFile = data ? (data.config_files || data.files || []) : []; const fileNames = (data && data.file_names) || []; - if (listaFile.length === 0) listDiv.innerHTML = `

${t('waitData')}

`; - else listDiv.innerHTML = listaFile.map(f => `
${esc(fileLabel(f, fileNames))}
`).join(''); + const data = globalHealthData[clientId.toLowerCase()]; + const listDiv = document.getElementById('configs-list'); + let listaFile = data ? (data.config_files || data.files || []) : []; + const fileNames = (data && data.file_names) || []; + + if (listaFile.length === 0) { + listDiv.innerHTML = `

${t('waitData')}

`; + } else { + listDiv.innerHTML = listaFile.map(f => `
+ ${esc(fileLabel(f, fileNames))} + +
`).join(''); + } document.getElementById('configs-modal').style.display = 'flex'; } function closeConfigsModal() { document.getElementById('configs-modal').style.display = 'none'; } // --- MODALE GESTIONE DEMONI/SERVIZI --- -function openServicesModal(clientId) { document.getElementById('svc-modal-title').innerText = clientId.toUpperCase(); document.getElementById('services-modal').style.display = 'flex'; renderServicesList(clientId); } +function openServicesModal(clientId) { + document.getElementById('svc-modal-title').innerText = clientId.toUpperCase(); + document.getElementById('services-modal').style.display = 'flex'; + renderServicesList(clientId); +} function closeServicesModal() { document.getElementById('services-modal').style.display = 'none'; } function renderServicesList(clientId) { - const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('services-list'); - if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "

No service data available.

"; return; } + const data = globalHealthData[clientId.toLowerCase()]; + const listDiv = document.getElementById('services-list'); + + if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "

NO_DATA

"; return; } let html = ""; for (const [name, status] of Object.entries(data.processes)) { const isOnline = status.toLowerCase() === 'online'; const statusColor = isOnline ? 'var(--success)' : 'var(--danger)'; - html += `
-
${esc(name)}${esc(String(status).toUpperCase())}
-
- ${!isOnline ? `` : ''} - - - ${isOnline ? `` : ''} + html += `
+
${esc(name)} [${esc(String(status).toUpperCase())}]
+
+ ${!isOnline ? `` : ''} + + + ${isOnline ? `` : ''}
`; } @@ -278,7 +295,7 @@ function renderServicesList(clientId) { function controlService(clientId, service, action) { customConfirm(t('titleAction'), `${t('confOp')}${esc(service)}?`, "var(--accent)", async () => { try { const res = await fetch('/api/service_control', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId, service, action }) }); const data = await res.json(); - if(!data.success) customAlert(t('titleError'), "Error: " + esc(data.error), true); + if(!data.success) customAlert(t('titleError'), "ERR: " + esc(data.error), true); } catch(e) { console.error(e); } }); } @@ -287,28 +304,38 @@ function controlService(clientId, service, action) { let currentEditClient = ""; let currentEditService = ""; async function openEditorModal(clientId, service) { currentEditClient = clientId; currentEditService = service; document.getElementById('editor-title').innerText = `${service.toUpperCase()} @ ${clientId.toUpperCase()}`; - document.getElementById('config-textarea').value = "Connecting to server..."; document.getElementById('editor-status').innerText = ""; document.getElementById('editor-modal').style.display = 'flex'; - try { const res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(service)}`); const data = await res.json(); if (data.success) document.getElementById('config-textarea').value = data.data.raw_text || "Empty file"; else document.getElementById('config-textarea').value = "ERROR:\n" + data.error; } catch(e) { document.getElementById('config-textarea').value = "Connection error."; } + document.getElementById('config-textarea').value = "AWAITING_STREAM..."; document.getElementById('editor-status').innerText = ""; document.getElementById('editor-modal').style.display = 'flex'; + try { + const res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(service)}`); + const data = await res.json(); + if (data.success) { + document.getElementById('config-textarea').value = data.data.raw_text || "EMPTY"; + } else { + document.getElementById('config-textarea').value = "ERR:\n" + data.error; + } + } catch(e) { + document.getElementById('config-textarea').value = "NET_ERR"; + } } function closeEditorModal() { document.getElementById('editor-modal').style.display = 'none'; } function saveConfig() { const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status'); customConfirm(t('titleSave'), `${t('confOvr')}${currentEditClient.toUpperCase()}?`, "var(--danger)", async () => { - statusSpan.innerText = "Sending..."; statusSpan.style.color = "var(--success)"; + statusSpan.innerText = "WRITING..."; statusSpan.style.color = "var(--success)"; try { const res = await fetch('/api/config_file', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ clientId: currentEditClient, service: currentEditService, config_data: { "raw_text": textValue } }) }); const data = await res.json(); - if (data.success) { customAlert(t('titleSuccess'), "File updated!"); closeEditorModal(); } else { customAlert(t('titleError'), "Server error: " + esc(data.error), true); statusSpan.innerText = "โŒ Error"; } - } catch(e) { customAlert(t('titleError'), t('msgNetErr'), true); statusSpan.innerText = "โŒ Network Error"; } + if (data.success) { customAlert(t('titleSuccess'), "FILE_WRITTEN"); closeEditorModal(); } else { customAlert(t('titleError'), "ERR: " + esc(data.error), true); statusSpan.innerText = "ERR"; } + } catch(e) { customAlert(t('titleError'), t('msgNetErr'), true); statusSpan.innerText = "NET_ERR"; } }); } // --- MODALE VERSIONI SOFTWARE --- function openVersionsModal(clientId) { const versions = globalVersionsData[clientId.toLowerCase()]; const listDiv = document.getElementById('versions-list'); - if (!versions || Object.keys(versions).length === 0) { listDiv.innerHTML = "Nessun dato ancora ricevuto. Usa il tasto ๐Ÿ”„ RESTART sui servizi del nodo per forzare l'invio del log di avvio."; } - else { let html = ""; for (const [software, version] of Object.entries(versions)) { html += `
${esc(software)}: ${esc(version)}
`; } listDiv.innerHTML = html; } + if (!versions || Object.keys(versions).length === 0) { listDiv.innerHTML = "

NO_DATA. RESTART SVCS TO PUSH LOGS.

"; } + else { let html = ""; for (const [software, version] of Object.entries(versions)) { html += `
${esc(software)}: ${esc(version)}
`; } listDiv.innerHTML = html; } document.getElementById('versions-modal').style.display = 'flex'; } function closeVersionsModal() { document.getElementById('versions-modal').style.display = 'none'; } diff --git a/templates/index.html b/templates/index.html index 3377fb8..e6b93e0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,24 +6,26 @@ Fleet Control Console - + - + + + - +
-
FLEET CONTROL CONSOLE
+
SCHEMATIC // FLEET C2
-
- MQTT: CHECKING... - - +
+ MQTT: CHK + +
@@ -50,19 +52,19 @@
- - - - -
- - - - + + + + +
+ + + +
- - + +
@@ -72,30 +74,30 @@
+
-

- ๐ŸŸข FLEET STATUS +

+ [ FLEET_STATUS ]

+
-
-

- ๐Ÿ“ก Lastheard -

+
+

[ LASTHEARD ]

- -
- +
@@ -103,15 +105,15 @@ - - - - - - - - - + + + + + + + + + @@ -121,30 +123,29 @@ +
-

- ๐Ÿ“Š DAILY STATISTICS -

+

[ DAILY_STATISTICS ]

-
-

๐ŸŽฏ TOP TALKGROUPS

-
Loading...
+
+

TOP_TALKGROUPS

+
LOADING...
-
-

๐Ÿ—ฃ๏ธ TOP CALLSIGNS

-
Loading...
+
+

TOP_CALLSIGNS

+
LOADING...
-
+
-
--s
-
โฑ๏ธ AVERAGE DURATION
+
--s
+
AVG_DURATION
-
+
-
--
-
๐Ÿ“ก TRANSITS TODAY
+
--
+
TRANSITS_TODAY
@@ -152,65 +153,60 @@
-
- © 2026 IV3JDV @ ARIFVG - | - - Gitea Home - - | - Rev: {{ git_commit }} - | - Sync: --:-- +
+ SYS_OP: IV3JDV @ ARIFVG + | + GITEA_REPO + | + REV: {{ git_commit }} + | + SYNC: --:--
TimeRepeaterModeYSF ModeSourceREF / SLOTCallsignTarget / TGDurationTIMEREPEATERMODEYSF_MODESOURCEREF/SLOTCALLSIGNTARGETDUR BER RSSI
- +
IDUserRoleNodesActions
IDUSRROLENODESCMD
@@ -218,112 +214,108 @@