mirror of https://github.com/aredn/aredn.git
Fix display of previous neighbors (#1133)
This commit is contained in:
parent
f75e4d9675
commit
4337fc6393
|
@ -899,10 +899,12 @@ do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cn = {}
|
||||||
if #rows > 0 then
|
if #rows > 0 then
|
||||||
table.sort(rows, function(a,b) return a.key < b.key end)
|
table.sort(rows, function(a,b) return a.key < b.key end)
|
||||||
for _, row in ipairs(rows)
|
for _, row in ipairs(rows)
|
||||||
do
|
do
|
||||||
|
cn[row.key] = true
|
||||||
html.print(row.row)
|
html.print(row.row)
|
||||||
end
|
end
|
||||||
-- discard
|
-- discard
|
||||||
|
@ -924,31 +926,32 @@ do
|
||||||
else
|
else
|
||||||
host = host:gsub("^mid%d+%.", ""):gsub("^dtdlink%.", "")
|
host = host:gsub("^mid%d+%.", ""):gsub("^dtdlink%.", "")
|
||||||
end
|
end
|
||||||
local row = "<tr><td style='color:sienna;'>" .. host
|
if not cn[host:lower()] then
|
||||||
if hosts[ip] and hosts[ip].hosts then
|
local row = "<tbody style='color:sienna;'><tr><td>" .. host .. "</td><td colspan=7></td><td style='text-align:left'>"
|
||||||
for _, v in ipairs(hosts[ip].hosts)
|
if age < 3600 then
|
||||||
do
|
local val = math.floor(age / 60)
|
||||||
row = row .. "<br>" .. v
|
if val == 1 then
|
||||||
end
|
row = row .. "1 minute ago</td></tr>"
|
||||||
end
|
else
|
||||||
row = row .. "</td><td style='color:sienna;'>"
|
row = row .. val .. " minutes ago</td></tr>"
|
||||||
if age < 3600 then
|
end
|
||||||
local val = math.floor(age / 60)
|
|
||||||
if val == 1 then
|
|
||||||
row = row .. "1 minute ago"
|
|
||||||
else
|
else
|
||||||
row = row .. val .. " minutes ago"
|
local val = string.format("%.1f", age / 3600)
|
||||||
end
|
if val == "1.0" then
|
||||||
else
|
row = row .. "1 hour ago</td></tr>"
|
||||||
local val = string.format("%.1f", age / 3600)
|
else
|
||||||
if val == "1.0" then
|
row = row .. val .. " hours ago</td></tr>"
|
||||||
row = row .. "1 hour ago"
|
end
|
||||||
else
|
|
||||||
row = row .. val .. " hours ago"
|
|
||||||
end
|
end
|
||||||
|
if hosts[ip] and hosts[ip].hosts then
|
||||||
|
for _, v in ipairs(hosts[ip].hosts)
|
||||||
|
do
|
||||||
|
row = row .. "<tr><td></td><td colspan=8>" .. v .. "</td></tr>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
row = row .. "</tbody>"
|
||||||
|
rows[#rows + 1] = { key = age, row = row }
|
||||||
end
|
end
|
||||||
row = row .. "</td></tr>"
|
|
||||||
rows[#rows + 1] = { key = age, row = row }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if #rows > 0 then
|
if #rows > 0 then
|
||||||
|
@ -961,6 +964,7 @@ if #rows > 0 then
|
||||||
-- discard
|
-- discard
|
||||||
rows = nil
|
rows = nil
|
||||||
end
|
end
|
||||||
|
cn = nil
|
||||||
-- end current neighbors table
|
-- end current neighbors table
|
||||||
html.print("</table>")
|
html.print("</table>")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue