|
|
|
@@ -17,6 +17,18 @@ let fleetMap = null;
|
|
|
|
|
let mapMarkers = {};
|
|
|
|
|
|
|
|
|
|
let currentFocusedNode = null;
|
|
|
|
|
let currentMmdvmConfig = "";
|
|
|
|
|
let currentMmdvmConfigAlias = "";
|
|
|
|
|
let currentMmdvmServiceName = "";
|
|
|
|
|
|
|
|
|
|
// Mappatura Modo -> Gateway service name
|
|
|
|
|
const MODE_GATEWAYS = {
|
|
|
|
|
'DMR': ['dmrgateway'],
|
|
|
|
|
'NXDN': ['nxdngateway'],
|
|
|
|
|
'System Fusion': ['ysfgateway'],
|
|
|
|
|
'D-Star': ['dstargateway', 'dstar-gateway'],
|
|
|
|
|
'P25': ['p25gateway']
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function switchView(viewName) {
|
|
|
|
|
currentFocusedNode = null;
|
|
|
|
@@ -58,6 +70,20 @@ function openNodeFocus(clientId) {
|
|
|
|
|
document.getElementById('view-focus').style.display = 'block';
|
|
|
|
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
|
|
|
|
|
|
|
|
const role = me.role || '';
|
|
|
|
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
|
|
|
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
|
|
|
|
|
|
|
|
|
const modesCard = document.getElementById('focus-modes-card');
|
|
|
|
|
if (modesCard) {
|
|
|
|
|
modesCard.style.display = canControl ? 'block' : 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (canControl) {
|
|
|
|
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--text-muted); font-size: 0.9rem;" class="blink">FETCHING CONFIG...</span>';
|
|
|
|
|
fetchNodeConfigForModes(clientId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
refreshStates();
|
|
|
|
|
refreshLogs();
|
|
|
|
|
}
|
|
|
|
@@ -65,6 +91,8 @@ function openNodeFocus(clientId) {
|
|
|
|
|
function closeNodeFocus() {
|
|
|
|
|
currentFocusedNode = null;
|
|
|
|
|
document.getElementById('view-focus').style.display = 'none';
|
|
|
|
|
const modesCard = document.getElementById('focus-modes-card');
|
|
|
|
|
if (modesCard) modesCard.style.display = 'none';
|
|
|
|
|
switchView(localStorage.getItem('fleetDefaultView') || 'home');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -216,6 +244,215 @@ function sendTgCommand(clientId, comando) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- LOGICA MODI OPERATIVI E GATEWAYS ---
|
|
|
|
|
async function fetchNodeConfigForModes(clientId) {
|
|
|
|
|
const role = me.role || '';
|
|
|
|
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
|
|
|
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
|
|
|
|
const modesCard = document.getElementById('focus-modes-card');
|
|
|
|
|
if (!canControl) {
|
|
|
|
|
if (modesCard) modesCard.style.display = 'none';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (modesCard) modesCard.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const healthObj = globalHealthData[clientId.toLowerCase()];
|
|
|
|
|
if (!healthObj) {
|
|
|
|
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">NO DAEMON DATA YET. RETRYING...</span>';
|
|
|
|
|
setTimeout(() => { if (currentFocusedNode === clientId) fetchNodeConfigForModes(clientId); }, 2000);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let filesList = healthObj.files || healthObj.config_files || [];
|
|
|
|
|
let iniFile = filesList.find(f => String(f).toLowerCase().includes('mmdvm') && String(f).toLowerCase().endsWith('.ini'));
|
|
|
|
|
if(!iniFile) iniFile = "MMDVMHost.ini";
|
|
|
|
|
|
|
|
|
|
let svcName = Object.keys(healthObj.processes || {}).find(k => k.toLowerCase().includes('mmdvm')) || "mmdvmhost";
|
|
|
|
|
currentMmdvmServiceName = svcName;
|
|
|
|
|
|
|
|
|
|
let candidates = ["mmdvm", svcName, "mmdvmhost", iniFile, "MMDVMHost.ini"];
|
|
|
|
|
let foundText = null;
|
|
|
|
|
|
|
|
|
|
for (let candidate of candidates) {
|
|
|
|
|
if(!candidate) continue;
|
|
|
|
|
try {
|
|
|
|
|
let res = await fetch(`/api/config_file/${encodeURIComponent(clientId)}/${encodeURIComponent(candidate)}`);
|
|
|
|
|
let data = await res.json();
|
|
|
|
|
if (data.success && data.data && data.data.raw_text && data.data.raw_text.length > 100) {
|
|
|
|
|
foundText = data.data.raw_text;
|
|
|
|
|
currentMmdvmConfigAlias = candidate; // Alias con cui salvare
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} catch(e) {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (foundText) {
|
|
|
|
|
currentMmdvmConfig = foundText;
|
|
|
|
|
renderModeToggles(clientId);
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('focus-modes-toggles').innerHTML = `
|
|
|
|
|
<div style="display:flex; justify-content:space-between; align-items:center; width: 100%;">
|
|
|
|
|
<span style="color:var(--accent); font-size: 0.8rem;">[!] CFG MEMORY EMPTY</span>
|
|
|
|
|
<button class="btn-cmd" style="border-color:var(--accent); color:var(--accent)!important; width:auto; padding:4px 10px; flex:none;" onclick="fetch('/api/update_nodes', {method: 'POST'}); this.innerText='WAIT...'; setTimeout(() => fetchNodeConfigForModes('${clientId}'), 5000);">[ REQ_DATA ]</button>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
document.getElementById('focus-modes-toggles').innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">NETWORK ERROR</span>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderModeToggles(clientId, statusMsg = "") {
|
|
|
|
|
const role = me.role || '';
|
|
|
|
|
const allowedList = String(me.allowed_nodes || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean);
|
|
|
|
|
let canControl = isAuthenticated && (role === 'admin' || allowedList.includes('all') || allowedList.includes(clientId.toLowerCase()));
|
|
|
|
|
|
|
|
|
|
const modesCard = document.getElementById('focus-modes-card');
|
|
|
|
|
if (modesCard) {
|
|
|
|
|
modesCard.style.display = canControl ? 'block' : 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let container = document.getElementById('focus-modes-toggles');
|
|
|
|
|
if (!container) return;
|
|
|
|
|
|
|
|
|
|
if (!canControl) {
|
|
|
|
|
container.innerHTML = '<span style="color:var(--danger); font-size: 0.9rem;">[ ACCESS DENIED ]</span>';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const modes = [
|
|
|
|
|
{ id: 'DMR', label: 'DMR', color: 'var(--primary)' },
|
|
|
|
|
{ id: 'D-Star', label: 'D-STAR', color: '#f97316' },
|
|
|
|
|
{ id: 'System Fusion', label: 'YSF', color: '#8b5cf6' },
|
|
|
|
|
{ id: 'NXDN', label: 'NXDN', color: 'var(--success)' },
|
|
|
|
|
{ id: 'P25', label: 'P25', color: 'var(--accent)' }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
let html = "";
|
|
|
|
|
let lines = currentMmdvmConfig.split('\n');
|
|
|
|
|
|
|
|
|
|
modes.forEach(m => {
|
|
|
|
|
let enabled = false;
|
|
|
|
|
let sectionFound = false;
|
|
|
|
|
let currentSection = "";
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < lines.length; i++) {
|
|
|
|
|
let line = lines[i].trim();
|
|
|
|
|
if (line.startsWith('[') && line.endsWith(']')) {
|
|
|
|
|
currentSection = line.substring(1, line.length - 1);
|
|
|
|
|
}
|
|
|
|
|
if (currentSection.toLowerCase() === m.id.toLowerCase() && line.toLowerCase().startsWith('enable')) {
|
|
|
|
|
sectionFound = true;
|
|
|
|
|
let parts = line.split('=');
|
|
|
|
|
if (parts.length === 2 && parts[1].trim() === '1') {
|
|
|
|
|
enabled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sectionFound) {
|
|
|
|
|
let btnStyle = enabled
|
|
|
|
|
? `border-color: ${m.color}; color: ${m.color} !important; box-shadow: inset 0 0 8px ${m.color}; font-weight: bold;`
|
|
|
|
|
: `border-color: var(--border-light); color: var(--text-muted) !important; opacity: 0.4;`;
|
|
|
|
|
|
|
|
|
|
html += `<button class="btn-cmd" style="padding: 10px 15px; font-size: 1.1rem; width: auto; flex: 1; min-width: 80px; transition: all 0.2s ease; ${btnStyle}" onclick="toggleOperatingMode('${clientId}', '${m.id}', ${!enabled})">${m.label}</button>`;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (html === "") html = '<span style="color:var(--text-muted); font-size: 0.9rem;">NO MODES FOUND IN CONFIG</span>';
|
|
|
|
|
|
|
|
|
|
if (statusMsg) {
|
|
|
|
|
html += `<div style="width: 100%; margin-top: 8px; font-family: 'JetBrains Mono', monospace;">${statusMsg}</div>`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
container.innerHTML = html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toggleOperatingMode(clientId, section, enable) {
|
|
|
|
|
const title = currentLang === 'it' ? "[ CAMBIO_MODO ]" : "[ MODE_TOGGLE ]";
|
|
|
|
|
const msg = currentLang === 'it'
|
|
|
|
|
? `Vuoi ${enable ? 'ABILITARE' : 'DISABILITARE'} il modo <b>${section}</b>?<br><br><span style="font-size:0.8rem; color:var(--text-muted);">Verranno aggiornati MMDVMHost e il relativo Gateway.</span>`
|
|
|
|
|
: `${enable ? 'ENABLE' : 'DISABLE'} mode <b>${section}</b>?<br><br><span style="font-size:0.8rem; color:var(--text-muted);">This will update MMDVMHost and its Gateway.</span>`;
|
|
|
|
|
|
|
|
|
|
customConfirm(title, msg, enable ? "var(--success)" : "var(--danger)", async () => {
|
|
|
|
|
// 1. Aggiorna subito il testo locale del file INI
|
|
|
|
|
let lines = currentMmdvmConfig.split('\n');
|
|
|
|
|
let currentSection = "";
|
|
|
|
|
for (let i = 0; i < lines.length; i++) {
|
|
|
|
|
let cleanLine = lines[i].trim();
|
|
|
|
|
if (cleanLine.startsWith('[') && cleanLine.endsWith(']')) {
|
|
|
|
|
currentSection = cleanLine.substring(1, cleanLine.length - 1);
|
|
|
|
|
}
|
|
|
|
|
if (currentSection.toLowerCase() === section.toLowerCase() && cleanLine.toLowerCase().startsWith('enable')) {
|
|
|
|
|
lines[i] = lines[i].replace(/Enable\s*=\s*[01]/i, `Enable=${enable ? "1" : "0"}`);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
currentMmdvmConfig = lines.join('\n');
|
|
|
|
|
|
|
|
|
|
// 2. Ridisegna SUBITO i pulsanti (così il tasto cambia stato all'istante) e mostra la nota di caricamento
|
|
|
|
|
renderModeToggles(clientId, '<span style="color:var(--accent); font-size:0.8rem;" class="blink">⏳ SALVATAGGIO & RIAVVIO IN CORSO...</span>');
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 3. Salva il file INI
|
|
|
|
|
const resSave = await fetch('/api/config_file', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {'Content-Type': 'application/json'},
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
clientId: clientId,
|
|
|
|
|
service: currentMmdvmConfigAlias,
|
|
|
|
|
config_data: { "raw_text": currentMmdvmConfig }
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
const dataSave = await resSave.json();
|
|
|
|
|
if (!dataSave.success) throw new Error("SAVE ERR: " + dataSave.error);
|
|
|
|
|
|
|
|
|
|
// 4. Invia start/stop al Gateway associato
|
|
|
|
|
const healthObj = globalHealthData[clientId.toLowerCase()] || {};
|
|
|
|
|
const gwCandidates = MODE_GATEWAYS[section] || [];
|
|
|
|
|
const runningProcs = Object.keys(healthObj.processes || {});
|
|
|
|
|
const targetGw = gwCandidates.find(g => runningProcs.some(p => p.toLowerCase() === g.toLowerCase()));
|
|
|
|
|
|
|
|
|
|
if (targetGw) {
|
|
|
|
|
const gwAction = enable ? 'start' : 'stop';
|
|
|
|
|
await fetch('/api/service_control', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {'Content-Type': 'application/json'},
|
|
|
|
|
body: JSON.stringify({ clientId: clientId, service: targetGw, action: gwAction })
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 5. Riavvia MMDVMHost
|
|
|
|
|
const resRst = await fetch('/api/service_control', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {'Content-Type': 'application/json'},
|
|
|
|
|
body: JSON.stringify({ clientId: clientId, service: currentMmdvmServiceName, action: 'restart' })
|
|
|
|
|
});
|
|
|
|
|
const dataRst = await resRst.json();
|
|
|
|
|
if (!dataRst.success) throw new Error("RESTART ERR: " + dataRst.error);
|
|
|
|
|
|
|
|
|
|
// 6. Conferma avvenuta applicazione senza ricaricare file vecchi
|
|
|
|
|
renderModeToggles(clientId, '<span style="color:var(--success); font-size:0.8rem;">✅ STATO AGGIORNATO CON SUCCESSO!</span>');
|
|
|
|
|
|
|
|
|
|
// Rimuove il messaggio di conferma dopo 3 secondi lasciando i bottoni nello stato nuovo
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
if (currentFocusedNode === clientId) {
|
|
|
|
|
renderModeToggles(clientId);
|
|
|
|
|
}
|
|
|
|
|
}, 3000);
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
customAlert(t('titleError'), String(e), true);
|
|
|
|
|
fetchNodeConfigForModes(clientId);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- INIT APP ---
|
|
|
|
|
async function initUI() {
|
|
|
|
|
applyTranslations();
|
|
|
|
|
try {
|
|
|
|
@@ -473,7 +710,6 @@ async function refreshStates() {
|
|
|
|
|
let txModeStr = "TX";
|
|
|
|
|
let isIdle = telemetryObj.idle === true;
|
|
|
|
|
|
|
|
|
|
// 1. Usa la logica ORIGINALE, testando solo il contenuto di ts1, ts2 e alt per capire se stiamo trasmettendo.
|
|
|
|
|
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
|
|
|
|
let altText = telemetryObj.alt.toUpperCase();
|
|
|
|
|
if (altText.includes("NXDN")) { activeModeColor = "var(--success)"; txModeStr = "TX NXDN"; }
|
|
|
|
@@ -499,7 +735,6 @@ async function refreshStates() {
|
|
|
|
|
cardDiv.dataset.status = isOnline ? 'online' : 'offline';
|
|
|
|
|
renderSeen(c, data, isOnline);
|
|
|
|
|
|
|
|
|
|
// Gestione Avvisi
|
|
|
|
|
const warns = (data.warnings && data.warnings[c.id.toLowerCase()]) || [];
|
|
|
|
|
cardDiv.dataset.hasWarn = (warns.length > 0) ? 'true' : 'false';
|
|
|
|
|
const diagDiv = document.getElementById(`diag-warn-${c.id}`);
|
|
|
|
@@ -513,7 +748,6 @@ async function refreshStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Intestazione Card
|
|
|
|
|
const nameSpan = cardDiv.querySelector('.client-name');
|
|
|
|
|
const idBadge = cardDiv.querySelector('.badge-id');
|
|
|
|
|
const typeBadge = document.getElementById(`type-badge-${c.id}`);
|
|
|
|
@@ -532,7 +766,6 @@ async function refreshStates() {
|
|
|
|
|
if (typeBadge) typeBadge.style.display = 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Timeslots
|
|
|
|
|
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}`);
|
|
|
|
|
|
|
|
|
|
if (telemetryObj.alt && telemetryObj.alt !== "") {
|
|
|
|
@@ -632,8 +865,16 @@ async function refreshStates() {
|
|
|
|
|
if (healthContainer) healthContainer.style.display = 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Logica tollerante per i Gateway in standby (spenti dalla UI)
|
|
|
|
|
let hasOfflineService = false;
|
|
|
|
|
if (healthObj && healthObj.processes) { for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) { if (svcStatus.toLowerCase() !== 'online') { hasOfflineService = true; break; } } }
|
|
|
|
|
if (healthObj && healthObj.processes) {
|
|
|
|
|
for (const [svcName, svcStatus] of Object.entries(healthObj.processes)) {
|
|
|
|
|
let s = svcStatus.toLowerCase();
|
|
|
|
|
if (s !== 'online' && s !== 'standby') {
|
|
|
|
|
hasOfflineService = true; break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const warnBadge = document.getElementById(`svc-warn-${c.id}`); const btnSvc = document.getElementById(`btn-svc-${c.id}`);
|
|
|
|
|
if (warnBadge) warnBadge.style.display = hasOfflineService ? 'block' : 'none';
|
|
|
|
|
if (btnSvc) { if (hasOfflineService) { btnSvc.style.borderColor = 'var(--danger)'; btnSvc.style.color = 'var(--danger)'; } else { btnSvc.style.borderColor = 'var(--text-main)'; btnSvc.style.color = 'var(--text-main)'; } }
|
|
|
|
@@ -651,17 +892,14 @@ async function refreshStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. TIMEOUT LOCALE PER L'EFFETTO CODA VISIVO (Sostituisce il check di isIdle)
|
|
|
|
|
let timeSinceTx = 0;
|
|
|
|
|
if (isTx && isOnline) {
|
|
|
|
|
if (isTx && isOnline && !isIdle) {
|
|
|
|
|
cardDiv.dataset.lastTx = Date.now();
|
|
|
|
|
} else {
|
|
|
|
|
timeSinceTx = Date.now() - (parseInt(cardDiv.dataset.lastTx) || 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// L'interfaccia mantiene lo stato solo se non sta trasmettendo E se sono passati meno di 6 secondi (Hold).
|
|
|
|
|
// In questo modo i micro-pacchetti D-STAR che non inviano l'end di chiamata svaniranno dopo 6s per forza.
|
|
|
|
|
let isHold = (!isTx && timeSinceTx < 6000);
|
|
|
|
|
let isHold = (!isTx && !isIdle && timeSinceTx < 6000);
|
|
|
|
|
|
|
|
|
|
let displayState = stateValue;
|
|
|
|
|
let statusColor = "";
|
|
|
|
@@ -671,7 +909,7 @@ async function refreshStates() {
|
|
|
|
|
if (!isOnline) {
|
|
|
|
|
displayState = stateValue;
|
|
|
|
|
cBorder = "var(--border-light)";
|
|
|
|
|
} else if (isTx) {
|
|
|
|
|
} else if (isTx && !isIdle) {
|
|
|
|
|
displayState = `( ${txModeStr} )`;
|
|
|
|
|
statusColor = activeModeColor;
|
|
|
|
|
statusBorder = activeModeColor;
|
|
|
|
@@ -680,12 +918,8 @@ async function refreshStates() {
|
|
|
|
|
displayState = `[ ${txModeStr.replace("TX ", "")} ]`;
|
|
|
|
|
statusColor = activeModeColor;
|
|
|
|
|
statusBorder = activeModeColor;
|
|
|
|
|
} else {
|
|
|
|
|
// Quando scade l'Hold, FORZIAMO la scomparsa di ogni traccia di D-STAR / YSF
|
|
|
|
|
isIdle = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Applica i calcoli alla Card Principale
|
|
|
|
|
if (isOnline) {
|
|
|
|
|
cardDiv.classList.add('online'); statusDiv.classList.remove('status-offline');
|
|
|
|
|
} else {
|
|
|
|
@@ -699,7 +933,6 @@ async function refreshStates() {
|
|
|
|
|
statusDiv.style.borderColor = statusBorder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Applica i calcoli alla Mini Card in HOME
|
|
|
|
|
const miniCard = document.getElementById(`mini-card-${c.id}`);
|
|
|
|
|
const miniStatus = document.getElementById(`mini-status-${c.id}`);
|
|
|
|
|
if (miniCard && miniStatus) {
|
|
|
|
@@ -723,7 +956,7 @@ async function refreshStates() {
|
|
|
|
|
let mColor = "var(--success)";
|
|
|
|
|
let mBorderColor = "var(--border-light)";
|
|
|
|
|
|
|
|
|
|
if (isTx) {
|
|
|
|
|
if (isTx && !isIdle) {
|
|
|
|
|
mcBorder = activeModeColor;
|
|
|
|
|
mStatus = `( ${txModeStr} )`;
|
|
|
|
|
mColor = activeModeColor;
|
|
|
|
@@ -749,7 +982,6 @@ async function refreshStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Applica i calcoli al Nodo Singolo (Focus Mode)
|
|
|
|
|
if (currentFocusedNode === c.id) {
|
|
|
|
|
let focusStatus = document.getElementById('focus-status');
|
|
|
|
|
|
|
|
|
@@ -757,7 +989,7 @@ async function refreshStates() {
|
|
|
|
|
let fsColor = isOnline ? 'var(--success)' : 'var(--danger)';
|
|
|
|
|
|
|
|
|
|
if (isOnline) {
|
|
|
|
|
if (isTx) {
|
|
|
|
|
if (isTx && !isIdle) {
|
|
|
|
|
fsState = `( ${txModeStr} )`;
|
|
|
|
|
fsColor = activeModeColor;
|
|
|
|
|
} else if (isHold) {
|
|
|
|
@@ -769,8 +1001,8 @@ async function refreshStates() {
|
|
|
|
|
focusStatus.innerText = fsState;
|
|
|
|
|
focusStatus.style.color = fsColor;
|
|
|
|
|
|
|
|
|
|
let focusLedColor = isOnline ? (isTx ? activeModeColor : 'var(--success)') : 'var(--border-light)';
|
|
|
|
|
let focusLedBg = (isOnline && isTx) ? activeModeColor : 'transparent';
|
|
|
|
|
let focusLedColor = isOnline ? (isTx && !isIdle ? activeModeColor : 'var(--success)') : 'var(--border-light)';
|
|
|
|
|
let focusLedBg = (isOnline && isTx && !isIdle) ? activeModeColor : 'transparent';
|
|
|
|
|
document.getElementById('focus-name').innerHTML = `<span style="display:inline-block; border-radius:50%; width:20px; height:20px; border:2px solid ${focusLedColor}; background:${focusLedBg}"></span> ${esc(genObj ? genObj.callsign : c.name)}`;
|
|
|
|
|
|
|
|
|
|
document.getElementById('focus-id').innerText = `NET-ID: ${genObj ? genObj.radio_id : c.id.toUpperCase()}`;
|
|
|
|
@@ -801,6 +1033,11 @@ async function refreshStates() {
|
|
|
|
|
}
|
|
|
|
|
document.getElementById('focus-ts').innerHTML = focusTsHtml || "--";
|
|
|
|
|
|
|
|
|
|
const modesCard = document.getElementById('focus-modes-card');
|
|
|
|
|
if (modesCard) {
|
|
|
|
|
modesCard.style.display = canControl ? 'block' : 'none';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const focusControls = document.getElementById('focus-controls');
|
|
|
|
|
if (canControl || showReboot) {
|
|
|
|
|
focusControls.style.display = 'block';
|
|
|
|
|