From d23c5887921a4af9982aadf8a09141ef226ce573 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Mon, 28 Apr 2025 03:04:31 +0200 Subject: fails --- webstats/plots.js | 53 +++++++++++++++-------------------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) (limited to 'webstats/plots.js') diff --git a/webstats/plots.js b/webstats/plots.js index d861450..94458d9 100644 --- a/webstats/plots.js +++ b/webstats/plots.js @@ -266,6 +266,16 @@ function agentChart(header, series, container) { let uplot = new uPlot(opts, series, container); container["uobj"] = uplot; } + +function decodeURIOrPass(str) { + try { + return decodeURI(str); + } catch (e) { + console.error("error with", str); + return str; + } +} + addEventListener("load", () => { fetch("/top_agent_traffic.csv") .then(responseParseCSV) @@ -276,42 +286,9 @@ addEventListener("load", () => { agentChart(headers, series, cont); }); - fetch("/fails.csv") - .then(responseParseCSV) - .then((data) => { - let headers = data[0]; - return data - .slice(1) - .map((row) => [ - "tr", - ["td.org-right", scaling(parseFloat(row[0]))], - ["td.org-right", scaling(parseFloat(row[1])) + "B"], - ["td.org-left", decodeURI(row[2])], - ]); - }) - .then((series) => { - let table = [ - "table", - { - border: 2, - cellPadding: 6, - cellSpacing: 0, - rules: "groups", - frame: "hsides", - }, - [ - "thead", - [ - "tr", - ["th.org-right", "hits"], - ["th.org-right", "tx"], - ["th.org-left", "path"], - ], - ], - ]; - let tbody = ["tbody"].concat(series); - table.push(tbody); - console.log(table); - document.body.appendChild(domEl(table)); - }); + document.querySelectorAll("table.fail-pages tr").forEach((tr, idx) => { + if (idx !== 0) { + tr.children[0].textContent = decodeURIOrPass(tr.children[0].textContent); + } + }); }); -- cgit v1.2.3