diff --git a/files/www/cgi-bin/mesh b/files/www/cgi-bin/mesh index c0217065..618d5df4 100755 --- a/files/www/cgi-bin/mesh +++ b/files/www/cgi-bin/mesh @@ -512,6 +512,7 @@ if not next(localhosts) and not next(links) then end -- show local node table + html.print("") html.print("") html.print("") @@ -523,24 +524,37 @@ if next(localhosts) then local rows = {} for ip, host in pairs(localhosts) do + local c1, c2, c3 local localpart = host.name:match("([^.]*)%.") if localpart then local tactical = "" if host.tactical ~= "" then tactical = " / " .. host.tactical end - local row = "" -- add locally advertised dmz hosts for i, dmzhost in ipairs(host.hosts) @@ -564,22 +578,29 @@ if next(localhosts) then local localpart = dmzhost:match("(.*)%.local%.mesh") if localpart then if not nopropd and not aliased then - row = row .. "" + c2 = c2 .. localpart .. "
" elseif aliased then - row = row .. "" + c2 = c2 .. "" .. localpart .. "
" else - row = row .. "" + c2 = c2 .. "" .. localpart .. "
" end if services[dmzhost] then - row = row .. "" end end + -- Build this row + local row = "" rows[#rows + 1] = { key = host.name, row = row } end end @@ -596,16 +617,15 @@ end -- discard localhosts = nil - -- end local node table html.print("
" .. localpart .. tactical + c1 = localpart .. tactical if wangateway[ip] then - row = row .. "   (wan)" + c1 = c1 .. "   (wan)" end - row = row .. "" + c2 = "
" if services[host.name] then - for n, v in pairs(services[host.name]) + local i=1 + for _, v in pairs(services[host.name]) do - row = row .. v .. "
" + if c3 then + c3 = c3 .. v .. "
" + else + c3 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 + end + else + if c3 then + c3 = c3 .. "
" + else + c3 = "
" end end - row = row .. "
" .. localpart .. "
" .. localpart .. "
" .. localpart .."" + local i=1 for n, v in pairs(services[dmzhost]) do - row = row .. v .. "
" + if c3 then + c3 = c3 .. v .. "
" + else + c3 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 end end - row = row .. "
" .. c1 .. "" .. c2 .. "" .. c3 .. "
") -- show current neighbors table + html.print("
") html.print("") html.print("") html.print("") ---html.print("") html.print("") html.print("") @@ -613,6 +633,7 @@ local rows = {} local neighservices = {} for ip, link in pairs(links) do + local c1,c2,c3,c4,c5,c6 local ipmain = ipalias[ip] if not ipmain then ipmain = ip @@ -637,7 +658,7 @@ do name = name .. " " -- avoid collision 2 links to same host {rf, dtd} end local no_space_host = name:match("(.*%S)%s*$") - local row = "", 100 * link.lq, 100 * link.nlq, link.mbps) + c2 = "
" + c3 = string.format("%.0f%%", 100 * link.lq) + c4 = string.format("%.0f%%", 100 * link.nlq) + c5 = string.format("%s", link.mbps) + -- print node services if any if not neighservices[name] then neighservices[name] = true - row = row .. "" -- add advertised dmz hosts if host then @@ -677,20 +713,32 @@ do do local localpart = dmzhost:match("(.*)%.local%.mesh") if localpart then - row = row .. "" - row = row .. "" end end end end - + -- Build this row + local row = "" rows[#rows + 1] = { key = name, row = row } end if #rows > 0 then @@ -746,7 +794,7 @@ do end end if #rows > 0 then - html.print("") + html.print("") table.sort(rows, function(a,b) return a.key < b.key end) for _, row in ipairs(rows) do @@ -755,11 +803,11 @@ if #rows > 0 then -- discard rows = nil end - -- end current neighbors table html.print("
LQNLQTxMbpsService Name
" .. localpart .. tactical .. "" + c1 = "" .. localpart .. tactical .. "" local nodeiface if ipmain ~= ip then if links[ip].dtd then @@ -656,20 +677,35 @@ do end end if nodeiface then - row = row .. "   (" .. nodeiface .. ")" + c1 = c1 .. "   (" .. nodeiface .. ")" end - row = row .. string.format("%.0f%%%.0f%%%s" if services[name] then + local i=1 for _, v in pairs(services[name]) do - row = row .. v .. "
" + if c6 then + c6 = c6 .. v .. "
" + else + c6 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 + end + else + if c6 then + c6 = c6 .. "
" + else + c6 = "
" end end - row = row .. "
" .. localpart .. "" + c2 = c2 .. localpart .. "
" if services[dmzhost] then + local i=1 for _, v in pairs(services[dmzhost]) do - row = row .. v .. "
" + if c6 then + c6 = c6 .. v .. "
" + else + c6 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 + end + else + if c6 then + c6 = c6 .. "
" + else + c6 = "
" end end - row = row .. "
" .. c1 .. "" .. c2 .. "" .. c3 .. "" .. c4 .. "" .. c5 .. "" .. c6 .. "
Previous Neighbors
Previous Neighbors
") -- show remote node table + html.print("
") html.print("") html.print("") html.print("") - local rows = {} for ip, host in pairs(hosts) do + local c1,c2,c3,c4 if not neighbor[ip] and host.name then local localpart = host.name:match("(.*)%.local%.mesh") if localpart then @@ -779,7 +827,7 @@ do tactical = " / " .. host.tactical end local etx = string.format("%.2f", host.etx) - local row = "" -- add locally advertised dmz hosts for _, dmzhost in ipairs(host.hosts) do local localpart = dmzhost:match("(.*)%.local%.mesh") if localpart then - row = row .. "" end end - + -- Build this row + local row = "" rows[#rows + 1] = { key = host.etx, row = row } end end @@ -857,7 +933,6 @@ links = nil ipalias = nil hosts = nil history = nil - -- end remote nodes table html.print("
") @@ -767,10 +815,10 @@ html.print("ETX") html.print("
" .. localpart .. tactical .. "" + c1 = "" .. localpart .. tactical .. "" local nodeiface local mycount = 0 if midcount[ip] then @@ -802,33 +850,61 @@ do end end if nodeiface then - row = row .. "   (" .. nodeiface .. ")" + c1 = c1 .. "   (" .. nodeiface .. ")" end - row = row .. "" .. etx .. "" + c2 = "
" + c3 = string.format("%s", etx) + + -- print node services if any if services[host.name] then + local i=1 for _, v in pairs(services[host.name]) do - row = row .. v .. "
" + if c4 then + c4 = c4 .. v .. "
" + else + c4 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 + end + else + if c4 then + c4 = c4 .. "
" + else + c4 = "
" end end - row = row .. "
" .. localpart .. "" + c2 = c2 .. localpart .. "
" if services[dmzhost] then + local i=1 for _, v in pairs(services[dmzhost]) do - row = row .. v .. "
" + if c4 then + c4 = c4 .. v .. "
" + else + c4 = v .. "
" + end + if i > 1 then c2 = c2 .. "
" end + i=i+1 + end + else + if c4 then + c4 = c4 .. "
" + else + c4 = "
" end end - row = row .. "
" .. c1 .. "" .. c2 .. "" .. c3 .. "" .. c4 .. "
") @@ -889,4 +964,3 @@ html.print([[ html.footer(); html.print("") html.print("") -