From ddad65fe90836cc4c03ac7c95a4fd5eac84c51c2 Mon Sep 17 00:00:00 2001 From: bloqaudio Date: Sun, 13 Sep 2026 11:15:33 -0500 Subject: [PATCH] web: keep a VLAN's row when its details cannot be read The VLAN table is one /vlanlist plus one /vlan.json per VLAN. A failed per-VLAN request rejected the chain, so every VLAN after it was missing from the table, indistinguishable from VLANs that do not exist. Keep the row with the id and name from the list and a ? in the port columns. --- html/app.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/html/app.js b/html/app.js index a867af90..91f33b2e 100644 --- a/html/app.js +++ b/html/app.js @@ -1091,18 +1091,21 @@ function vlanRefresh(){ tb.innerHTML=""; var p=Promise.resolve(); vl.forEach(function(v){ - p=p.then(function(){return getJSON("/vlan.json?vid="+v.id)}).then(function(d){ - var m=parseInt(d.members,16),mem=m&0x3ff,unt=((m>>10)&0x3ff)&mem; - var pv=parseInt(d.pvid,16)&0x3ff; + p=p.then(function(){return getJSON("/vlan.json?vid="+v.id).catch(function(){return null})}).then(function(d){ var tr=tb.insertRow(); tr.insertCell().appendChild(h("a",{href:"#vlan",text:String(v.id),onclick:function(e){ e.preventDefault();$("vvid").value=v.id;vlanLoad(); }})); tr.insertCell().textContent=v.name||""; - tr.insertCell().textContent=rangeStr(maskToPorts(mem)); - tr.insertCell().textContent=rangeStr(maskToPorts(mem&~unt)); - tr.insertCell().textContent=rangeStr(maskToPorts(unt)); - tr.insertCell().textContent=rangeStr(maskToPorts(pv)); + if(!d){for(var c=0;c<4;c++)tr.insertCell().textContent="?";} + else{ + var m=parseInt(d.members,16),mem=m&0x3ff,unt=((m>>10)&0x3ff)&mem; + var pv=parseInt(d.pvid,16)&0x3ff; + tr.insertCell().textContent=rangeStr(maskToPorts(mem)); + tr.insertCell().textContent=rangeStr(maskToPorts(mem&~unt)); + tr.insertCell().textContent=rangeStr(maskToPorts(unt)); + tr.insertCell().textContent=rangeStr(maskToPorts(pv)); + } var del=tr.insertCell(); if(v.id!==1)del.appendChild(h("button",{class:"ctl",text:"\u2715",title:t("v_del_t"),onclick:function(){ confirmModal(t("v_del_q",{n:v.id}),t("v_del_d"),function(){