feat(logs): limite configurabile e selettore righe Last Heard con i18n

Aggiunto il supporto per definire il numero di righe del Last Heard tramite configurazione (config.json) e query string (?limit=). Inserito nel frontend un selettore a tendina con persistenza in localStorage ed etichetta bilingue (IT/EN).
This commit is contained in:
2026-10-25 11:54:20 +01:00
parent 69308c4580
commit efca23c64f
5 changed files with 42 additions and 6 deletions
+13 -1
View File
@@ -206,6 +206,11 @@ async function initUI() {
statSelect.innerHTML = opts;
}
const limitSel = document.getElementById('log-limit-select');
if (limitSel) {
limitSel.value = localStorage.getItem('fleetLogLimit') || '60';
}
const grid = document.getElementById('client-grid');
const authContainer = document.getElementById('auth-container');
const role = me.role || '';
@@ -734,9 +739,16 @@ if (isOnline) {
} catch (e) { console.error(e); }
}
function changeLogLimit(val) {
localStorage.setItem('fleetLogLimit', val);
refreshLogs();
}
async function refreshLogs() {
try {
const res = await fetch('/api/logs'); const logs = await res.json();
const savedLimit = localStorage.getItem('fleetLogLimit') || '';
const url = savedLimit ? `/api/logs?limit=${encodeURIComponent(savedLimit)}` : '/api/logs';
const res = await fetch(url); const logs = await res.json();
const tbody = document.getElementById('log-body'); let tableHTML = ""; let networkLogs = {};
logs.forEach(row => {
const time = row[0] ? row[0].split(' ')[1] : "--:--";
+2
View File
@@ -1,6 +1,7 @@
// --- SISTEMA TRADUZIONI (i18n) & HELPERS ---
const i18n = {
en: {
lblLogLimit: "Rows:",
lastTransits: "Lastheard", loginTitle: "🔒 System Login",
thTime: "Time", thRep: "Repeater", thMode: "Mode", thCall: "Callsign", thDur: "Duration",
thUser: "User", thRole: "Role", thNodes: "Nodes", thActs: "Actions",
@@ -31,6 +32,7 @@ const i18n = {
filtAll: "All Nodes", filtOnline: "Online", filtOffline: "Offline", filtAlerts: "⚠️ Alerts"
},
it: {
lblLogLimit: "Righe:",
lastTransits: "Ultimi ascolti", loginTitle: "🔒 Login di Sistema",
thTime: "Ora", thRep: "Ripetitore", thMode: "Modo", thCall: "Nominativo", thDur: "Durata",
thUser: "Utente", thRole: "Ruolo", thNodes: "Nodi", thActs: "Azioni",