aboutsummaryrefslogtreecommitdiffstats
path: root/webstats/plots.js
diff options
context:
space:
mode:
Diffstat (limited to 'webstats/plots.js')
-rw-r--r--webstats/plots.js53
1 files changed, 15 insertions, 38 deletions
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);
+ }
+ });
});