From a8b5b0b91895bae0dae7a90ecfdadc2705e7a601 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 27 Dec 2019 01:04:31 +1000 Subject: Make the web page look better, and the tables take up less space. --- apt-panopticommon.lua | 2 +- apt-panopticon-report-email-web.lua | 61 ++++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 24e6d08..71e9a9c 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -487,7 +487,7 @@ APT.plurals = function(e, w, t) end if ("" ~= result) and APT.html then result = "" .. result .. "" end end - if "" ~= result then result = " (" .. result .. ")" end + if "" ~= result then result = " " .. result end return result end diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index 60d1b49..079c4cc 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua @@ -81,13 +81,13 @@ local status = function(hosts, host, results, typ) end if to then - result = "[TIMEOUT" + result = "TIMEOUT" if not s then result = result .. "*" end if APT.html then if s then - result = "[TIMEOUT" + result = "TIMEOUT" else - result = "[TIMEOUT*" + result = "TIMEOUT*" end end if APT.html then @@ -96,13 +96,13 @@ local status = function(hosts, host, results, typ) faulty = faulty .. host .. " (" .. typ .. ")\n" end elseif 0 < e then - result = "[FAILED" + result = "FAILED" if not s then result = result .. "*" end if APT.html then if s then - result = "[FAILED" + result = "FAILED" else - result = "[FAILED*" + result = "FAILED*" end end if APT.html then @@ -111,17 +111,17 @@ local status = function(hosts, host, results, typ) faulty = faulty .. host .. " (" .. typ .. ")\n" end else - result = "[OK" + result = "OK" if not s then result = result .. "*" end if APT.html then if s then - result = "[OK" + result = "OK" else - result = "[OK*" + result = "OK*" end end end - return result .. APT.plurals(e, w, t) .. "]" + return result .. APT.plurals(e, w, t) end local m = {} @@ -345,38 +345,41 @@ if nil == web then C("opening mirrors file - " .. e) else "The links in the table and DNS list go to the detailed testing logs.

\n\n" .. "
\n

==== package mirror status " .. os.date("!%F %H:%M") .. " GMT ====

\n" .. - "

[FAILED] or [OK]" .. + "

FAILED or OK" .. " means the tested thing is supported for that mirror.

\n" .. - "

[FAILED*] or [OK*]" .. + "

FAILED* or OK*" .. " means the tested thing is unsupported for that mirror, but might have been tested anyway.

\n" .. - "

[timeout] or [timeout]" .. + "

timeout or timeout" .. " means the mirror had some timeouts, and tests where not yet aborted. The darker colour means unsupported by the mirror, but tested anyway.

" .. - "

[TIMEOUT] or [TIMEOUT]" .. + "

TIMEOUT or TIMEOUT" .. " means the mirror had too many timeouts, and tests where aborted, so there is no result for this test.

" .. "

NOTE: timeouts may be due to a problem on the testing computer.

" .. - "

The DNS round robin (DNS-RR) column shows the IPs for that mirror, or [no] if it isn't part of the DNS-RR.   " .. + "

The DNS round robin (DNS-RR) column shows the IPs for that mirror, or no if it isn't part of the DNS-RR.   " .. "The IPs link to the testing log for that IP accessed via the DNS-RR.   " .. "deb.devuan.org is the DNS-RR itself, so it doesn't get tested directly.

\n" .. "

The time in the Updated column is how often the mirror updates itself.

" .. "

Mirrors with a grey background are not active (though may be usable as part of the DNS-RR).

\n" .. - "

[skip] means that the test hasn't been written yet.

\n" .. + "

skip means that the test hasn't been written yet.

