feat: implementato nuovo layout Blueprint CAD

This commit is contained in:
2026-10-31 12:32:59 +01:00
parent 35f1598393
commit 2ed2ea58ea
4 changed files with 531 additions and 627 deletions
+125 -89
View File
@@ -1,36 +1,55 @@
/* --- TEMA MODERNO (Soft UI / Tailwind inspired) --- */ /* --- TEMA SCHEMATIC / BLUEPRINT (Disegno Tecnico CAD) --- */
:root { :root {
--primary: #3b82f6; --success: #10b981; --danger: #ef4444; --accent: #8b5cf6; --bg-base: #06246f;
--bg-gradient: #0f172a; --grid-color: rgba(123, 198, 255, 0.15);
--card-bg: #1e293b;
--border-color: rgba(255, 255, 255, 0.1); --border-main: #7bc6ff;
--text-main: #f8fafc; --border-light: rgba(123, 198, 255, 0.4);
--text-muted: #94a3b8;
--topbar-bg: #1e293b; --primary: #7bc6ff;
--success: #00ffcc;
--danger: #ff3366;
--accent: #ffcc00;
--text-main: #ffffff;
--text-muted: rgba(255, 255, 255, 0.6);
} }
* { box-sizing: border-box; } * { 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 */
#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); } #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; }
.title-brand { font-size: 1.2rem; font-weight: 800; letter-spacing: 2px; color: var(--text-main); font-family: 'JetBrains Mono', monospace; } /* 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-tabs { display: flex; gap: 15px; margin-left: 30px; flex: 1; flex-wrap: wrap; justify-content: flex-start;}
.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 { 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); background: rgba(255,255,255,0.05); } .nav-tab:hover { color: var(--text-main); border: 1px solid var(--border-light); }
.nav-tab.active { color: var(--primary); background: rgba(59, 130, 246, 0.1); } .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 { 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 { color: var(--text-main); border-color: var(--text-main); } .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 */ /* 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-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 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 { 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 { background: rgba(255,255,255,0.05); color: var(--text-main); } .filter-pill:hover { border-style: solid; border-color: var(--border-main); color: var(--text-main); }
.filter-pill.active { background: rgba(59, 130, 246, 0.15); color: var(--primary); border-color: var(--primary); } .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: #f59e0b; border-color: rgba(245, 158, 11, 0.3); } .filter-pill.pill-warn { color: var(--accent); border-color: rgba(255, 204, 0, 0.4); }
.filter-pill.pill-warn.active { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #f59e0b; } .filter-pill.pill-warn.active { background: rgba(255, 204, 0, 0.15); border: 1px solid var(--accent); color: var(--accent); }
/* GRIGLIA E LISTA */ /* 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; } .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 .node-meta { margin-bottom: 0; text-align: left; }
.list-view .admin-dropdown { width: auto; flex: 0 0 auto; } .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 */ /* 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; } .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.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; line-height: 1.2; padding-top: 2px; } .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%; } .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; } /* DATI STRUTTURALI */
.health-bar > span { background: rgba(255,255,255,0.03); padding: 6px; border-radius: 6px; } .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-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: #f87171; } .freq-rx { color: #4ade80; } .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-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: 700; } .seen-item b { font-weight: 400; }
.seen-item.ok b { color: var(--success); } .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; } .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; } .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;}
.type-repeater { background: rgba(59, 130, 246, 0.15); color: var(--primary); border: 1px solid var(--primary); } .card.online .status-display { color: var(--success); border-color: var(--success); }
.type-hotspot { background: rgba(139, 92, 246, 0.15); color: var(--accent); border: 1px solid var(--accent); } .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); } .gateway-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 15px; justify-content: flex-start; min-height: 20px;}
.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; }
.ts-container { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; } .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; } .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 { 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 { filter: brightness(1.2); } .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; } 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-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: rgba(16, 185, 129, 0.1); color: var(--success); border-color: var(--success); } .mqtt-online { background: transparent; 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-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); } .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: #0f172a; border-bottom: 2px solid var(--primary); } 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; } 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, td { padding: 12px 16px; border-bottom: 1px solid var(--border-light); 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); } th { text-transform: uppercase; font-size: 0.75rem; }
tbody tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.015); } 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); } } @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-left: 4px solid var(--pulse-color, var(--primary)) !important; } .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; } .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-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 { 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 { border-color: var(--text-main); background: rgba(255,255,255,0.1); } .auth-btn:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
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, 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: var(--primary); } input:focus, select:focus { border-color: #fff; border-style: solid; }
input:disabled { opacity: 0.5; cursor: not-allowed; } 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 { 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 { transform: translateY(-4px); box-shadow: 0 8px 15px rgba(0,0,0,0.3); } .mini-card:hover { background: rgba(123, 198, 255, 0.15); border-color: #fff; }
.mini-card-content { width: 100%; overflow: hidden; } .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-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: 800; padding: 4px 6px; border-radius: 6px; width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .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 --- */ /* --- 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); } #map-container { max-width: 1400px; height: calc(100vh - 200px); min-height: 550px; margin: 0 auto; border: 1px solid var(--border-main); overflow: hidden; }
.dark-tiles { filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7); } /* Filtro CAD per la mappa */
.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; } .dark-tiles { filter: invert(1) sepia(1) hue-rotate(180deg) saturate(3) brightness(0.8) contrast(1.2); }
.pin-online { background: var(--success); border-color: rgba(255,255,255,0.8); } .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-offline { background: #64748b; border-color: rgba(255,255,255,0.3); opacity: 0.7; } .pin-online { border-color: var(--success); color: var(--success); }
.pin-warn { background: #f59e0b !important; border-color: #fbbf24 !important; animation: danger-glow 2s infinite !important; } .pin-offline { border-color: var(--text-muted); color: var(--text-muted); border-style: dashed; }
.pin-tx { background: var(--primary) !important; animation: soft-glow 1.5s infinite !important; transform: scale(1.15); } .pin-warn { border-color: var(--accent) !important; color: var(--accent) !important; }
.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; } .pin-tx { border-color: var(--primary) !important; color: var(--primary) !important; box-shadow: inset 0 0 8px var(--primary); border-width: 2px; }
.leaflet-popup-tip { background: var(--card-bg) !important; } .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) { @media (max-width: 768px) {
#top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; } #top-bar-container { top: 0; padding: 10px; margin-bottom: 15px; border-bottom: 1px solid var(--border-main); }
#top-bar { flex-direction: column; padding: 15px; gap: 12px; border-radius: 12px; } #top-bar { padding: 15px; gap: 12px; }
.title-brand { font-size: 1.1rem; text-align: center; width: 100%; } .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; } .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 solid var(--border-color); } #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-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; } .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-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.95rem; padding: 10px; flex: 1; text-align: center; border-radius: 0; } .nav-tab { font-size: 0.85rem; padding: 10px; flex: 1; text-align: center; }
body { padding-bottom: 70px; } body { padding-bottom: 70px; }
.filter-bar { flex-direction: column; } .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; } .list-view .card { flex-direction: column; align-items: stretch; clip-path: none;}
#map-container { height: calc(100vh - 220px); min-height: 400px; margin: 0 10px; } #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; }
} }
+145 -296
View File
@@ -71,10 +71,10 @@ function applyViewMode() {
const btnToggle = document.getElementById('view-toggle-btn'); const btnToggle = document.getElementById('view-toggle-btn');
if (viewMode === 'list') { if (viewMode === 'list') {
gridDiv.className = 'list-view'; gridDiv.className = 'list-view';
btnToggle.innerText = '📄 LIST'; btnToggle.innerText = '[ LIST ]';
} else { } else {
gridDiv.className = 'grid'; gridDiv.className = 'grid';
btnToggle.innerText = '🔲 GRID'; btnToggle.innerText = '[ GRID ]';
} }
} }
@@ -119,7 +119,7 @@ function fmtAge(sec) {
function seenItem(label, age, tip, warn) { function seenItem(label, age, tip, warn) {
const cls = warn ? 'warn' : (age !== undefined && age < 300 ? 'ok' : 'idle'); const cls = warn ? 'warn' : (age !== undefined && age < 300 ? 'ok' : 'idle');
const txt = age === undefined ? '—' : fmtAge(age); const txt = age === undefined ? '—' : fmtAge(age);
return `<span class="seen-item ${cls}" title="${esc(tip)}">${warn ? '⚠ ' : ''}${label} <b>${txt}</b></span>`; return `<span class="seen-item ${cls}" title="${esc(tip)}">${warn ? '[!] ' : ''}${label} <b>${txt}</b></span>`;
} }
function renderSeen(c, data, isOnline) { function renderSeen(c, data, isOnline) {
@@ -131,23 +131,17 @@ function renderSeen(c, data, isOnline) {
let html = ''; let html = '';
const warnM = ages.mmdvm === undefined && isOnline && upSec > 600; 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.` const tipM = it ? `Topic mmdvm/${c.id}/json` : `Topic mmdvm/${c.id}/json`;
: `Last event from topic mmdvm/${c.id}/json (TX, mode change...). It can be a long time on a quiet node.`; html += seenItem('MMDVM', ages.mmdvm, tipM, warnM);
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);
if (ages.gateway !== undefined) { 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 hObj = (data.health && data.health[c.id.toLowerCase()]) || {};
const iv = Number(hObj.interval) > 0 ? Number(hObj.interval) : 60; 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 warnA = isOnline && (ages.health === undefined ? upSec > Math.max(300, iv * 5) : ages.health > Math.max(180, iv * 3));
const tipA = warnA html += seenItem('AGENT', ages.health, 'Agent Status', warnA);
? (it ? 'L\'agent del nodo non invia più lo stato (devices/<id>/services): connessione bloccata?' : 'The node agent stopped sending its status (devices/<id>/services): stuck connection?')
: (it ? 'Ultimo stato ricevuto dall\'agent del nodo (devices/<id>/services)' : 'Last status received from the node agent (devices/<id>/services)');
html += seenItem('AGENT', ages.health, tipA, warnA);
div.innerHTML = html; div.innerHTML = html;
div.style.display = 'flex'; div.style.display = 'flex';
@@ -169,16 +163,16 @@ function sendCommand(clientId, type, customTitle, customMsg, customColor) {
function confirmSwitch(id, mode) { function confirmSwitch(id, mode) {
const data = globalHealthData[id.toLowerCase()]; 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]; if (data && data.profiles && data.profiles[mode]) profileName = data.profiles[mode];
const title = `🔄 ${t('titleSwitch')}`; const title = `🔄 ${t('titleSwitch')}`;
const msg = `${t('confSwitch')} <b>${esc(profileName)}</b> -> <b>${id.toUpperCase()}</b>?`; const msg = `${t('confSwitch')} <b>${esc(profileName)}</b> -> <b>${id.toUpperCase()}</b>?`;
const color = mode === 'A' ? "var(--accent)" : "#eab308"; const color = mode === 'A' ? "var(--accent)" : "var(--primary)";
sendCommand(id, mode, title, msg, color); sendCommand(id, mode, title, msg, color);
} }
function confirmReboot(id) { sendCommand(id, 'REBOOT', `🔄 ${t('titleBoot')}`, `${t('confBoot')}<b>${id.toUpperCase()}</b>?`, "var(--danger)"); } function confirmReboot(id) { sendCommand(id, 'REBOOT', `🔄 ${t('titleBoot')}`, `${t('confBoot')}<b>${id.toUpperCase()}</b>?`, "var(--danger)"); }
function confirmUpdateAgent(id) { sendCommand(id, 'UPDATE_AGENT', `⬇️ UPDATE OTA`, `Confermi l'aggiornamento dello script tramite git pull sul nodo <b>${id.toUpperCase()}</b>?`, "#2563eb"); } function confirmUpdateAgent(id) { sendCommand(id, 'UPDATE_AGENT', `⬇️ UPDATE OTA`, `Confermi l'aggiornamento dello script tramite git pull sul nodo <b>${id.toUpperCase()}</b>?`, "var(--primary)"); }
function sendTgCommand(clientId, comando) { function sendTgCommand(clientId, comando) {
const msg = (comando === 'TG:ON') ? t('confTgOn') : t('confTgOff'); const msg = (comando === 'TG:ON') ? t('confTgOn') : t('confTgOff');
@@ -204,7 +198,7 @@ async function initUI() {
const statSelect = document.getElementById('stat-node-filter'); const statSelect = document.getElementById('stat-node-filter');
if (statSelect) { if (statSelect) {
let opts = `<option value="all">🌐 ${t('statAllNodes')}</option>`; let opts = `<option value="all">ALL_NODES</option>`;
clients.forEach(c => { opts += `<option value="${c.id}">${esc(c.name)} (${c.id.toUpperCase()})</option>`; }); clients.forEach(c => { opts += `<option value="${c.id}">${esc(c.name)} (${c.id.toUpperCase()})</option>`; });
statSelect.innerHTML = opts; statSelect.innerHTML = opts;
} }
@@ -212,7 +206,6 @@ async function initUI() {
const limitSel = document.getElementById('log-limit-select'); const limitSel = document.getElementById('log-limit-select');
if (limitSel) { if (limitSel) {
limitSel.value = localStorage.getItem('fleetLogLimit') || '60'; limitSel.value = localStorage.getItem('fleetLogLimit') || '60';
} }
const grid = document.getElementById('client-grid'); const grid = document.getElementById('client-grid');
const authContainer = document.getElementById('auth-container'); const authContainer = document.getElementById('auth-container');
@@ -221,17 +214,17 @@ async function initUI() {
if (isAuthenticated) { if (isAuthenticated) {
let adminBtn = role === 'admin' ? ` let adminBtn = role === 'admin' ? `
<button id="server-update-btn" onclick="confirmServerUpdate()" class="auth-btn" style="background:var(--danger); color:white !important; display:none; border: 2px solid white; animation: pulse-red 1.5s infinite;" title="Aggiornamento Server Disponibile">🔄 UPDATE SERVER</button> <button id="server-update-btn" onclick="confirmServerUpdate()" class="auth-btn" style="border-color:var(--danger); color:var(--danger) !important; display:none;" title="Aggiornamento Server Disponibile">[ UPD_SERVER ]</button>
<button onclick="sendGlobalUpdate()" class="auth-btn" style="background:#f59e0b; color:white;" data-i18n-title="ttReqCfg" title="${t('ttReqCfg')}">${t('btnReqCfg')}</button> <button onclick="sendGlobalUpdate()" class="auth-btn" style="color:var(--accent);" data-i18n-title="ttReqCfg" title="${t('ttReqCfg')}">[ ${t('btnReqCfg')} ]</button>
<button onclick="triggerGlobalEmergency()" class="auth-btn" style="background:#ef4444; color:white;" data-i18n-title="ttGlobal" title="${t('ttGlobal')}">${t('btnGlobal')}</button> <button onclick="triggerGlobalEmergency()" class="auth-btn" style="color:var(--danger);" data-i18n-title="ttGlobal" title="${t('ttGlobal')}">[ ${t('btnGlobal')} ]</button>
<button onclick="openAdmin()" class="auth-btn" style="background:var(--accent); color:white;" data-i18n-title="ttAdmin" title="${t('ttAdmin')}">${t('btnAdmin')}</button>` : ''; <button onclick="openAdmin()" class="auth-btn" style="color:var(--primary);" data-i18n-title="ttAdmin" title="${t('ttAdmin')}">[ ${t('btnAdmin')} ]</button>` : '';
authContainer.innerHTML = `${adminBtn} authContainer.innerHTML = `${adminBtn}
<span style="font-weight:800; font-size:0.9rem; margin: 0 10px;">👤 ${esc(String(me.user).toUpperCase())}</span> <span style="font-weight:300; font-size:0.85rem; margin: 0 10px; font-family:'JetBrains Mono', monospace; color:var(--primary);">USR: ${esc(String(me.user).toUpperCase())}</span>
<button onclick="changeMyPassword()" class="auth-btn" style="background:#64748b; color:white;" data-i18n-title="ttPass" title="${t('ttPass')}">${t('btnPass')}</button> <button onclick="changeMyPassword()" class="auth-btn" data-i18n-title="ttPass" title="${t('ttPass')}">[ ${t('btnPass')} ]</button>
<button onclick="logout()" class="auth-btn" style="background:var(--text-main); color:var(--card-bg);" data-i18n-title="ttLogout" title="${t('ttLogout')}">${t('btnLogout')}</button>`; <button onclick="logout()" class="auth-btn" data-i18n-title="ttLogout" title="${t('ttLogout')}">[ ${t('btnLogout')} ]</button>`;
} else { } else {
authContainer.innerHTML = `<button onclick="openLoginModal()" class="auth-btn" style="background:var(--primary); color:white; padding: 8px 25px;">LOGIN</button>`; authContainer.innerHTML = `<button onclick="openLoginModal()" class="auth-btn" style="color:var(--success);">[ AUTH ]</button>`;
} }
grid.innerHTML = clients.map(c => { grid.innerHTML = clients.map(c => {
@@ -243,8 +236,8 @@ async function initUI() {
<div class="card-header"> <div class="card-header">
<span class="client-name" title="${esc(c.name)}">${esc(c.name)}</span> <span class="client-name" title="${esc(c.name)}">${esc(c.name)}</span>
<div class="header-badges"> <div class="header-badges">
<span class="badge-id">ID: ${c.id.toUpperCase()}</span> <span class="badge-id">NET-ID: ${c.id.toUpperCase()}</span>
<span class="badge-id" id="agent-badge-${c.id}" style="display: none; color: #38bdf8; background: rgba(56, 189, 248, 0.1);"></span> <span class="badge-id" id="agent-badge-${c.id}" style="display: none; color: var(--primary);"></span>
<div id="type-badge-${c.id}" class="type-badge" style="display: none;"></div> <div id="type-badge-${c.id}" class="type-badge" style="display: none;"></div>
</div> </div>
</div> </div>
@@ -252,57 +245,57 @@ async function initUI() {
<div class="gateway-bar" id="gw-bar-${c.id}"></div> <div class="gateway-bar" id="gw-bar-${c.id}"></div>
<div class="freq-bar" id="freq-container-${c.id}" style="display: none;"> <div class="freq-bar" id="freq-container-${c.id}" style="display: none;">
<span><span class="freq-tx">TX:</span> <span id="freq-tx-${c.id}">...</span></span> <span>TX: <span class="freq-tx" id="freq-tx-${c.id}">...</span></span>
<span><span class="freq-rx">RX:</span> <span id="freq-rx-${c.id}">...</span></span> <span>RX: <span class="freq-rx" id="freq-rx-${c.id}">...</span></span>
</div> </div>
<div class="node-meta" id="meta-container-${c.id}" style="display: none;"> <div class="node-meta" id="meta-container-${c.id}" style="display: none;">
<span class="node-meta-item">📍 <strong id="loc-${c.id}">...</strong></span> <span class="node-meta-item">LOC: <strong id="loc-${c.id}">...</strong></span>
<span class="node-meta-item" style="margin-top: 4px; color: var(--text-muted);">Lat: <span id="lat-${c.id}">...</span> | Lon: <span id="lon-${c.id}">...</span></span> <span class="node-meta-item" style="color: var(--text-muted);">LAT: <span id="lat-${c.id}">...</span> | LON: <span id="lon-${c.id}">...</span></span>
</div> </div>
<div class="health-bar" id="health-${c.id}" style="display: none;"> <div class="health-bar" id="health-${c.id}" style="display: none;">
<span>⚡ <span id="cpu-${c.id}">--</span>%</span> <span>PWR: <span id="cpu-${c.id}">--</span>%</span>
<span>🌡️ <span id="temp-${c.id}">--</span>°C</span> <span>TMP: <span id="temp-${c.id}">--</span>°C</span>
<span>🧠 <span id="ram-${c.id}">--</span>%</span> <span>MEM: <span id="ram-${c.id}">--</span>%</span>
<span>💾 <span id="disk-${c.id}">--</span>%</span> <span>DSK: <span id="disk-${c.id}">--</span>%</span>
<span style="grid-column: span 2;" title="System Uptime">⏱️ <span id="up-${c.id}">--</span></span> <span style="grid-column: span 2;" title="System Uptime">UPT: <span id="up-${c.id}">--</span></span>
</div> </div>
<div class="seen-bar" id="seen-${c.id}" style="display: none;"></div> <div class="seen-bar" id="seen-${c.id}" style="display: none;"></div>
<div class="status-display" id="status-${c.id}">Offline</div> <div class="status-display" id="status-${c.id}">OFFLINE</div>
<div id="diag-warn-${c.id}" class="blink" style="display: none; background: rgba(245, 158, 11, 0.15); border: 1px solid #f59e0b; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 0.8rem; font-weight: bold; color: #fbbf24; line-height: 1.5; text-align: center;"></div> <div id="diag-warn-${c.id}" class="blink" style="display: none; border: 1px dashed var(--accent); padding: 8px 12px; margin-bottom: 12px; font-size: 0.8rem; font-weight: bold; color: var(--accent); line-height: 1.5; text-align: center;"></div>
<div id="ts-container-${c.id}" class="ts-container"> <div id="ts-container-${c.id}" class="ts-container">
<div class="dmr-info" id="dmr-ts1-${c.id}">TS1: ...</div> <div class="dmr-info" id="dmr-ts1-${c.id}">TS1: ...</div>
<div class="dmr-info" id="dmr-ts2-${c.id}">TS2: ...</div> <div class="dmr-info" id="dmr-ts2-${c.id}">TS2: ...</div>
</div> </div>
<div class="dmr-info" id="dmr-alt-${c.id}" style="display: none; text-align: center; font-weight: 800;"></div> <div class="dmr-info" id="dmr-alt-${c.id}" style="display: none; text-align: center; font-weight: 400;"></div>
<div class="terminal-log" id="sys-log-${c.id}">${t('waitNet')}</div> <div class="terminal-log" id="sys-log-${c.id}">${t('waitNet')}</div>
<div id="svc-warn-${c.id}" class="blink" style="display: none; text-align: center; margin-bottom: 15px; border-radius: 8px; padding: 10px;"> <div id="svc-warn-${c.id}" class="blink" style="display: none; text-align: center; margin-bottom: 15px; border: 1px dashed var(--danger); padding: 10px; color: var(--danger);">
<span style="font-size: 0.85rem;" data-i18n="warnDaemon">${t('warnDaemon')}</span> <span style="font-size: 0.85rem; font-family: 'JetBrains Mono';" data-i18n="warnDaemon">${t('warnDaemon')}</span>
</div> </div>
${canControl ? ` ${canControl ? `
<div id="prof-btns-${c.id}" style="width: 100%; gap: 10px; display: none; margin-bottom: 8px;"></div> <div id="prof-btns-${c.id}" style="width: 100%; gap: 10px; display: none; margin-bottom: 8px;"></div>
<div style="width: 100%; display: flex; gap: 10px; margin-bottom: 8px;"> <div style="width: 100%; display: flex; gap: 10px; margin-bottom: 8px;">
<button class="btn-cmd" style="background: rgba(255, 255, 255, 0.05); color: var(--text-main) !important;" title="${t('ttTgOn')}" onclick="sendTgCommand('${c.id}', 'TG:ON')">🔔 TG ON</button> <button class="btn-cmd" title="${t('ttTgOn')}" onclick="sendTgCommand('${c.id}', 'TG:ON')">[ TG_ON ]</button>
<button class="btn-cmd" style="background: rgba(255, 255, 255, 0.05); color: var(--text-main) !important;" title="${t('ttTgOff')}" onclick="sendTgCommand('${c.id}', 'TG:OFF')">🔇 TG OFF</button> <button class="btn-cmd" title="${t('ttTgOff')}" onclick="sendTgCommand('${c.id}', 'TG:OFF')">[ TG_OFF ]</button>
</div> </div>
` : ''} ` : ''}
${showReboot ? ` ${showReboot ? `
<details class="admin-dropdown" style="width: 100%;"> <details class="admin-dropdown" style="width: 100%;">
<summary id="admin-summary-${c.id}" class="btn-cmd" style="background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--text-muted) !important;">⚙️ Admin Tools</summary> <summary id="admin-summary-${c.id}" class="btn-cmd" style="color: var(--text-muted) !important;">[ SYS_TOOLS ]</summary>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px;"> <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px;">
<button class="btn-cmd" style="background: var(--primary); border: none; color: white !important;" title="Versioni Software" onclick="openVersionsModal('${c.id}')">ℹ️ INFO</button> <button class="btn-cmd" style="border-color: var(--primary); color: var(--primary) !important;" title="Versioni Software" onclick="openVersionsModal('${c.id}')">INFO</button>
<button id="btn-svc-${c.id}" class="btn-cmd" style="background: #334155; border: none; color: white !important;" title="${t('ttSvc')}" onclick="openServicesModal('${c.id}')">${t('btnSvc')}</button> <button id="btn-svc-${c.id}" class="btn-cmd" style="border-color: var(--text-main);" title="${t('ttSvc')}" onclick="openServicesModal('${c.id}')">${t('btnSvc')}</button>
<button class="btn-cmd" style="background: var(--accent); border: none; color: white !important;" title="${t('ttFile')}" onclick="openConfigsModal('${c.id}')">${t('btnFile')}</button> <button class="btn-cmd" style="border-color: var(--accent); color: var(--accent) !important;" title="${t('ttFile')}" onclick="openConfigsModal('${c.id}')">${t('btnFile')}</button>
<button class="btn-cmd" style="background: #ea580c; border: none; color: white !important;" title="${t('ttHat')}" onclick="confirmHatReset('${c.id}')">${t('btnHat')}</button> <button class="btn-cmd" style="border-color: var(--danger); color: var(--danger) !important;" title="${t('ttHat')}" onclick="confirmHatReset('${c.id}')">${t('btnHat')}</button>
<button class="btn-cmd" style="background: var(--danger); border: none; color: white !important;" title="${t('ttBoot')}" onclick="confirmReboot('${c.id}')">${t('btnBoot')}</button> <button class="btn-cmd" style="border-color: var(--danger); color: var(--danger) !important;" title="${t('ttBoot')}" onclick="confirmReboot('${c.id}')">${t('btnBoot')}</button>
<button id="btn-ota-${c.id}" class="btn-cmd" style="background: #2563eb; border: none; color: white !important;" title="Update OTA" onclick="confirmUpdateAgent('${c.id}')">⬇️ OTA</button> <button id="btn-ota-${c.id}" class="btn-cmd" style="border-color: var(--primary); color: var(--primary) !important;" title="Update OTA" onclick="confirmUpdateAgent('${c.id}')">OTA</button>
</div> </div>
</details> </details>
` : ''} ` : ''}
@@ -317,7 +310,7 @@ async function initUI() {
<div id="mini-name-${c.id}" class="mini-card-name" title="${esc(c.name)}">${esc(c.name)}</div> <div id="mini-name-${c.id}" class="mini-card-name" title="${esc(c.name)}">${esc(c.name)}</div>
<div id="mini-id-${c.id}" style="font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">ID: ${c.id.toUpperCase()}</div> <div id="mini-id-${c.id}" style="font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">ID: ${c.id.toUpperCase()}</div>
</div> </div>
<div id="mini-status-${c.id}" class="mini-card-status" style="color: var(--danger); background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2);" title="OFFLINE">OFFLINE</div> <div id="mini-status-${c.id}" class="mini-card-status" title="OFFLINE">OFFLINE</div>
</div> </div>
`).join(''); `).join('');
} }
@@ -343,7 +336,7 @@ function initOrUpdateMap() {
if (!fleetMap) { if (!fleetMap) {
fleetMap = L.map('map-container').setView([46.06, 13.23], 9); fleetMap = L.map('map-container').setView([46.06, 13.23], 9);
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', { L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap France | &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', attribution: '&copy; OpenStreetMap France',
maxZoom: 19, maxZoom: 19,
className: 'dark-tiles' className: 'dark-tiles'
}).addTo(fleetMap); }).addTo(fleetMap);
@@ -373,33 +366,33 @@ function initOrUpdateMap() {
let pinClass = isOnline ? (warns.length > 0 ? 'pin-warn' : 'pin-online') : 'pin-offline'; let pinClass = isOnline ? (warns.length > 0 ? 'pin-warn' : 'pin-online') : 'pin-offline';
if (isTx) pinClass += ' pin-tx'; if (isTx) pinClass += ' pin-tx';
let iconSymbol = (gen && gen.duplex === "0") ? "📻" : "📡"; let iconSymbol = "+";
if (warns.length > 0 && !isTx) iconSymbol = "⚠️"; if (warns.length > 0 && !isTx) iconSymbol = "!";
const customIcon = L.divIcon({ const customIcon = L.divIcon({
className: 'custom-div-icon', className: 'custom-div-icon',
html: `<div class="custom-map-pin ${pinClass}" style="width: 32px; height: 32px;">${iconSymbol}</div>`, html: `<div class="custom-map-pin ${pinClass}" style="width: 24px; height: 24px;">${iconSymbol}</div>`,
iconSize: [32, 32], iconSize: [24, 24],
iconAnchor: [16, 16] iconAnchor: [12, 12]
}); });
const call = (gen && gen.callsign) ? gen.callsign : c.name; const call = (gen && gen.callsign) ? gen.callsign : c.name;
const warnsHtml = warns.length > 0 ? ` const warnsHtml = warns.length > 0 ? `
<div style="background: rgba(245, 158, 11, 0.2); border-left: 3px solid #f59e0b; padding: 4px 8px; margin-bottom: 8px; font-size: 0.75rem; color: #fbbf24; font-weight: bold; border-radius: 4px;"> <div style="border: 1px dashed var(--accent); padding: 4px 8px; margin-bottom: 8px; font-size: 0.75rem; color: var(--accent); font-weight: bold;">
${warns.map(w => esc(w)).join('<br>')} ${warns.map(w => esc(w)).join('<br>')}
</div> </div>
` : ''; ` : '';
const popupContent = ` const popupContent = `
<div style="font-family: 'Inter', sans-serif; min-width: 190px;"> <div style="font-family: 'JetBrains Mono', monospace; min-width: 190px;">
<div style="font-weight: 800; font-size: 1.1rem; color: var(--primary); margin-bottom: 4px;">${esc(call)}</div> <div style="font-weight: 400; font-size: 1.1rem; color: var(--primary); margin-bottom: 4px;">${esc(call)}</div>
<div style="font-size: 0.75rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; margin-bottom: 8px;">ID: ${c.id.toUpperCase()} | ${isOnline ? '<span style="color:var(--success); font-weight:bold;">ONLINE</span>' : '<span style="color:var(--danger); font-weight:bold;">OFFLINE</span>'}</div> <div style="font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; border-bottom: 1px dashed var(--border-main); padding-bottom: 4px;">ID: ${c.id.toUpperCase()} | ${isOnline ? '<span style="color:var(--success);">ONLINE</span>' : '<span style="color:var(--danger);">OFFLINE</span>'}</div>
${warnsHtml} ${warnsHtml}
<div style="font-size: 0.8rem; margin-bottom: 4px;">📍 <strong>${esc(info.loc)}</strong></div> <div style="font-size: 0.8rem; margin-bottom: 4px; color:var(--text-main);">LOC: <strong>${esc(info.loc)}</strong></div>
<div style="font-size: 0.8rem; font-family: 'JetBrains Mono', monospace; color: #f87171;">TX: ${esc(info.tx)}</div> <div style="font-size: 0.8rem; color: var(--danger);">TX: ${esc(info.tx)}</div>
<div style="font-size: 0.8rem; font-family: 'JetBrains Mono', monospace; color: #4ade80; margin-bottom: 6px;">RX: ${esc(info.rx)}</div> <div style="font-size: 0.8rem; color: var(--success); margin-bottom: 6px;">RX: ${esc(info.rx)}</div>
${health ? `<div style="font-size: 0.75rem; margin-bottom: 8px; color: var(--text-muted);">🌡️ Temp: <b>${health.temp}°C</b> | CPU: <b>${health.cpu}%</b></div>` : ''} ${health ? `<div style="font-size: 0.75rem; margin-bottom: 8px; color: var(--border-main);">TMP: <b>${health.temp}°C</b> | CPU: <b>${health.cpu}%</b></div>` : ''}
<button onclick="switchView('nodes'); setTimeout(()=>document.getElementById('card-${c.id}').scrollIntoView({behavior:'smooth', block: 'center'}), 200);" class="btn-cmd" style="background: var(--primary); border:none; width: 100%; padding: 6px; color: white !important;">🔍 Apri Scheda</button> <button onclick="switchView('nodes'); setTimeout(()=>document.getElementById('card-${c.id}').scrollIntoView({behavior:'smooth', block: 'center'}), 200);" class="btn-cmd" style="width: 100%; margin-top:5px;">[ FOCUS_NODE ]</button>
</div> </div>
`; `;
@@ -442,7 +435,7 @@ async function refreshStates() {
if (diagDiv) { if (diagDiv) {
if (warns.length > 0 && isOnline) { if (warns.length > 0 && isOnline) {
diagDiv.style.display = 'block'; diagDiv.style.display = 'block';
diagDiv.innerHTML = warns.map(w => `<div>${esc(w)}</div>`).join(''); diagDiv.innerHTML = warns.map(w => `<div>[!] ${esc(w)}</div>`).join('');
} else { } else {
diagDiv.style.display = 'none'; diagDiv.style.display = 'none';
diagDiv.innerHTML = ''; diagDiv.innerHTML = '';
@@ -455,19 +448,16 @@ async function refreshStates() {
const typeBadge = document.getElementById(`type-badge-${c.id}`); const typeBadge = document.getElementById(`type-badge-${c.id}`);
if (genObj && isOnline) { if (genObj && isOnline) {
nameSpan.innerText = genObj.callsign; nameSpan.innerHTML = `${esc(genObj.callsign)}`;
idBadge.innerText = `ID: ${genObj.radio_id}`; idBadge.innerText = `NET-ID: ${genObj.radio_id}`;
idBadge.style.background = "var(--primary)"; idBadge.style.color = "#ffffff"; idBadge.style.borderColor = "var(--primary)";
if (typeBadge && genObj.duplex !== undefined) { if (typeBadge && genObj.duplex !== undefined) {
typeBadge.style.display = 'inline-block'; typeBadge.style.display = 'inline-block';
if (genObj.duplex === "1") { typeBadge.innerText = "REPEATER"; typeBadge.className = "type-badge type-repeater"; } if (genObj.duplex === "1") { typeBadge.innerText = "RPT"; typeBadge.className = "type-badge type-repeater"; }
else { typeBadge.innerText = "HOTSPOT"; typeBadge.className = "type-badge type-hotspot"; } else { typeBadge.innerText = "HST"; typeBadge.className = "type-badge type-hotspot"; }
} }
} else { } else {
nameSpan.innerText = c.name; nameSpan.innerHTML = `${esc(c.name)}`;
idBadge.innerText = `ID: ${c.id.toUpperCase()}`; idBadge.innerText = `NET-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)";
if (typeBadge) typeBadge.style.display = 'none'; if (typeBadge) typeBadge.style.display = 'none';
} }
@@ -475,18 +465,16 @@ async function refreshStates() {
if (typeof telemetryObj === 'string') telemetryObj = { ts1: telemetryObj, ts2: "...", alt: "", idle: true }; 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}`); 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; let isTx = false; let activeModeColor = "var(--success)"; let isIdle = telemetryObj.idle === true;
if (telemetryObj.alt && telemetryObj.alt !== "") { if (telemetryObj.alt && telemetryObj.alt !== "") {
if (tsContainer) tsContainer.style.display = "none"; if (tsContainer) tsContainer.style.display = "none";
if (altDiv) { if (altDiv) {
altDiv.style.display = "block"; altDiv.innerText = telemetryObj.alt; let altText = telemetryObj.alt.toUpperCase(); altDiv.style.display = "block"; altDiv.innerText = telemetryObj.alt; let altText = telemetryObj.alt.toUpperCase();
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)";
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";
isTx = altText.includes("🟢") || altText.includes("🟣") || altText.includes("🔵") || altText.includes("🟠"); isTx = altText.includes("🟢") || altText.includes("🟣") || altText.includes("🔵") || altText.includes("🟠");
altDiv.style.setProperty('--pulse-color', activeModeColor); if (isTx) { altDiv.style.color = activeModeColor; altDiv.style.borderColor = 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'); } else { altDiv.style.color = "var(--text-muted)"; altDiv.style.borderColor = "var(--border-light)"; }
} }
} else { } else {
if (altDiv) altDiv.style.display = "none"; if (altDiv) altDiv.style.display = "none";
@@ -498,11 +486,9 @@ async function refreshStates() {
[ts1Div, ts2Div].forEach((div, idx) => { [ts1Div, ts2Div].forEach((div, idx) => {
if (isSimplex && idx === 0) return; if (isSimplex && idx === 0) return;
const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? ''); const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? '');
const fullLabel = `TS${idx + 1}`; div.innerText = `TS${idx + 1}: ${val}`;
div.innerText = `${fullLabel}: ${val}`; if (val.includes("🎙️") || val.includes("TX")) { isTx = true; div.style.color = activeModeColor; div.style.borderColor = activeModeColor; }
div.style.setProperty('--pulse-color', activeModeColor); else { div.style.color = "var(--text-muted)"; div.style.borderColor = "var(--border-light)"; }
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'); }
}); });
} }
} }
@@ -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 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}`); const gwBar = document.getElementById(`gw-bar-${c.id}`);
if (gwBar && healthObj) { if (gwBar && healthObj) {
let gwHtml = ""; 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 = "";
let gwData = data.gateway_states && data.gateway_states[c.id.toLowerCase()] ? data.gateway_states[c.id.toLowerCase()] : {}; 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' }];
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' }
];
if (isOnline) { if (isOnline) {
gwMap.forEach(gw => { gwMap.forEach(gw => {
let isActiveProc = processes[gw.id] && processes[gw.id].toLowerCase() === 'online'; let isActiveProc = processes[gw.id] && processes[gw.id].toLowerCase() === 'online';
if (isActiveProc) { if (isActiveProc) {
activeGatewaysStr += gw.proto.toLowerCase() + ","; activeGatewaysStr += gw.proto.toLowerCase() + ",";
let stateInfo = gwData[gw.proto] || { action: 'IDLE', 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 action = (stateInfo.action || 'IDLE').toLowerCase(); let badgeColor, badgeBorder, suffix = '';
let dest = stateInfo.dest && stateInfo.dest !== '---' && stateInfo.dest.toUpperCase() !== 'IDLE' ? stateInfo.dest : '';
let badgeBg, badgeColor, badgeBorder, suffix = '', extraClass = ''; 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}`; }
if (action === 'linking') { else if (action === 'failed') { badgeColor = 'var(--danger)'; badgeBorder = 'var(--danger)'; suffix = ' [ERR]'; }
badgeBg = gw.color; else if (action === 'unlinked') { badgeColor = 'var(--text-muted)'; badgeBorder = 'var(--border-light)'; suffix = ' [UNL]'; }
badgeColor = 'white'; else { badgeColor = gw.color; badgeBorder = gw.color; }
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 (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) { if (gw.proto === 'DMR' && gwData['DMR_NETS'] && gwData['DMR_NETS'].length > 0) {
gwData['DMR_NETS'].forEach(netName => { gwData['DMR_NETS'].forEach(netName => { let netSuffix = (action === 'linking') ? ' [LNK]' : (action === 'failed' ? ' [ERR]' : (dest && action !== 'status' ? `:${dest}` : '')); gwHtml += `<span style="font-size:0.65rem; font-family:'JetBrains Mono', monospace; font-weight:400; padding:2px 4px; border:1px dashed ${badgeBorder}; background:transparent; color:${badgeColor} !important; margin-right: 4px; display: inline-block;">DMR:${esc(netName)}${esc(netSuffix)}</span>`; });
let netSuffix = (action === 'linking') ? ' [LINKING]' : (action === 'failed' ? ' [FAILED]' : (dest && action !== 'status' ? `: ${dest}` : '')); } else { gwHtml += `<span style="font-size:0.65rem; font-family:'JetBrains Mono', monospace; font-weight:400; padding:2px 4px; border:1px dashed ${badgeBorder}; background:transparent; color:${badgeColor} !important; margin-right: 4px; display: inline-block;">${gw.label}${esc(suffix)}</span>`; }
let netText = `DMR: ${esc(netName)}${esc(netSuffix)}`;
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor} !important; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${netText}</span>`;
});
} else {
let text = `${gw.label}${esc(suffix)}`;
gwHtml += `<span class="${extraClass}" style="font-size: 0.65rem; font-family: 'JetBrains Mono', monospace; font-weight: 800; padding: 3px 6px; border-radius: 4px; border: 1px solid ${badgeBorder}; background: ${badgeBg}; color: ${badgeColor} !important; transition: all 0.3s ease;" title="Stato: ${action.toUpperCase()}">${text}</span>`;
}
} }
}); });
} }
cardDiv.dataset.gateways = activeGatewaysStr; cardDiv.dataset.gateways = activeGatewaysStr; gwBar.innerHTML = gwHtml;
gwBar.innerHTML = gwHtml; } else if (gwBar) { gwBar.innerHTML = ""; cardDiv.dataset.gateways = ""; }
} else if (gwBar) {
gwBar.innerHTML = "";
cardDiv.dataset.gateways = "";
}
if (healthObj && isOnline) { if (healthObj && isOnline) {
healthContainer.style.display = 'flex'; healthContainer.style.display = 'grid';
let cpu = healthObj.cpu; cpuSpan.innerText = cpu; cpuSpan.style.color = cpu < 50 ? 'var(--success)' : (cpu < 80 ? '#f59e0b' : 'var(--danger)'); cpuSpan.innerText = healthObj.cpu; tempSpan.innerText = healthObj.temp; ramSpan.innerText = healthObj.ram; diskSpan.innerText = healthObj.disk;
let tempVal = healthObj.temp; tempSpan.innerText = tempVal; tempSpan.style.color = tempVal < 55 ? 'var(--success)' : (tempVal < 70 ? '#f59e0b' : 'var(--danger)'); let upSpan = document.getElementById(`up-${c.id}`); if (upSpan && healthObj.uptime) { upSpan.innerText = fmtAge(healthObj.uptime); }
ramSpan.innerText = healthObj.ram; let d = healthObj.disk; diskSpan.innerText = d; diskSpan.style.color = d < 85 ? 'inherit' : (d < 95 ? '#f59e0b' : 'var(--danger)'); 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'; }
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'; }
const profBtnsDiv = document.getElementById(`prof-btns-${c.id}`); const profBtnsDiv = document.getElementById(`prof-btns-${c.id}`);
const profKeys = JSON.stringify(healthObj.profiles || {}); const profKeys = JSON.stringify(healthObj.profiles || {});
@@ -621,10 +556,10 @@ async function refreshStates() {
profBtnsDiv.dataset.keys = profKeys; profBtnsDiv.dataset.keys = profKeys;
if (healthObj.profiles && Object.keys(healthObj.profiles).length > 0) { if (healthObj.profiles && Object.keys(healthObj.profiles).length > 0) {
profBtnsDiv.style.display = 'flex'; 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)) { for (const [pKey, pLabel] of Object.entries(healthObj.profiles)) {
let col = colors[idx % colors.length]; let col = colors[idx % colors.length];
html += `<button class="btn-cmd" style="background: ${col}; flex: 1; border: none; color: white !important;" title="${esc(t('ttSwitchTo') + pLabel)}" onclick="confirmSwitch('${c.id}', ${q(pKey)})">${esc(pLabel)}</button>`; html += `<button class="btn-cmd" style="border-color: ${col}; color:${col} !important;" onclick="confirmSwitch('${c.id}', ${q(pKey)})">[ ${esc(pLabel)} ]</button>`;
idx++; idx++;
} }
profBtnsDiv.innerHTML = html; profBtnsDiv.innerHTML = html;
@@ -632,144 +567,71 @@ async function refreshStates() {
} }
} else { } else {
if (healthContainer) healthContainer.style.display = 'none'; if (healthContainer) healthContainer.style.display = 'none';
let agentBadge = document.getElementById(`agent-badge-${c.id}`); let agentBadge = document.getElementById(`agent-badge-${c.id}`); if (agentBadge) agentBadge.style.display = 'none';
if (agentBadge) agentBadge.style.display = 'none';
} }
globalHealthData[c.id.toLowerCase()] = healthObj; globalHealthData[c.id.toLowerCase()] = healthObj;
let hasOfflineService = false; let hasOfflineService = false;
if (healthObj && healthObj.processes) { if (healthObj && healthObj.processes) { for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) { if (svcStatus.toLowerCase() !== 'online') { hasOfflineService = true; break; } } }
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}`); 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 (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none';
if (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)'; } }
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'); }
}
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 (btnOta) {
if (healthObj && healthObj.agent_update_available) { if (healthObj && healthObj.agent_update_available) {
btnOta.style.setProperty('background', 'var(--danger)', 'important'); btnOta.style.setProperty('border-color', 'var(--danger)', 'important');
btnOta.style.setProperty('color', 'white', 'important'); btnOta.style.setProperty('color', 'var(--danger)', 'important');
btnOta.style.setProperty('border', '1px solid var(--danger)', 'important'); if (adminSummary) { adminSummary.innerHTML = "[ SYS_TOOLS (OTA!) ]"; adminSummary.style.color = "var(--danger)"; adminSummary.style.borderColor = "var(--danger)"; }
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';
}
} else { } else {
btnOta.style.setProperty('background', '#2563eb', 'important'); btnOta.style.setProperty('border-color', 'var(--primary)', 'important');
btnOta.style.setProperty('color', 'white', 'important'); btnOta.style.setProperty('color', 'var(--primary)', 'important');
btnOta.style.setProperty('border', '1px solid transparent', 'important'); if (adminSummary) { adminSummary.innerHTML = "[ SYS_TOOLS ]"; adminSummary.style.color = "var(--text-muted)"; adminSummary.style.borderColor = "var(--border-main)"; }
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';
}
} }
} }
if (isOnline) { 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(); if (isTx) cardDiv.dataset.lastTx = Date.now();
let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0); let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0);
let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS); let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS);
cardDiv.style.setProperty('border-top-color', showActiveColor ? activeModeColor : "var(--border-color)", 'important');
if(isTx) { if (showActiveColor) { cardDiv.style.borderColor = activeModeColor; }
let shadowRGB = '59, 130, 246'; else { cardDiv.style.borderColor = "var(--border-main)"; }
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'; }
} else { } else {
cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline'); cardDiv.style.opacity = "0.7"; cardDiv.style.filter = "grayscale(80%)"; cardDiv.classList.remove('online'); statusDiv.classList.add('status-offline');
cardDiv.style.setProperty('border-top-color', '#64748b', 'important'); cardDiv.style.boxShadow = 'none !important'; cardDiv.style.borderColor = "var(--border-light)";
} }
const miniCard = document.getElementById(`mini-card-${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}`);
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 (miniCard && miniStatus) {
if (genObj && isOnline) { if (genObj && isOnline) { if (miniName) miniName.innerText = genObj.callsign; if (miniId) miniId.innerText = `ID:${genObj.radio_id}`; }
if (miniName) miniName.innerText = genObj.callsign; else { if (miniName) miniName.innerText = c.name; if (miniId) miniId.innerText = `ID:${c.id.toUpperCase()}`; }
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) { if (isOnline) {
let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0); let timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0);
let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS); let showActiveColor = isTx || (!isIdle && timeSinceTx < HANG_TIME_MS);
miniCard.style.opacity = "1";
miniCard.style.filter = "none";
if (showActiveColor) { 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.borderColor = activeModeColor;
miniCard.style.boxShadow = `0 0 15px rgba(${shadowRGB}, 0.5)`; miniStatus.innerText = "( TX )"; miniStatus.title = "Transmitting..."; miniStatus.style.color = activeModeColor; miniStatus.style.borderColor = activeModeColor;
miniStatus.innerText = "🎙️ TX"; } else if (warns.length > 0) {
miniStatus.title = "Transmitting..."; miniCard.style.borderColor = "var(--accent)";
miniStatus.style.color = "#ffffff"; miniStatus.innerText = "(!) ALERT"; miniStatus.title = warns.join(" | "); miniStatus.style.color = "var(--accent)"; miniStatus.style.borderColor = "var(--accent)";
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)";
} else { } else {
miniCard.style.borderColor = "var(--success)"; miniCard.style.borderColor = "var(--border-main)";
miniCard.style.boxShadow = "none"; miniStatus.innerText = stateValue; miniStatus.title = stateValue; miniStatus.style.color = "var(--success)"; miniStatus.style.borderColor = "var(--border-light)";
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)";
} }
} else { } else {
miniCard.style.borderColor = "var(--border-color)"; miniCard.style.borderColor = "var(--border-light)";
miniCard.style.opacity = "0.6"; miniStatus.innerText = "OFFLINE"; miniStatus.title = "OFFLINE"; miniStatus.style.color = "var(--danger)"; miniStatus.style.borderColor = "var(--border-light)";
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)";
} }
} }
}); });
applyFilters(); applyFilters();
if (document.getElementById('view-map').style.display === 'block') { if (document.getElementById('view-map').style.display === 'block') { initOrUpdateMap(); }
initOrUpdateMap(); document.getElementById('last-update').innerText = "SYNC: " + new Date().toLocaleTimeString();
}
document.getElementById('last-update').innerText = "Sync: " + new Date().toLocaleTimeString();
} catch (e) { console.error(e); } } catch (e) { console.error(e); }
} }
@@ -797,50 +659,37 @@ async function refreshLogs() {
if (source_ext && source_ext.trim() !== "") { sourceHtml += ` <span style="font-size:0.8em; color:var(--text-muted); font-family:'JetBrains Mono', monospace;">/${esc(source_ext)}</span>`; } if (source_ext && source_ext.trim() !== "") { sourceHtml += ` <span style="font-size:0.8em; color:var(--text-muted); font-family:'JetBrains Mono', monospace;">/${esc(source_ext)}</span>`; }
let slotDisplay = rawSlot && String(rawSlot).trim() !== "" && rawSlot !== "undefined" ? (protocol === "DMR" && !String(rawSlot).toUpperCase().startsWith("TS") ? `TS${rawSlot}` : rawSlot) : "---"; 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' ? '<span style="color:#f87171; font-weight:800;">RF</span>' : (sourceConn.toLowerCase() === 'network' ? '<span style="color:#38bdf8; font-weight:800;">NET</span>' : `<span style="font-weight:800; color:var(--text-muted);">${esc(sourceConn).toUpperCase()}</span>`)) : "---"; let sourceBadge = sourceConn ? (sourceConn.toLowerCase() === 'rf' ? '<span style="color:var(--danger); font-weight:400;">(RF)</span>' : (sourceConn.toLowerCase() === 'network' ? '<span style="color:var(--primary); font-weight:400;">(NET)</span>' : `<span style="font-weight:400; color:var(--text-muted);">(${esc(sourceConn).toUpperCase()})</span>`)) : "---";
let modeDisplay = ysfMode && ysfMode.trim() !== "" ? `<span style="font-size:0.7rem; color:var(--accent); border: 1px solid var(--accent); padding: 2px 4px; border-radius: 4px;">${esc(ysfMode).toUpperCase()}</span>` : "---"; let modeDisplay = ysfMode && ysfMode.trim() !== "" ? `<span style="font-size:0.7rem; color:var(--accent); border: 1px solid var(--accent); padding: 2px 4px;">${esc(ysfMode).toUpperCase()}</span>` : "---";
let rssiDisplay = '---'; let rssiDisplay = '---';
if (rawRssi && rawRssi !== 0) { if (rawRssi && rawRssi !== 0) {
let sLabel = "S0"; let sLabel = "S0";
if (rawRssi >= -93) { if (rawRssi >= -93) { let over = Math.round((rawRssi + 93) / 10) * 10; sLabel = over > 0 ? `S9+${over}` : "S9"; }
let over = Math.round((rawRssi + 93) / 10) * 10; else { let sUnits = Math.floor((rawRssi + 141) / 6) + 1; sLabel = `S${Math.max(1, Math.min(9, sUnits))}`; }
sLabel = over > 0 ? `S9<sup style="color: var(--danger); font-weight: 800;">+${over}</sup>` : "S9"; rssiDisplay = `<span title="${esc(rawRssi)} dBm">${sLabel}</span>`;
} 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 += `<div style="width: 4px; height: ${heights[i]}px; background: ${color}; border-radius: 1px;"></div>`;
}
rssiDisplay = `<div style="display: flex; align-items: center; gap: 10px;" title="${esc(rawRssi)} dBm"><div style="min-width: 40px; text-align: right; font-weight: bold; font-family: 'Inter', sans-serif;">${sLabel}</div><div style="display: flex; align-items: flex-end; gap: 2px; height: 14px;">${barsHtml}</div><span style="font-size: 0.85em; color: var(--text-muted); min-width: 7ch; text-align: right;">${esc(rawRssi)} dBm</span></div>`;
} }
if (source.includes("🌐")) { if (source.includes("🌐")) {
if (!networkLogs[clientId]) networkLogs[clientId] = ""; if (!networkLogs[clientId]) networkLogs[clientId] = "";
networkLogs[clientId] += `<div style="border-bottom:1px solid rgba(255,255,255,0.05); padding:4px 0;"><span style="color:var(--text-muted);">[${esc(time)}]</span> <span style="color:${protoColor}; font-weight:bold;">[${esc(protocol)}]</span> <span style="color:var(--text-main);">${esc(source.replace("🌐", "").trim())}</span></div>`; networkLogs[clientId] += `<div><span style="color:var(--text-muted);">[${esc(time)}]</span> <span style="color:${protoColor};">[${esc(protocol)}]</span> ${esc(source.replace("🌐", "").trim())}</div>`;
} else { } else {
const selectedFilter = document.getElementById('stat-node-filter').value; const selectedFilter = document.getElementById('stat-node-filter').value;
if (selectedFilter === 'all' || String(clientId).toLowerCase() === selectedFilter) { if (selectedFilter === 'all' || String(clientId).toLowerCase() === selectedFilter) {
tableHTML += `<tr> tableHTML += `<tr>
<td data-label="${t('thTime')}">${esc(time)}</td> <td data-label="${t('thTime')}">${esc(time)}</td>
<td data-label="${t('thRep')}"><b style="color:var(--text-main);">${esc(String(clientId).toUpperCase())}</b></td> <td data-label="${t('thRep')}"><b style="color:var(--text-main);">${esc(String(clientId).toUpperCase())}</b></td>
<td data-label="${t('thMode')}"><span style="background:${protoColor}; color:white; padding:4px 8px; border-radius:6px; font-size:0.7rem; font-weight:800;">${esc(protocol)}</span></td> <td data-label="${t('thMode')}"><span style="color:${protoColor}; border:1px solid ${protoColor}; padding:2px 4px;">${esc(protocol)}</span></td>
<td data-label="YSF Mode" style="text-align:center;">${modeDisplay}</td> <td data-label="YSF Mode" style="text-align:center;">${modeDisplay}</td>
<td data-label="Source" style="text-align:center; font-family:'JetBrains Mono', monospace;">${sourceBadge}</td> <td data-label="Source" style="text-align:center; font-family:'JetBrains Mono',monospace;">${sourceBadge}</td>
<td data-label="REF/SLOT" style="font-family:'JetBrains Mono', monospace; font-weight:bold; text-align:center;">${esc(slotDisplay)}</td> <td data-label="REF/SLOT" style="font-family:'JetBrains Mono',monospace; text-align:center;">${esc(slotDisplay)}</td>
<td data-label="${t('thCall')}" style="color:var(--accent); font-weight:800;">${sourceHtml}</td> <td data-label="${t('thCall')}" style="color:var(--text-main); font-weight:400;">${sourceHtml}</td>
<td data-label="Target / TG" style="font-family:'JetBrains Mono', monospace;">${esc(target.trim())}</td> <td data-label="Target / TG">${esc(target.trim())}</td>
<td data-label="${t('thDur')}">${esc(row[6])}s</td> <td data-label="${t('thDur')}">${esc(row[6])}s</td>
<td data-label="BER">${esc(row[7])}%</td> <td data-label="BER">${esc(row[7])}%</td>
<td data-label="RSSI" style="font-family:'JetBrains Mono', monospace;">${rssiDisplay}</td> <td data-label="RSSI" style="font-family:'JetBrains Mono',monospace;">${rssiDisplay}</td>
</tr>`; </tr>`;
} }
} }
@@ -854,24 +703,24 @@ async function refreshStats() {
try { try {
const node = document.getElementById('stat-node-filter').value || 'all'; const node = document.getElementById('stat-node-filter').value || 'all';
const res = await fetch(`/api/stats?node=${node}`); const data = await res.json(); const res = await fetch(`/api/stats?node=${node}`); const data = await res.json();
document.getElementById('stat-tgs').innerHTML = data.top_tgs.map((t, i) => `<div><b style="color:var(--text-main);">${i+1}. ${esc(t.target)}</b> <span style="float:right; background:rgba(255,255,255,0.05); padding:2px 6px; border-radius:4px;">${t.count} tx</span></div>`).join('') || t('statNoData'); document.getElementById('stat-tgs').innerHTML = data.top_tgs.map((t, i) => `<div style="border-bottom:1px dashed var(--border-light); padding:2px 0;"><span style="color:var(--text-main);">${i+1}. ${esc(t.target)}</span> <span style="float:right; font-family:'JetBrains Mono',monospace;">[ ${t.count} TX ]</span></div>`).join('') || t('statNoData');
document.getElementById('stat-calls').innerHTML = data.top_calls.map((c, i) => `<div><b style="color:var(--text-main);">${i+1}. ${esc(c.call)}</b> <span style="float:right; background:rgba(255,255,255,0.05); padding:2px 6px; border-radius:4px;">${c.count} tx</span></div>`).join('') || t('statNoData'); document.getElementById('stat-calls').innerHTML = data.top_calls.map((c, i) => `<div style="border-bottom:1px dashed var(--border-light); padding:2px 0;"><span style="color:var(--text-main);">${i+1}. ${esc(c.call)}</span> <span style="float:right; font-family:'JetBrains Mono',monospace;">[ ${c.count} TX ]</span></div>`).join('') || t('statNoData');
document.getElementById('stat-avg').innerText = data.avg_duration; document.getElementById('stat-today').innerText = data.today_tx; 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() { 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; } if (!me.logged_in) { openLoginModal(); return; }
const permission = await Notification.requestPermission(); 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 { try {
const reg = await navigator.serviceWorker.ready; const res = await fetch('/api/vapid_public_key'); const { public_key } = await res.json(); 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 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) }); 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); if (!subRes.ok) throw new Error('ERR HTTP ' + subRes.status);
customAlert("Success", "Push notifications enabled successfully!"); document.getElementById('push-btn').style.color = 'var(--success)'; customAlert("OK", "PUSH ENABLED"); document.getElementById('push-btn').style.color = 'var(--success)';
} catch (e) { console.error(e); customAlert("Error", "Failed to enable notifications.", true); } } catch (e) { console.error(e); customAlert("ERR", "PUSH FAIL", true); }
} }
async function checkPushStatus() { async function checkPushStatus() {
@@ -887,8 +736,8 @@ async function checkServerUpdate() {
} }
function confirmServerUpdate() { function confirmServerUpdate() {
customConfirm("🔄 UPDATE SERVER", "Vuoi scaricare l'ultima versione del server da Gitea/GitHub e riavviare il servizio backend?", "var(--danger)", async () => { 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("✅ 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); } 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') { if (typeof io !== 'undefined') {
const socket = io(); 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('connect', () => { refreshStates(); refreshLogs(); refreshStats(); });
socket.on('dati_aggiornati', refreshStatesSoon); socket.on('log_aggiornato', refreshLogsSoon); socket.on('dati_aggiornati', refreshStatesSoon); socket.on('log_aggiornato', refreshLogsSoon);
} }
+112 -85
View File
@@ -2,65 +2,65 @@
const i18n = { const i18n = {
en: { en: {
lblLogLimit: "Rows:", lblLogLimit: "Rows:",
lastTransits: "Lastheard", loginTitle: "🔒 System Login", lastTransits: "Lastheard", loginTitle: "SYSTEM_LOGIN",
thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration", thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration",
thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions", thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions",
btnReqCfg: "🔄 REQ CONFIG", btnGlobal: "🚨 GLOBAL OVERRIDE", btnAdmin: "🛠️ ADMIN", btnPass: "🔑 PASS", btnLogout: "LOGOUT", btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT",
btnSvc: "⚙️ SVC", btnFile: "📂 FILE", btnBoot: "🔄 BOOT", btnAdd: "+ ADD", btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD",
waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "🔄 FORCE UPDATE", waitNet: "> Waiting network...", waitData: "Waiting for node data...", forceUpdate: "FORCE_UPD",
adminTitle: "🛠️ User & System Management", adminDBSync: "⚙️ Database Sync Config", adminTime: "Daily Update Time:", adminSave: "SAVE CONFIG", roleOp: "Operator", adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Daily Update Time:", adminSave: "SAVE_CFG", roleOp: "Operator",
modSvcTitle: "⚙️ System Daemons:", modFileTitle: "📂 Config Files", modEditTitle: "📝 INI Editor:", modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:",
warnEdit: "⚠️ WARNING: This editor directly manipulates remote node parameters.", warnEdit: "[WARN] DIRECT EDIT ACTIVE",
btnEdit: "📝 EDIT", btnStart: "▶ START", btnRestart: "🔄 RESTART", btnStop: "🛑 STOP", btnSave: "💾 SAVE & SEND", btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE",
btnHat: "🔌 RESET HAT", confHat: "Are you sure you want to physically reset the MMDVM board on node ", 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 ", 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?", 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!", modUpdateTitle: "GBL_UPDATE", confUpdate: "Do you want to request updated data and configuration files from all nodes in the fleet?", alertUpdateOk: "ACK",
btnConfReset: "⚠️ CONFIRM RESET", btnCancel: "CANCEL", promptPass: "Enter the new password:", btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:",
titleError: "❌ ERROR", titleSuccess: "✅ SUCCESS", titleAction: "⚙️ CONFIRM ACTION", titleDelete: "🗑️ DELETE USER", titleSave: "💾 SAVE", titleGlobal: "🚨 GLOBAL OVERRIDE", titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR",
btnYes: "YES, PROCEED", msgDelUser: "Confirm user deletion?", msgPassOk: "Password updated successfully!", msgPassErr: "Failed to update password.", msgLoginFail: "Login Failed", btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL",
msgConfigSaved: "Configuration saved!", msgConfigErr: "Error saving configuration", msgNetErr: "Network Error", msgOvrSel: "Select the profile to send to the ENTIRE network:", msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:",
msgOvrOk: "Command successfully sent to the network!", msgMissUser: "Missing Username", msgMissPass: "Password required for new user", btnSvcKo: "⚠️ DAEMON KO", msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR",
phNewPass: "New pass (empty to keep)", phPass: "Password", phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD",
titleSwitch: "SWITCH PROFILE", confSwitch: "Are you sure you want to switch to", titleBoot: "SYSTEM REBOOT", confBoot: "Are you sure you want to REBOOT node ", titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "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", ttReqCfg: "REQ_DATA", ttGlobal: "GBL_OVR", ttAdmin: "ADMIN", ttPass: "CHG_PWD", ttLogout: "LOGOUT",
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", ttProfA: "PROF_A", ttProfB: "PROF_B", ttTgOn: "TG_ON", ttTgOff: "TG_OFF", ttSvc: "DAEMONS", ttFile: "FILES", ttHat: "RST_HAT", ttBoot: "REBOOT",
ttSwitchTo: "Switch to profile: ", ttSvcStart: "Start service", ttSvcRestart: "Restart service", ttSvcEdit: "Edit configuration", ttSvcStop: "Stop service", ttLang: "Change language", ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG",
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "⏱️ AVERAGE DURATION", statTodayTx: "📡 TRANSITS TODAY", statNoData: "No data", statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA",
statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES", modVersions: "Software & Firmware", statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS",
filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "⚠️ Alerts" filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS"
}, },
it: { it: {
lblLogLimit: "Righe:", 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", thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata",
thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni", thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni",
btnReqCfg: "🔄 RICHIEDI CONFIG", btnGlobal: "🚨 OVERRIDE GLOBALE", btnAdmin: "🛠️ ADMIN", btnPass: "🔑 PASS", btnLogout: "LOGOUT", btnReqCfg: "REQ_CFG", btnGlobal: "GBL_OVR", btnAdmin: "SYS_ADM", btnPass: "CHG_PWD", btnLogout: "LOGOUT",
btnSvc: "⚙️ SVC", btnFile: "📂 FILE", btnBoot: "🔄 BOOT", btnAdd: "+ AGGIUNGI", btnSvc: "SVC", btnFile: "CFG", btnBoot: "REBOOT", btnAdd: "ADD",
waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "🔄 FORZA AGGIORNAMENTO", waitNet: "> Attesa rete...", waitData: "In attesa dei dati dal nodo...", forceUpdate: "FORCE_UPD",
adminTitle: "🛠️ Gestione Utenti e Sistema", adminDBSync: "⚙️ Sincronizzazione Database", adminTime: "Orario Aggiornamento:", adminSave: "SALVA CONFIG", roleOp: "Operatore", adminTitle: "SYS_ADMIN", adminDBSync: "DB_SYNC_CFG", adminTime: "Orario Aggiornamento:", adminSave: "SAVE_CFG", roleOp: "Operatore",
modSvcTitle: "⚙️ Demoni Sistema:", modFileTitle: "📂 File di Configurazione", modEditTitle: "📝 Editor INI:", modSvcTitle: "DAEMONS:", modFileTitle: "CFG_FILES", modEditTitle: "EDIT:",
warnEdit: "⚠️ ATTENZIONE: Questo editor manipola direttamente i parametri del nodo remoto.", warnEdit: "[WARN] DIRECT EDIT ACTIVE",
btnEdit: "📝 MODIFICA", btnStart: "▶ START", btnRestart: "🔄 RESTART", btnStop: "🛑 STOP", btnSave: "💾 SALVA ED INVIA", btnEdit: "EDIT", btnStart: "START", btnRestart: "RST", btnStop: "STOP", btnSave: "WRITE_FILE",
btnHat: "🔌 RESET HAT", confHat: "Sei sicuro di voler resettare fisicamente la scheda MMDVM sul nodo ", 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 ", 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 ⚠️", warnDaemon: "[WARN] DAEMON OFFLINE",
promptOvr: "OVERRIDE GLOBALE", promptOvrConfirm: "Confermi l'invio a TUTTA la rete?", promptOvr: "GBL_OVR", 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!", modUpdateTitle: "GBL_UPDATE", confUpdate: "Vuoi richiedere i dati e i file di configurazione aggiornati a tutti i nodi della flotta?", alertUpdateOk: "ACK",
btnConfReset: "⚠️ CONFERMA RESET", btnCancel: "ANNULLA", promptPass: "Inserisci la nuova password:", btnConfReset: "CONFIRM", btnCancel: "ABORT", promptPass: "NEW PWD:",
titleError: "❌ ERRORE", titleSuccess: "✅ OK", titleAction: "⚙️ CONFERMA AZIONE", titleDelete: "🗑️ ELIMINA UTENTE", titleSave: "💾 SALVATAGGIO", titleGlobal: "🚨 OVERRIDE GLOBALE", titleError: "ERR", titleSuccess: "OK", titleAction: "CONFIRM", titleDelete: "DEL_USR", titleSave: "SAVE", titleGlobal: "GBL_OVR",
btnYes: "SI, PROCEDI", msgDelUser: "Confermi l'eliminazione dell'utente?", msgPassOk: "Password aggiornata con successo!", msgPassErr: "Errore durante l'aggiornamento della password.", msgLoginFail: "Login Fallito", btnYes: "EXECUTE", msgDelUser: "DELETE USER?", msgPassOk: "PWD_UPDATED", msgPassErr: "PWD_ERR", msgLoginFail: "AUTH_FAIL",
msgConfigSaved: "Configurazione salvata!", msgConfigErr: "Errore durante il salvataggio", msgNetErr: "Errore di rete", msgOvrSel: "Seleziona il profilo da inviare a TUTTA la rete:", msgConfigSaved: "CFG_SAVED", msgConfigErr: "CFG_ERR", msgNetErr: "NET_ERR", msgOvrSel: "SELECT_PROF:",
msgOvrOk: "Comando inviato con successo a tutta la rete!", msgMissUser: "Username mancante", msgMissPass: "Password obbligatoria per il nuovo utente", btnSvcKo: "⚠️ DEMONE KO", msgOvrOk: "CMD_BROADCASTED", msgMissUser: "MISSING_USR", msgMissPass: "MISSING_PWD", btnSvcKo: "DAEMON_ERR",
phNewPass: "Nuova pass (vuota per non cambiare)", phPass: "Password", phNewPass: "NEW_PWD (EMPTY=KEEP)", phPass: "PWD",
titleSwitch: "CAMBIO PROFILO", confSwitch: "Sei sicuro di voler passare al", titleBoot: "RIAVVIO SISTEMA", confBoot: "Sei sicuro di voler RIAVVIARE il nodo ", titleSwitch: "SW_PROF", confSwitch: "SWITCH TO ", titleBoot: "SYS_REBOOT", confBoot: "REBOOT NODE ",
ttReqCfg: "Richiedi aggiornamento dati", ttGlobal: "Forza cambio profilo globale", ttAdmin: "Gestione utenti e sistema", ttPass: "Cambia la tua password", ttLogout: "Disconnetti", 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", 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", ttSwitchTo: "SW_TO: ", ttSvcStart: "START", ttSvcRestart: "RST", ttSvcEdit: "EDIT", ttSvcStop: "STOP", ttLang: "LANG",
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Caricamento...", statAvgDur: "⏱️ DURATA MEDIA", statTodayTx: "📡 TRANSITI OGGI", statNoData: "Nessun dato", statTopTG: "TOP_TG", statTopCall: "TOP_CALL", statLoading: "LOADING...", statAvgDur: "AVG_DUR", statTodayTx: "TX_TODAY", statNoData: "NO_DATA",
statTitle: "STATISTICHE GIORNALIERE", statAllNodes: "TUTTA LA RETE", modVersions: "Software & Firmware", statTitle: "DAILY_STATS", statAllNodes: "ALL_NODES", modVersions: "SW_VERSIONS",
filtAll: "Tutti i nodi", filtOnline: "Attivi", filtOffline: "Offline", filtAlerts: "⚠️ Allarmi" filtAll: "ALL_NODES", filtOnline: "ONLINE", filtOffline: "OFFLINE", filtAlerts: "ALERTS"
} }
}; };
@@ -70,7 +70,7 @@ function toggleLang() { currentLang = currentLang === 'it' ? 'en' : 'it'; localS
function applyTranslations() { function applyTranslations() {
const langBtn = document.getElementById('lang-btn'); 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 => { document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n'); const key = el.getAttribute('data-i18n');
if (i18n[currentLang][key]) el.innerHTML = i18n[currentLang][key]; 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 --- // --- DIALOGHI ALERT & CONFIRM ---
function customAlert(title, desc, isError = false) { function customAlert(title, desc, isError = false) {
const color = isError ? 'var(--danger)' : 'var(--success)'; 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-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-desc').innerHTML = desc;
document.getElementById('alert-modal').style.display = 'flex'; document.getElementById('alert-modal').style.display = 'flex';
} }
function customConfirm(title, desc, color, callback) { 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-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-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-yes-btn').innerText = t('btnYes');
document.getElementById('confirm-cancel-btn').innerText = t('btnCancel'); document.getElementById('confirm-cancel-btn').innerText = t('btnCancel');
confirmActionCallback = callback; 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; }); 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 => ` document.getElementById('users-table-body').innerHTML = users.map(u => `
<tr> <tr>
<td>${u.id}</td><td style="font-weight:bold;">${esc(u.username)}</td><td><span style="background:rgba(255,255,255,0.1); padding:2px 8px; border-radius:6px; font-size:0.8rem;">${esc(String(u.role).toUpperCase())}</span></td><td>${esc(u.allowed_nodes)}</td> <td>${u.id}</td><td style="font-weight:bold;">${esc(u.username)}</td><td>[ ${esc(String(u.role).toUpperCase())} ]</td><td>${esc(u.allowed_nodes)}</td>
<td style="text-align:center;"> <td style="text-align:right; min-width: 130px; white-space: nowrap;">
<button onclick="startEditUser(${Number(u.id)})" class="btn-cmd" style="background:var(--accent); padding:6px; width:auto; display:inline-block; margin-right:5px; border:none; color:white !important;">✏️</button> <button onclick="startEditUser(${Number(u.id)})" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; display:inline-block; width: 60px; flex: 0 0 60px; margin-right:5px; padding: 6px;">EDIT</button>
<button onclick="deleteUser(${u.id})" class="btn-cmd" style="background:var(--danger); padding:6px; width:auto; display:inline-block; border:none; color:white !important;">🗑️</button> <button onclick="deleteUser(${u.id})" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; display:inline-block; width: 60px; flex: 0 0 60px; padding: 6px;">DEL</button>
</td> </td>
</tr>`).join(''); </tr>`).join('');
} }
@@ -167,12 +168,12 @@ async function loadUsers() {
function startEditUser(id) { function startEditUser(id) {
const u = usersCache[id]; if (!u) return; 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; 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() { 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 = ""; 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() { async function submitUser() {
@@ -208,13 +209,13 @@ function triggerGlobalEmergency() {
for (const [k, v] of Object.entries(globalHealthData[id].profiles)) { uniqueProfiles[k] = v; } 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)) { for (const [k, v] of Object.entries(uniqueProfiles)) {
let col = colors[idx % colors.length]; let col = colors[idx % colors.length];
html += `<button onclick="sendGlobalAction(${q(k)})" class="btn-cmd" style="background:${col}; padding:15px; font-size:1.1rem; font-weight:bold; border:none; color:white !important;">${esc(v)}</button>`; html += `<button onclick="sendGlobalAction(${q(k)})" class="btn-cmd" style="border-color:${col}; color:${col} !important;">${esc(v)}</button>`;
idx++; idx++;
} }
if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:bold;">No profiles configured on the network.</p>`; } if (Object.keys(uniqueProfiles).length === 0) { html = `<p style="color:var(--danger); font-weight:400; font-family:'JetBrains Mono',monospace;">NO_PROFS_FOUND</p>`; }
container.innerHTML = html; document.getElementById('override-desc').innerText = t('msgOvrSel'); document.getElementById('override-modal').style.display = 'flex'; 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) { function fileLabel(stem, names) {
const key = String(stem).toLowerCase(); const full = (names || []).find(n => String(n).replace(/\.[^.]*$/, '').toLowerCase() === key); 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] || ''); } 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) { 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) || []; const data = globalHealthData[clientId.toLowerCase()];
if (listaFile.length === 0) listDiv.innerHTML = `<div style="text-align:center; padding:20px;"><p style="color:var(--text-muted); margin-bottom:15px;">${t('waitData')}</p><button onclick="sendGlobalUpdate(); closeConfigsModal();" class="btn-cmd" style="background:var(--accent);">${t('forceUpdate')}</button></div>`; const listDiv = document.getElementById('configs-list');
else listDiv.innerHTML = listaFile.map(f => `<div style="display:flex; justify-content:space-between; align-items:center; padding:12px; background:rgba(255,255,255,0.05); border-radius:12px; border:1px solid var(--border-color); margin-bottom:8px;"><span style="font-family:'JetBrains Mono',monospace; font-weight:bold;">${esc(fileLabel(f, fileNames))}</span><button onclick="closeConfigsModal(); openEditorModal(${q(clientId)}, ${q(f)})" class="btn-cmd" style="background:#8e44ad; max-width:120px; border:none; color:white !important;">${t('btnEdit')}</button></div>`).join(''); let listaFile = data ? (data.config_files || data.files || []) : [];
const fileNames = (data && data.file_names) || [];
if (listaFile.length === 0) {
listDiv.innerHTML = `<p>${t('waitData')}</p><button onclick="sendGlobalUpdate(); closeConfigsModal();" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important;">${t('forceUpdate')}</button>`;
} else {
listDiv.innerHTML = listaFile.map(f => `<div style="display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed var(--border-light); width:100%;">
<span style="font-weight:400; font-family:'JetBrains Mono',monospace; flex: 1; text-align: left; overflow:hidden; text-overflow:ellipsis; padding-right:20px;">${esc(fileLabel(f, fileNames))}</span>
<button onclick="closeConfigsModal(); openEditorModal(${q(clientId)}, ${q(f)})" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; width: 100px; flex: 0 0 100px; padding: 8px;">${t('btnEdit')}</button>
</div>`).join('');
}
document.getElementById('configs-modal').style.display = 'flex'; document.getElementById('configs-modal').style.display = 'flex';
} }
function closeConfigsModal() { document.getElementById('configs-modal').style.display = 'none'; } function closeConfigsModal() { document.getElementById('configs-modal').style.display = 'none'; }
// --- MODALE GESTIONE DEMONI/SERVIZI --- // --- 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 closeServicesModal() { document.getElementById('services-modal').style.display = 'none'; }
function renderServicesList(clientId) { function renderServicesList(clientId) {
const data = globalHealthData[clientId.toLowerCase()]; const listDiv = document.getElementById('services-list'); const data = globalHealthData[clientId.toLowerCase()];
if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "<p style='text-align:center; color:var(--text-muted);'>No service data available.</p>"; return; } const listDiv = document.getElementById('services-list');
if (!data || !data.processes || Object.keys(data.processes).length === 0) { listDiv.innerHTML = "<p>NO_DATA</p>"; return; }
let html = ""; let html = "";
for (const [name, status] of Object.entries(data.processes)) { for (const [name, status] of Object.entries(data.processes)) {
const isOnline = status.toLowerCase() === 'online'; const statusColor = isOnline ? 'var(--success)' : 'var(--danger)'; const isOnline = status.toLowerCase() === 'online'; const statusColor = isOnline ? 'var(--success)' : 'var(--danger)';
html += `<div style="display:flex; justify-content:space-between; align-items:center; padding:15px; border-bottom:1px solid var(--border-color); background:rgba(255,255,255,0.02); border-radius:12px; margin-bottom:8px; border-left: 5px solid ${statusColor};"> html += `<div style="display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed var(--border-light); width: 100%;">
<div><strong style="font-size:1.1rem; display:block; font-family:'JetBrains Mono',monospace;">${esc(name)}</strong><span class="${isOnline?'':'blink'}" style="color:${statusColor}; font-size:0.8rem; font-weight:800;">${esc(String(status).toUpperCase())}</span></div> <div style="font-weight:400; color:${statusColor}; font-family:'JetBrains Mono',monospace; flex: 1; text-align: left; overflow:hidden; text-overflow:ellipsis; padding-right:20px;">${esc(name)} [${esc(String(status).toUpperCase())}]</div>
<div style="display:flex; gap:8px;"> <div style="display:flex; gap:8px; flex: 0 0 auto; justify-content: flex-end;">
${!isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'start')" class="btn-cmd" style="background:var(--success); border:none; color:white !important;">▶</button>` : ''} ${!isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'start')" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">START</button>` : ''}
<button onclick="controlService(${q(clientId)}, ${q(name)}, 'restart')" class="btn-cmd" style="background:#f59e0b; border:none; color:white !important;">🔄</button> <button onclick="controlService(${q(clientId)}, ${q(name)}, 'restart')" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">RST</button>
<button onclick="openEditorModal(${q(clientId)}, ${q(name)})" class="btn-cmd" style="background:#8e44ad; border:none; color:white !important;">📝</button> <button onclick="openEditorModal(${q(clientId)}, ${q(name)})" class="btn-cmd" style="width: 70px; flex: 0 0 70px; padding: 6px 0;">EDIT</button>
${isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'stop')" class="btn-cmd" style="background:var(--danger); border:none; color:white !important;">🛑</button>` : ''} ${isOnline ? `<button onclick="controlService(${q(clientId)},${q(name)}, 'stop')" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 70px; flex: 0 0 70px; padding: 6px 0;">STOP</button>` : ''}
</div> </div>
</div>`; </div>`;
} }
@@ -278,7 +295,7 @@ function renderServicesList(clientId) {
function controlService(clientId, service, action) { function controlService(clientId, service, action) {
customConfirm(t('titleAction'), `${t('confOp')}<b>${esc(service)}</b>?`, "var(--accent)", async () => { customConfirm(t('titleAction'), `${t('confOp')}<b>${esc(service)}</b>?`, "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(); 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); } } catch(e) { console.error(e); }
}); });
} }
@@ -287,28 +304,38 @@ function controlService(clientId, service, action) {
let currentEditClient = ""; let currentEditService = ""; let currentEditClient = ""; let currentEditService = "";
async function openEditorModal(clientId, service) { async function openEditorModal(clientId, service) {
currentEditClient = clientId; currentEditService = service; document.getElementById('editor-title').innerText = `${service.toUpperCase()} @ ${clientId.toUpperCase()}`; 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'; 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 file"; else document.getElementById('config-textarea').value = "ERROR:\n" + data.error; } catch(e) { document.getElementById('config-textarea').value = "Connection error."; } 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 closeEditorModal() { document.getElementById('editor-modal').style.display = 'none'; }
function saveConfig() { function saveConfig() {
const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status'); const textValue = document.getElementById('config-textarea').value; const statusSpan = document.getElementById('editor-status');
customConfirm(t('titleSave'), `${t('confOvr')}<b>${currentEditClient.toUpperCase()}</b>?`, "var(--danger)", async () => { customConfirm(t('titleSave'), `${t('confOvr')}<b>${currentEditClient.toUpperCase()}</b>?`, "var(--danger)", async () => {
statusSpan.innerText = "Sending..."; statusSpan.style.color = "var(--success)"; statusSpan.innerText = "WRITING..."; statusSpan.style.color = "var(--success)";
try { 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 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(); 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"; } 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 = "❌ Network Error"; } } catch(e) { customAlert(t('titleError'), t('msgNetErr'), true); statusSpan.innerText = "NET_ERR"; }
}); });
} }
// --- MODALE VERSIONI SOFTWARE --- // --- MODALE VERSIONI SOFTWARE ---
function openVersionsModal(clientId) { function openVersionsModal(clientId) {
const versions = globalVersionsData[clientId.toLowerCase()]; const listDiv = document.getElementById('versions-list'); const versions = globalVersionsData[clientId.toLowerCase()]; const listDiv = document.getElementById('versions-list');
if (!versions || Object.keys(versions).length === 0) { listDiv.innerHTML = "<span style='color: var(--text-muted);'>Nessun dato ancora ricevuto. Usa il tasto 🔄 RESTART sui servizi del nodo per forzare l'invio del log di avvio.</span>"; } if (!versions || Object.keys(versions).length === 0) { listDiv.innerHTML = "<p style='font-family:\"JetBrains Mono\",monospace;'>NO_DATA. RESTART SVCS TO PUSH LOGS.</p>"; }
else { let html = ""; for (const [software, version] of Object.entries(versions)) { html += `<div><strong style="color: var(--primary); display: inline-block; width: 140px;">${esc(software)}:</strong> <span style="color: var(--success); font-weight: bold;">${esc(version)}</span></div>`; } listDiv.innerHTML = html; } else { let html = ""; for (const [software, version] of Object.entries(versions)) { html += `<div style="border-bottom:1px dashed var(--border-light); padding:5px 0;"><strong style="color: var(--primary); display: inline-block; width: 140px;">${esc(software)}:</strong> <span style="color: var(--success); font-weight: 400;">${esc(version)}</span></div>`; } listDiv.innerHTML = html; }
document.getElementById('versions-modal').style.display = 'flex'; document.getElementById('versions-modal').style.display = 'flex';
} }
function closeVersionsModal() { document.getElementById('versions-modal').style.display = 'none'; } function closeVersionsModal() { document.getElementById('versions-modal').style.display = 'none'; }
+148 -156
View File
@@ -6,24 +6,26 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fleet Control Console</title> <title>Fleet Control Console</title>
<link rel="manifest" href="/manifest.json"> <link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#0d1117"> <meta name="theme-color" content="#06246f">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" href="/icon-512.png"> <link rel="apple-touch-icon" href="/icon-512.png">
<meta name="apple-mobile-web-app-title" content="Fleet C2"> <meta name="apple-mobile-web-app-title" content="Fleet C2">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<!-- Font Blueprint -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<!-- Libreria Mappa Leaflet CSS --> <!-- Libreria Mappa Leaflet CSS -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<!-- Foglio di Stile Esterno Modularizzato --> <!-- Foglio di Stile Esterno Modularizzato -->
<link rel="stylesheet" href="/static/css/style.css"> <link rel="stylesheet" href="/static/css/style.css?v=blueprint3">
</head> </head>
<body> <body>
<div id="top-bar-container"> <div id="top-bar-container">
<div id="top-bar"> <div id="top-bar">
<div class="title-brand">FLEET CONTROL CONSOLE</div> <div class="title-brand">SCHEMATIC // FLEET C2</div>
<div class="nav-tabs"> <div class="nav-tabs">
<button class="nav-tab active" onclick="switchView('home')" id="tab-home">HOME</button> <button class="nav-tab active" onclick="switchView('home')" id="tab-home">HOME</button>
@@ -31,10 +33,10 @@
<button class="nav-tab" onclick="switchView('map')" id="tab-map">MAP</button> <button class="nav-tab" onclick="switchView('map')" id="tab-map">MAP</button>
</div> </div>
<div style="display: flex; align-items: center; gap: 12px;"> <div class="top-bar-right">
<span id="mqtt-badge" class="mqtt-badge mqtt-offline">MQTT: CHECKING...</span> <span id="mqtt-badge" class="mqtt-badge mqtt-offline">MQTT: CHK</span>
<button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang">🇮🇹 ITA</button> <button class="theme-switch" id="lang-btn" onclick="toggleLang()" data-i18n-title="ttLang">ITA</button>
<button class="theme-switch" id="push-btn" onclick="subscribeToPush()">🔔 PUSH</button> <button class="theme-switch" id="push-btn" onclick="subscribeToPush()">PUSH</button>
<div id="auth-container" style="display:flex; align-items:center; gap:8px;"></div> <div id="auth-container" style="display:flex; align-items:center; gap:8px;"></div>
</div> </div>
</div> </div>
@@ -50,19 +52,19 @@
<div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto; padding: 0 20px;">
<div class="filter-bar"> <div class="filter-bar">
<div style="display: flex; gap: 8px; flex-wrap: wrap;" id="node-filters"> <div style="display: flex; gap: 8px; flex-wrap: wrap;" id="node-filters">
<button class="filter-pill active" onclick="setFilter('all')" data-i18n="filtAll">All Nodes</button> <button class="filter-pill active" onclick="setFilter('all')" data-i18n="filtAll">ALL_NODES</button>
<button class="filter-pill" onclick="setFilter('online')" data-i18n="filtOnline">Online</button> <button class="filter-pill" onclick="setFilter('online')" data-i18n="filtOnline">ONLINE</button>
<button class="filter-pill" onclick="setFilter('offline')" data-i18n="filtOffline">Offline</button> <button class="filter-pill" onclick="setFilter('offline')" data-i18n="filtOffline">OFFLINE</button>
<button class="filter-pill pill-warn" onclick="setFilter('alerts')" data-i18n="filtAlerts">⚠️ Alerts</button> <button class="filter-pill pill-warn" onclick="setFilter('alerts')" data-i18n="filtAlerts">ALERTS</button>
<div style="width: 1px; background: var(--border-color); margin: 0 5px;"></div> <div style="width: 1px; background: var(--border-light); margin: 0 5px;"></div>
<button class="filter-pill" onclick="setFilter('dmr')" style="color: #3b82f6; border-color: rgba(59,130,246,0.3);">DMR</button> <button class="filter-pill" onclick="setFilter('dmr')">DMR</button>
<button class="filter-pill" onclick="setFilter('ysf')" style="color: #8b5cf6; border-color: rgba(139,92,246,0.3);">YSF</button> <button class="filter-pill" onclick="setFilter('ysf')">YSF</button>
<button class="filter-pill" onclick="setFilter('d-star')" style="color: #06b6d4; border-color: rgba(6,182,212,0.3);">D-STAR</button> <button class="filter-pill" onclick="setFilter('d-star')">D-STAR</button>
<button class="filter-pill" onclick="setFilter('nxdn')" style="color: #10b981; border-color: rgba(16,185,129,0.3);">NXDN</button> <button class="filter-pill" onclick="setFilter('nxdn')">NXDN</button>
</div> </div>
<div style="display: flex; gap: 10px; align-items: center; width: auto; flex-grow: 1; justify-content: flex-end;"> <div style="display: flex; gap: 10px; align-items: center; width: auto; flex-grow: 1; justify-content: flex-end;">
<input type="text" id="node-search" placeholder="Search ID / Callsign..." onkeyup="applyFilters()" style="padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); background: rgba(0,0,0,0.2); color: white; flex-grow: 1; max-width: 200px;"> <input type="text" id="node-search" placeholder="SEARCH ID/CALL..." onkeyup="applyFilters()" style="flex-grow: 1; max-width: 200px;">
<button id="view-toggle-btn" class="btn-cmd" style="background: rgba(255,255,255,0.1); padding: 8px 12px; flex: 0 0 auto; width: auto;" onclick="toggleViewMode()" title="Toggle Grid/List View">🔲 GRID</button> <button id="view-toggle-btn" class="btn-cmd" style="flex: 0 0 auto; width: auto;" onclick="toggleViewMode()" title="Toggle Grid/List View">[ GRID ]</button>
</div> </div>
</div> </div>
</div> </div>
@@ -72,30 +74,30 @@
<!-- VISTA HOME --> <!-- VISTA HOME -->
<div id="view-home"> <div id="view-home">
<!-- STATUS RAPIDO NODI -->
<div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto 20px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);"> <h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
<span style="font-size: 1.2rem;">🟢</span> <span>FLEET STATUS</span> [ FLEET_STATUS ]
</h3> </h3>
<div id="home-mini-nodes" style="display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;"></div> <div id="home-mini-nodes" style="display: flex; flex-wrap: wrap; justify-content: center; gap: 15px;"></div>
</div> </div>
<!-- LASTHEARD -->
<div style="max-width: 1400px; margin: 0 auto 30px auto;"> <div style="max-width: 1400px; margin: 0 auto 30px auto;">
<div style="padding: 0 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px;"> <div style="padding: 0 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;">
<h3 style="margin: 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);"> <h3 style="margin: 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main);" data-i18n="lastTransits">[ LASTHEARD ]</h3>
<span style="font-size: 1.5rem;">📡</span> <span data-i18n="lastTransits">Lastheard</span>
</h3>
<div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;"> <div style="display: flex; align-items: center; gap: 10px; flex-wrap: wrap;">
<div style="display: flex; align-items: center; gap: 6px;"> <div style="display: flex; align-items: center; gap: 6px;">
<label for="log-limit-select" data-i18n="lblLogLimit" style="font-size: 0.8rem; color: var(--text-muted); font-weight: 600;">Righe:</label> <label for="log-limit-select" data-i18n="lblLogLimit" style="font-size: 0.8rem; color: var(--text-muted); font-weight: 300;">ROWS:</label>
<select id="log-limit-select" onchange="changeLogLimit(this.value)" style="font-weight: bold; cursor: pointer; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: rgba(0,0,0,0.2); color: var(--text-main);"> <select id="log-limit-select" onchange="changeLogLimit(this.value)" style="font-weight: 400; cursor: pointer;">
<option value="30">30</option> <option value="30">30</option>
<option value="60">60</option> <option value="60">60</option>
<option value="100">100</option> <option value="100">100</option>
<option value="200">200</option> <option value="200">200</option>
</select> </select>
</div> </div>
<select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="font-weight: bold; cursor: pointer;"> <select id="stat-node-filter" onchange="refreshStats(); refreshLogs();" style="font-weight: 400; cursor: pointer;">
<option value="all">🌐 ALL NODES</option> <option value="all">ALL_NODES</option>
</select> </select>
</div> </div>
</div> </div>
@@ -103,15 +105,15 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th data-i18n="thTime">Time</th> <th data-i18n="thTime">TIME</th>
<th data-i18n="thRep">Repeater</th> <th data-i18n="thRep">REPEATER</th>
<th data-i18n="thMode">Mode</th> <th data-i18n="thMode">MODE</th>
<th style="text-align: center;">YSF Mode</th> <th style="text-align: center;">YSF_MODE</th>
<th style="text-align: center;">Source</th> <th style="text-align: center;">SOURCE</th>
<th style="text-align: center;">REF / SLOT</th> <th style="text-align: center;">REF/SLOT</th>
<th data-i18n="thCall">Callsign</th> <th data-i18n="thCall">CALLSIGN</th>
<th>Target / TG</th> <th>TARGET</th>
<th data-i18n="thDur">Duration</th> <th data-i18n="thDur">DUR</th>
<th>BER</th> <th>BER</th>
<th>RSSI</th> <th>RSSI</th>
</tr> </tr>
@@ -121,30 +123,29 @@
</div> </div>
</div> </div>
<!-- DAILY STATISTICS -->
<div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;"> <div style="max-width: 1400px; margin: 0 auto 30px auto; padding: 0 20px;">
<h3 style="margin: 0 0 15px 0; font-weight: 800; display: flex; align-items: center; gap: 10px; color: var(--text-main);"> <h3 style="margin: 0 0 15px 0; font-weight: 300; letter-spacing: 2px; color: var(--text-main); border-bottom: 1px dashed var(--border-main); padding-bottom: 5px;" data-i18n="statTitle">[ DAILY_STATISTICS ]</h3>
<span style="font-size: 1.5rem;">📊</span> <span data-i18n="statTitle">DAILY STATISTICS</span>
</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;"> <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px;">
<div class="card" style="padding: 15px; border-top-color: var(--accent) !important;"> <div class="card" style="border-left: 1px solid var(--accent) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--accent);" data-i18n="statTopTG">🎯 TOP TALKGROUPS</h4> <h4 style="margin: 0 0 10px 0; color: var(--accent); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopTG">TOP_TALKGROUPS</h4>
<div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">Loading...</div> <div id="stat-tgs" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div>
</div> </div>
<div class="card" style="padding: 15px; border-top-color: var(--success) !important;"> <div class="card" style="border-left: 1px solid var(--success) !important; padding: 15px;">
<h4 style="margin: 0 0 10px 0; color: var(--success);" data-i18n="statTopCall">🗣️ TOP CALLSIGNS</h4> <h4 style="margin: 0 0 10px 0; color: var(--success); font-weight: 300; letter-spacing: 1px;" data-i18n="statTopCall">TOP_CALLSIGNS</h4>
<div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">Loading...</div> <div id="stat-calls" style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.8;" data-i18n="statLoading">LOADING...</div>
</div> </div>
<div class="card" style="padding: 15px; border-top-color: var(--primary) !important; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;"> <div class="card" style="border-left: 1px solid var(--primary) !important; padding: 15px; display: flex; justify-content: space-around; align-items: center; text-align: center; flex-direction: row;">
<div> <div>
<div style="font-size: 1.8rem; font-weight: 800; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div> <div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-avg">--</span>s</div>
<div style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold;" data-i18n="statAvgDur">⏱️ AVERAGE DURATION</div> <div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statAvgDur">AVG_DURATION</div>
</div> </div>
<div style="width: 1px; height: 50px; background: var(--border-color);"></div> <div style="width: 1px; height: 50px; border-left: 1px dashed var(--border-light);"></div>
<div> <div>
<div style="font-size: 1.8rem; font-weight: 800; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div> <div style="font-size: 1.8rem; font-weight: 300; color: var(--text-main); font-family: 'JetBrains Mono', monospace;"><span id="stat-today">--</span></div>
<div style="font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold;" data-i18n="statTodayTx">📡 TRANSITS TODAY</div> <div style="font-size: 0.75rem; color: var(--border-main); text-transform: uppercase; font-weight: 300; letter-spacing: 1px;" data-i18n="statTodayTx">TRANSITS_TODAY</div>
</div> </div>
</div> </div>
</div> </div>
@@ -152,65 +153,60 @@
</div> </div>
<footer> <footer>
<div style="text-align: center; padding: 25px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;"> <div style="text-align: center; padding: 25px; color: var(--border-light); font-size: 0.85rem; font-weight: 300; display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;">
<span>&copy; 2026 <strong>IV3JDV @ ARIFVG</strong></span> <span>SYS_OP: IV3JDV @ ARIFVG</span>
<span style="opacity: 0.5;">|</span> <span>|</span>
<a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none; display: flex; align-items: center; gap: 6px; transition: color 0.2s;"> <a href="https://git.arifvg.it/iv3jdv/fleet-control-server" target="_blank" style="color: inherit; text-decoration: none;">GITEA_REPO</a>
<span>Gitea Home</span> <span>|</span>
</a> <span style="color: var(--accent);">REV: {{ git_commit }}</span>
<span style="opacity: 0.5;">|</span> <span>|</span>
<span style="font-family: 'JetBrains Mono', monospace; color: var(--accent);">Rev: {{ git_commit }}</span> <span id="last-update">SYNC: --:--</span>
<span style="opacity: 0.5;">|</span>
<span id="last-update">Sync: --:--</span>
</div> </div>
</footer> </footer>
<!-- MODALI --> <!-- MODALI -->
<div id="login-modal" class="modal-overlay"> <div id="login-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px;"> <div class="modal-content" style="max-width:400px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary);" data-i18n="loginTitle">🔒 System Login</h2> <h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="loginTitle">[ SYSTEM_LOGIN ]</h2>
<button onclick="closeLoginModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeLoginModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div> </div>
<div style="display:flex; flex-direction:column; gap:15px;"> <div style="display:flex; flex-direction:column; gap:15px; margin-top: 20px;">
<input type="text" id="modal-username" placeholder="Username" style="width:100%; padding:12px; font-size:1rem;" onkeypress="handleLoginEnter(event)"> <input type="text" id="modal-username" placeholder="USR" onkeypress="handleLoginEnter(event)">
<input type="password" id="modal-password" placeholder="Password" style="width:100%; padding:12px; font-size:1rem;" onkeypress="handleLoginEnter(event)"> <input type="password" id="modal-password" placeholder="PWD" onkeypress="handleLoginEnter(event)">
<button onclick="performLogin()" class="btn-cmd" style="background:var(--success); width:100%; padding:12px; margin-top:10px; font-size:1rem;">LOGIN</button> <button onclick="performLogin()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important;">EXECUTE_LOGIN</button>
</div> </div>
</div> </div>
</div> </div>
<div id="admin-modal" class="modal-overlay"> <div id="admin-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:900px;"> <div class="modal-content" style="max-width:900px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:20px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:20px;">
<h2 style="margin:0;" data-i18n="adminTitle">🛠️ User & System Management</h2> <h2 style="margin:0; color:var(--text-main); font-weight:300;" data-i18n="adminTitle">[ SYS_ADMIN ]</h2>
<button onclick="closeAdmin()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeAdmin()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div> </div>
<div style="display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; background:rgba(0,0,0,0.2); padding:15px; border-radius:16px; align-items:center;"> <div style="display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; background:rgba(0,0,0,0.2); padding:15px; align-items:center; border: 1px solid var(--border-light);">
<input type="text" id="new-user" placeholder="Username" style="flex:1; min-width:120px;"> <input type="text" id="new-user" placeholder="USR" style="flex:1; min-width:120px;">
<input type="password" id="new-pass" placeholder="Password" style="flex:1; min-width:120px;"> <input type="password" id="new-pass" placeholder="PWD" style="flex:1; min-width:120px;">
<select id="new-role" style="flex:0.5; min-width:100px;"> <select id="new-role" style="flex:none; width: 80px;"><option value="operator" data-i18n="roleOp">OP</option><option value="admin">ADM</option></select>
<option value="operator" data-i18n="roleOp">Operator</option> <input type="text" id="new-nodes" placeholder="NODES (IR3UIC,IR3Q)" style="flex:2; min-width:150px;">
<option value="admin">Admin</option> <button id="btn-user-submit" onclick="submitUser()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important; flex:none; width: 80px;" data-i18n="btnAdd">ADD</button>
</select> <button id="btn-user-cancel" onclick="cancelEdit()" class="btn-cmd" style="display:none; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
<input type="text" id="new-nodes" placeholder="Nodes (eg: ir3uic,ir3q)" style="flex:2; min-width:150px;">
<button id="btn-user-submit" onclick="submitUser()" class="btn-cmd" style="background:var(--success); flex:0.5;" data-i18n="btnAdd">+ ADD</button>
<button id="btn-user-cancel" onclick="cancelEdit()" class="btn-cmd" style="background:var(--text-muted); flex:0.2; display:none;">✖</button>
</div> </div>
<div style="margin-bottom:20px; background:rgba(59, 130, 246, 0.05); padding:20px; border-radius:16px; border: 1px solid var(--primary);"> <div style="margin-bottom:20px; background:rgba(0,0,0,0.2); padding:20px; border: 1px solid var(--border-light);">
<h4 style="margin:0 0 15px 0; color:var(--primary);" data-i18n="adminDBSync">⚙️ Database Sync Configuration</h4> <h4 style="margin:0 0 15px 0; color:var(--primary); font-weight:300;" data-i18n="adminDBSync">[ DB_SYNC_CFG ]</h4>
<div style="display:grid; grid-template-columns: 1fr 1fr; gap:15px; margin-bottom:15px;"> <div style="display:grid; grid-template-columns: 1fr 1fr; gap:15px; margin-bottom:15px;">
<div><label style="font-size:0.8rem; font-weight:bold; display:block; margin-bottom:5px;">URL DB DMR (.dat):</label><input type="text" id="url-dmr-input" style="width:100%;"></div> <div><label style="font-size:0.8rem; font-weight:300; display:block; margin-bottom:5px; color:var(--text-muted);">URL_DMR (.dat):</label><input type="text" id="url-dmr-input" style="width:100%;"></div>
<div><label style="font-size:0.8rem; font-weight:bold; display:block; margin-bottom:5px;">URL DB NXDN (.csv):</label><input type="text" id="url-nxdn-input" style="width:100%;"></div> <div><label style="font-size:0.8rem; font-weight:300; display:block; margin-bottom:5px; color:var(--text-muted);">URL_NXDN (.csv):</label><input type="text" id="url-nxdn-input" style="width:100%;"></div>
</div> </div>
<div style="display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--border-color); padding-top:15px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-top:1px dashed var(--border-light); padding-top:15px;">
<div style="display:flex; align-items:center; gap:10px;"><label style="font-size:0.8rem; font-weight:bold;" data-i18n="adminTime">Daily Update Time:</label><input type="time" id="update-time-input"></div> <div style="display:flex; align-items:center; gap:10px;"><label style="font-size:0.8rem; font-weight:300;" data-i18n="adminTime">CRON_TIME:</label><input type="time" id="update-time-input"></div>
<button onclick="saveSettings()" class="btn-cmd" style="background:var(--accent); max-width: 250px;" data-i18n="adminSave">SAVE CONFIGURATION</button> <button onclick="saveSettings()" class="btn-cmd" style="border-color:var(--accent); color:var(--accent) !important; max-width: 250px; flex: none;" data-i18n="adminSave">SAVE_CFG</button>
</div> </div>
</div> </div>
<div style="overflow-x:auto;"> <div style="overflow-x:auto;">
<table style="width:100%; border-collapse:collapse; text-align:left;"> <table style="width:100%; border-collapse:collapse; text-align:left;">
<thead><tr><th>ID</th><th data-i18n="thUser">User</th><th data-i18n="thRole">Role</th><th data-i18n="thNodes">Nodes</th><th style="text-align:center;" data-i18n="thActs">Actions</th></tr></thead> <thead style="background: transparent;"><tr><th>ID</th><th data-i18n="thUser">USR</th><th data-i18n="thRole">ROLE</th><th data-i18n="thNodes">NODES</th><th style="text-align:center;" data-i18n="thActs">CMD</th></tr></thead>
<tbody id="users-table-body"></tbody> <tbody id="users-table-body"></tbody>
</table> </table>
</div> </div>
@@ -218,112 +214,108 @@
</div> </div>
<div id="services-modal" class="modal-overlay"> <div id="services-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:550px;"> <div class="modal-content" style="max-width:550px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:15px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--accent);"><span data-i18n="modSvcTitle">⚙️ System Daemons:</span> <span id="svc-modal-title" style="color:var(--text-main);"></span></h2> <h2 style="margin:0; color:var(--accent); font-weight:300;">[ <span data-i18n="modSvcTitle">DAEMONS:</span> <span id="svc-modal-title" style="color:var(--text-main);"></span> ]</h2>
<button onclick="closeServicesModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeServicesModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div> </div>
<div id="services-list" style="max-height: 400px; overflow-y: auto; padding-right:10px;"></div> <div id="services-list" style="max-height: 400px; overflow-y: auto;"></div>
</div> </div>
</div> </div>
<div id="configs-modal" class="modal-overlay"> <div id="configs-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:500px;"> <div class="modal-content" style="max-width:500px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:15px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:#8e44ad;" data-i18n="modFileTitle">📂 Configuration Files</h2> <h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="modFileTitle">[ CFG_FILES ]</h2>
<button onclick="closeConfigsModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeConfigsModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div> </div>
<div id="configs-list" style="display:flex; flex-direction:column; gap:10px;"></div> <div id="configs-list" style="display:flex; flex-direction:column; gap:0;"></div>
</div> </div>
</div> </div>
<div id="editor-modal" class="modal-overlay"> <div id="editor-modal" class="modal-overlay">
<div class="modal-content" style="width:95%; max-width:900px; border: 1px solid var(--accent);"> <div class="modal-content" style="max-width:900px;">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px;"> <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; border-bottom: 1px dashed var(--border-main); padding-bottom: 10px;">
<h3 style="margin:0; color:var(--accent);"><span data-i18n="modEditTitle">📝 INI File Editor:</span> <span id="editor-title" style="color:var(--text-main);"></span></h3> <h3 style="margin:0; color:var(--accent); font-weight:300;">[ <span data-i18n="modEditTitle">EDIT:</span> <span id="editor-title" style="color:var(--text-main);"></span> ]</h3>
<button onclick="closeEditorModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeEditorModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div> </div>
<div style="background:rgba(239, 68, 68, 0.1); border-left:4px solid var(--danger); padding:10px; margin-bottom:15px; font-size:0.85rem; font-weight:bold; border-radius: 8px;" data-i18n="warnEdit"> <textarea id="config-textarea" spellcheck="false" style="width:100%; height:55vh; background:rgba(0,0,0,0.3); color:var(--text-main); font-family:'JetBrains Mono', monospace; font-size:0.85rem; padding:15px; border:1px solid var(--border-light); resize:none; outline:none; margin-top: 15px;"></textarea>
⚠️ WARNING: This editor directly manipulates remote node parameters.
</div>
<textarea id="config-textarea" spellcheck="false" style="width:100%; height:55vh; background:#0f172a; color:#10b981; font-family:'JetBrains Mono', monospace; font-size:0.95rem; padding:15px; border-radius:12px; border:1px solid #334155; resize:none; box-sizing:border-box; outline:none;"></textarea>
<div style="display:flex; justify-content:space-between; margin-top:20px; align-items:center;"> <div style="display:flex; justify-content:space-between; margin-top:20px; align-items:center;">
<span id="editor-status" style="font-size:0.9rem; font-weight:bold;"></span> <span id="editor-status" style="font-size:0.9rem; font-weight:300; font-family:'JetBrains Mono',monospace;"></span>
<button onclick="saveConfig()" class="btn-cmd" style="background:var(--danger); max-width: 250px;" data-i18n="btnSave">💾 SAVE & SEND</button> <button onclick="saveConfig()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; max-width: 250px; flex: none;" data-i18n="btnSave">WRITE_FILE</button>
</div> </div>
</div> </div>
</div> </div>
<div id="alert-modal" class="modal-overlay modal-top"> <div id="alert-modal" class="modal-overlay modal-top">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 2px solid var(--primary);" id="alert-box"> <div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--primary);" id="alert-box">
<h2 style="margin-top:0;" id="alert-title">ℹ️ INFO</h2> <h2 style="margin-top:0; font-weight:300;" id="alert-title">[ INFO ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="alert-desc">Message</p> <p style="margin-bottom:25px; color:var(--text-main); font-weight: 300;" id="alert-desc">MSG</p>
<button onclick="document.getElementById('alert-modal').style.display='none'" class="btn-cmd" style="background:var(--primary); padding:12px; width:100%;">OK</button> <button onclick="document.getElementById('alert-modal').style.display='none'" class="btn-cmd" style="border-color:var(--primary); color:var(--primary) !important; width:100%;">ACK</button>
</div> </div>
</div> </div>
<div id="confirm-modal" class="modal-overlay modal-top"> <div id="confirm-modal" class="modal-overlay modal-top">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 2px solid var(--danger);" id="confirm-box"> <div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);" id="confirm-box">
<h2 style="margin-top:0;" id="confirm-title">⚠️ WARNING</h2> <h2 style="margin-top:0; font-weight:300;" id="confirm-title">[ WARN ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="confirm-desc">Are you sure?</p> <p style="margin-bottom:25px; color:var(--text-main); font-weight: 300;" id="confirm-desc">SURE?</p>
<div style="display:flex; flex-direction:column; gap:15px;"> <div style="display:flex; flex-direction:column; gap:10px;">
<button id="confirm-yes-btn" onclick="executeConfirmAction()" class="btn-cmd" style="background:var(--danger); padding:15px; font-size:1.1rem; font-weight:800;">YES, PROCEED</button> <button id="confirm-yes-btn" onclick="executeConfirmAction()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important;">EXECUTE</button>
<button id="confirm-cancel-btn" onclick="document.getElementById('confirm-modal').style.display='none'" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;">CANCEL</button> <button id="confirm-cancel-btn" onclick="document.getElementById('confirm-modal').style.display='none'" class="btn-cmd">ABORT</button>
</div> </div>
</div> </div>
</div> </div>
<div id="password-modal" class="modal-overlay"> <div id="password-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--accent);"> <div class="modal-content" style="max-width:400px; text-align:center;">
<h2 style="margin-top:0; color:var(--accent);">🔑 <span data-i18n="btnPass">PASSWORD CHANGE</span></h2> <h2 style="margin-top:0; color:var(--accent); border-bottom: 1px dashed var(--border-main); padding-bottom: 10px; font-weight:300;" data-i18n="btnPass">[ CHG_PWD ]</h2>
<p style="margin-bottom:20px; color:var(--text-main); font-weight: 600;" data-i18n="promptPass">Enter the new password:</p> <p style="margin-bottom:20px; font-weight: 300;" data-i18n="promptPass">NEW PWD:</p>
<input type="password" id="new-password-input" style="width:100%; padding:12px; font-size:1rem; margin-bottom:20px; text-align:center;" placeholder="***"> <input type="password" id="new-password-input" style="width:100%; text-align:center; margin-bottom: 20px;">
<div style="display:flex; flex-direction:column; gap:10px;"> <div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executePasswordChange()" class="btn-cmd" style="background:var(--success); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="titleSave">💾 SAVE</button> <button onclick="executePasswordChange()" class="btn-cmd" style="border-color:var(--success); color:var(--success) !important;" data-i18n="titleSave">SAVE</button>
<button onclick="closePasswordModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px;" data-i18n="btnCancel">CANCEL</button> <button onclick="closePasswordModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div> </div>
</div> </div>
</div> </div>
<div id="override-modal" class="modal-overlay"> <div id="override-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center;"> <div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);">
<h2 style="margin-top:0; color:var(--danger);">🚨 <span data-i18n="titleGlobal">GLOBAL OVERRIDE</span> 🚨</h2> <h2 style="margin-top:0; color:var(--danger); font-weight:300;" data-i18n="titleGlobal">[ GBL_OVR ]</h2>
<p style="margin-bottom:25px; color:var(--text-muted); font-weight: 600;" id="override-desc">Select the profile to send to the ENTIRE network:</p> <p style="margin-bottom:25px; font-weight: 300; color:var(--text-muted);" id="override-desc">SELECT PROF:</p>
<div id="global-btn-container" style="display:flex; flex-direction:column; gap:15px; margin-bottom: 15px;"></div> <div id="global-btn-container" style="display:flex; flex-direction:column; gap:10px; margin-bottom: 15px;"></div>
<button onclick="document.getElementById('override-modal').style.display='none'" class="btn-cmd" style="background:var(--text-muted); padding:12px; width:100%;" data-i18n="btnCancel">CANCEL</button> <button onclick="document.getElementById('override-modal').style.display='none'" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div> </div>
</div> </div>
<div id="reset-hat-modal" class="modal-overlay"> <div id="reset-hat-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--danger);"> <div class="modal-content" style="max-width:400px; text-align:center; border: 1px solid var(--danger);">
<h2 style="margin-top:0; color:var(--danger);">🔌 <span data-i18n="btnHat">RESET HAT</span> 🔌</h2> <h2 style="margin-top:0; color:var(--danger); font-weight:300;" data-i18n="btnHat">[ RST_HAT ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" id="reset-hat-desc">Do you want to send a PHYSICAL RESET to the radio board?</p> <p style="margin-bottom:25px; font-weight: 300;" id="reset-hat-desc">PHYSICAL RESET?</p>
<div style="display:flex; flex-direction:column; gap:15px;"> <div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executeHatReset()" class="btn-cmd blink" style="background:var(--danger); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="btnConfReset">⚠️ CONFIRM RESET</button> <button onclick="executeHatReset()" class="btn-cmd blink" style="border-color:var(--danger); color:var(--danger) !important;" data-i18n="btnConfReset">CONFIRM</button>
<button onclick="closeHatResetModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;" data-i18n="btnCancel">CANCEL</button> <button onclick="closeHatResetModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div> </div>
</div> </div>
</div> </div>
<div id="update-modal" class="modal-overlay"> <div id="update-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:400px; text-align:center; border: 1px solid var(--accent);"> <div class="modal-content" style="max-width:400px; text-align:center;">
<h2 style="margin-top:0; color:var(--accent);">🔄 <span data-i18n="modUpdateTitle">GLOBAL UPDATE</span> 🔄</h2> <h2 style="margin-top:0; color:var(--primary); border-bottom: 1px dashed var(--border-main); padding-bottom: 10px; font-weight:300;" data-i18n="modUpdateTitle">[ GBL_UPDATE ]</h2>
<p style="margin-bottom:25px; color:var(--text-main); font-weight: 600;" data-i18n="confUpdate">Do you want to request updated data from all nodes in the fleet?</p> <p style="margin-bottom:25px; font-weight: 300;" data-i18n="confUpdate">REQ DATA?</p>
<div style="display:flex; flex-direction:column; gap:15px;"> <div style="display:flex; flex-direction:column; gap:10px;">
<button onclick="executeUpdateRequest()" class="btn-cmd" style="background:var(--accent); padding:15px; font-size:1.1rem; font-weight:800;" data-i18n="btnReqCfg">🔄 REQ CONFIG</button> <button onclick="executeUpdateRequest()" class="btn-cmd" style="border-color:var(--primary); color:var(--primary) !important;" data-i18n="btnReqCfg">EXECUTE</button>
<button onclick="closeUpdateModal()" class="btn-cmd" style="background:var(--text-muted); padding:12px; margin-top:10px;" data-i18n="btnCancel">CANCEL</button> <button onclick="closeUpdateModal()" class="btn-cmd" data-i18n="btnCancel">ABORT</button>
</div> </div>
</div> </div>
</div> </div>
<div id="versions-modal" class="modal-overlay"> <div id="versions-modal" class="modal-overlay">
<div class="modal-content" style="width:90%; max-width:450px;"> <div class="modal-content" style="max-width:450px;">
<div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); padding-bottom:15px; margin-bottom:15px;"> <div style="display:flex; justify-content:space-between; align-items:center; border-bottom:1px dashed var(--border-main); padding-bottom:10px; margin-bottom:15px;">
<h2 style="margin:0; color:var(--primary);">ℹ️ <span data-i18n="modVersions">Software & Firmware</span></h2> <h2 style="margin:0; color:var(--primary); font-weight:300;" data-i18n="modVersions">[ SW_VERSIONS ]</h2>
<button onclick="closeVersionsModal()" style="background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--danger);">✖</button> <button onclick="closeVersionsModal()" class="btn-cmd" style="border-color:var(--danger); color:var(--danger) !important; width: 24px; height: 24px; flex: 0 0 24px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem;">X</button>
</div>
<div id="versions-list" style="background: #010409; padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; line-height: 1.8; color: var(--text-main);">
</div> </div>
<div id="versions-list" style="background: transparent; padding: 15px; border: 1px solid var(--border-light); font-size: 0.85rem; line-height: 1.8;"></div>
</div> </div>
</div> </div>
@@ -331,16 +323,16 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.2/socket.io.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.2/socket.io.min.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<!-- MOTORE MODULARIZZATO JS --> <!-- MOTORE MODULARIZZATO JS (Cache Buster aggiunto per forzare il refresh) -->
<script src="/static/js/modals.js"></script> <script src="/static/js/modals.js?v=blueprint3"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/app.js?v=blueprint2"></script>
<!-- SERVICE WORKER --> <!-- SERVICE WORKER -->
<script> <script>
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
window.addEventListener('load', () => { window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch(err => { navigator.serviceWorker.register('/sw.js').catch(err => {
console.log('ServiceWorker fallita: ', err); console.log('SW_ERR: ', err);
}); });
}); });
} }