Verify packet PTT readiness and isolate manual VHF forwarding status
This commit is contained in:
1 parent
9bb62cf731
commit
abfc8be078
7 files changed
+16
-7
No files matched your search
@@ -10,9 +10,9 @@ const rules=(values,kind)=>!values.length?'Nessuna regola esplicita':values.incl
|
||||
const bands=p=>p.times.length?p.times.map(t=>t.replace(/^(\d{2})(\d{2})-(\d{2})(\d{2})$/,'$1:$2–$3:$4')).join(' · '):'00:00–23:59';
|
||||
function render(){if(!data)return;$('#forward-restore').hidden=!(data.manualSession?.restoring&&data.manualSession?.error);const focused=document.activeElement,focusPeer=focused.closest?.('[data-forward-row]')?.dataset.forwardRow,focusKind=focused.matches?.('[data-forward-start]')?'[data-forward-start]':focused.matches?.('.forward-toggle')?'.forward-toggle':null;const profiles=[...data.profiles].sort((a,b)=>Number(b.enabled&&b.configured)-Number(a.enabled&&a.configured)||Number(b.transport==='Radio')-Number(a.transport==='Radio')||a.call.localeCompare(b.call)),total=profiles.reduce((a,p)=>a+(p.manualOnly?0:p.queued||0),0);$('#forward-summary').innerHTML=[['Percorsi',profiles.length],['Automatici',profiles.filter(p=>p.enabled&&p.configured).length],['Messaggi in coda',total+(profiles.some(p=>p.queued===null)?' + ?':'')],['Sessioni attive',profiles.filter(p=>p.active).length]].map(([label,n])=>'<div><span>'+label+'</span><strong>'+n+'</strong></div>').join('');const errors=[...data.errors,...(data.manualSession?.error?[data.manualSession.error]:[])];$('#forward-error').hidden=!errors.length;$('#forward-error').textContent=errors.join(' · ');$('#forward-updated').textContent='Aggiornato '+time(data.updatedAt)+' · '+mailTimezone();
|
||||
$('#forward-partners').innerHTML='<div class="card forward-table-wrap"><table class="forward-table"><thead><tr><th>Partner / percorso</th><th>Stato</th><th>Coda</th><th>Ultimo scambio</th><th>TX / RX</th><th>Programmazione</th><th>Prossimo · stima</th><th>Azioni</th></tr></thead><tbody>'+profiles.map(p=>{
|
||||
const requested=pending.get(p.call),requestWaiting=requested&&Date.now()-requested<30000,blocked=p.active||requestWaiting||(p.transport==='Radio'&&(data.radio?.active||data.radio?.connecting)),last=p.last;
|
||||
const status=p.active?(p.preparing?'Preparazione radio':state(last?.status)):requestWaiting?'Richiesta inviata':!p.configured?'Non configurato':p.manualOnly?'Solo manuale':p.enabled?'Automatico':'Disattivato';
|
||||
const next=p.active?'Sessione in corso':p.manualOnly?'Solo su richiesta':!p.enabled?'Automatico disattivo':!p.configured?'Script assente':p.nextEstimated?time(p.nextEstimated):!p.reverse&&p.queued===0?'In attesa di messaggi':'Timer non disponibile';
|
||||
const requested=pending.get(p.call),requestWaiting=requested&&Date.now()-requested<30000,blocked=p.reservedBy||p.active||requestWaiting||(p.transport==='Radio'&&(data.radio?.active||data.radio?.connecting)),last=p.last;
|
||||
const status=p.reservedBy?'Riservato al percorso VHF':p.active?(p.preparing?'Preparazione radio':state(last?.status)):requestWaiting?'Richiesta inviata':!p.configured?'Non configurato':p.manualOnly?'Solo manuale':p.enabled?'Automatico':'Disattivato';
|
||||
const next=p.reservedBy?'Attende fine percorso VHF':p.active?'Sessione in corso':p.manualOnly?'Solo su richiesta':!p.enabled?'Automatico disattivo':!p.configured?'Script assente':p.nextEstimated?time(p.nextEstimated):!p.reverse&&p.queued===0?'In attesa di messaggi':'Timer non disponibile';
|
||||
const isOpen=expanded===p.call;
|
||||
return `<tr class="forward-row ${isOpen?'expanded':''}" data-forward-row="${esc(p.call)}" tabindex="0" aria-expanded="${isOpen}"><td><button class="forward-toggle" aria-expanded="${isOpen}" aria-controls="forward-detail-${esc(p.call)}" aria-label="Dettagli ${esc(p.call)}"><span class="forward-chevron" aria-hidden="true">›</span><span><b>${esc(p.label||p.call)}</b><small>${esc(p.transport)}${p.driver?' · '+esc(p.driver):''}</small></span></button></td><td><span class="forward-status ${p.active?'live':!p.configured?'muted':''}">${esc(status)}</span></td><td class="forward-queue">${p.queued??'—'}</td><td>${esc(time(last?.startedAt).replace(/:\d{2}$/,''))}<small class="forward-outcome ${last?.status==='failed'?'failed':''}">${esc(last?state(last.status):'Nessuna sessione recente')}</small></td><td>${last?last.sent+' / '+last.received:'—'}</td><td>${p.manualOnly?'Solo manuale':esc(interval(p.interval))}<small>${p.manualOnly?esc(p.frequency.join(' MHz ')):esc(bands(p))+' · '+(p.timesLocal?'locale BPQ':'UTC')}</small></td><td>${esc(next)}<small>${p.nextEstimated?esc(mailTimezone()):''}</small></td><td class="forward-sync-cell"><button class="secondary" data-forward-start="${esc(p.call)}" ${!p.configured||blocked?'disabled':''}>${p.active?'In corso':requestWaiting?'Richiesta inviata…':p.manualOnly?'Avvia manualmente':'↻ Sincronizza ora'}</button>${p.transport==='Radio'&&(data.radio?.active||data.radio?.connecting)&&!p.active?'<small>Modem impegnato</small>':''}<span class="forward-feedback" role="status" data-feedback="${esc(p.call)}"></span></td></tr><tr class="forward-detail-row" ${isOpen?'':'hidden'}><td colspan="8"><div id="forward-detail-${esc(p.call)}" role="region" aria-label="Dettagli ${esc(p.call)}" class="forward-details">${isOpen?details(p):''}</div></td></tr>`;
|
||||
}).join('')+'</tbody></table>'+(!profiles.length?'<p class="empty">Nessun partner di forwarding configurato in BPQ.</p>':'')+'</div>';
|
||||
|
||||
Reference in new issue
Block a user