\n" .. "\n" .. "" .. "\n" ) + + local bg = '' for k, v in APT.orderedPairs(APT.mirrors) do local results = APT.collateAll(APT.mirrors, 'results', k) + if '' == bg then bg = " style='background-color:#111111'" else bg = '' end local active = "" if "yes" == v.Active then - web:write(" ") + web:write(" ") else if nil == v.Active then active = 'nil' else active = v.Active end web:write(" ") end - local ftp = "[skip]" + local ftp = "skip" local http = status(APT.mirrors, k, results, "http") local https = status(APT.mirrors, k, results, "https") - local rsync = "[skip]" + local rsync = "skip" local dns = "" local protocol = status(APT.mirrors, k, results, "Protocol") local sanity = status(APT.mirrors, k, results, "URLSanity") @@ -386,7 +389,7 @@ if nil == web then C("opening mirrors file - " .. e) else if nil ~= rate then updated = updated .. ' ' .. rate end local min = tonumber(results.speed.min) local max = tonumber(results.speed.max) - local spd = '' + local spd = '' -- DNS-RR test. if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then @@ -417,12 +420,12 @@ if nil == web then C("opening mirrors file - " .. e) else end end end - if "" == dns then dns = "[no]" end + if "" == dns then dns = "no" end if 0 == max then spd = '' else - spd = string.format('', min, max) + spd = string.format('', min, max) end end @@ -476,6 +479,7 @@ if nil == web then C("opening mirrors file - " .. e) else results = {} m = {} faulty = "" + bg = '' web:write( "
\n

==== Debian mirror status ====

\n" .. "

NOTE - This is not fully probing the Debian mirrors, we just collect some data from any redirects to other servers.   " .. "So this isn't a full set of tests.   Basically we don't know the shape of the Debian mirror infrastructure.

\n" .. @@ -485,18 +489,19 @@ if nil == web then C("opening mirrors file - " .. e) else "" .. "\n") for k, v in APT.orderedPairs(APT.debians) do + if '' == bg then bg = " style='background-color:#111111'" else bg = '' end local results = APT.collateAll(APT.debians, 'results', k) local active = "" if "yes" == v.Active then - web:write(" ") + web:write(" ") else if nil == v.Active then active = 'nil' else active = v.Active end web:write(" ") end - local ftp = "[skip]" + local ftp = "skip" local http = status(APT.debians, k, results, "http") local https = status(APT.debians, k, results, "https") - local rsync = "[skip]" + local rsync = "skip" local dns = "" local protocol = status(APT.debians, k, results, "Protocol") local sanity = status(APT.debians, k, results, "URLSanity") @@ -506,7 +511,7 @@ if nil == web then C("opening mirrors file - " .. e) else if nil ~= rate then updated = updated .. ' ' .. rate end local min = tonumber(results.speed.min) local max = tonumber(results.speed.max) - local spd = '' + local spd = '' -- DNS-RR test. if ("deb.devuan.org" ~= k) and (nil ~= APT.debians["deb.devuan.org"]) then @@ -537,12 +542,12 @@ if nil == web then C("opening mirrors file - " .. e) else end end end - if "" == dns then dns = "[no]" end + if "" == dns then dns = "no" end if 0 == max then spd = '' else - spd = string.format('', min, max) + spd = string.format('', min, max) end end -- cgit v1.1
" .. lnk('FTP') .. "" .. lnk('HTTP') .. "" .. lnk('HTTPS') .. "" .. lnk('RSYNC') .. "" .. lnk('DNS round robin', 'DNS-RR') .. "" .. lnk('Protocol') .. "" .. lnk('URL sanity', 'URL-Sanity') .. "" .. lnk('Integrity') .. "" .. lnk('Updated') .. "" .. lnk('Speed range', 'Speed') .. "
" .. k .. "" .. k .. "
" .. k .. "%d ->%d%d -%d" .. lnk('DNS round robin', 'DNS-RR') .. "" .. lnk('Protocol') .. "" .. lnk('URL sanity', 'URL-Sanity') .. "" .. lnk('Integrity') .. "" .. lnk('Updated') .. "" .. lnk('Speed range', 'Speed') .. "
" .. k .. "
" .. k .. "
" .. k .. "%d ->%d%d -%d