Skip to content

Commit 3d1e3ce

Browse files
committed
Allow filtering by ID, URL, note, pipeline or nick
Default to enabling them all, allow/enable nick filtering when nicks shown.
1 parent 283899c commit 3d1e3ce

File tree

2 files changed

+72
-3
lines changed

2 files changed

+72
-3
lines changed

dashboard/assets/scripts/dashboard.js

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,12 @@ class JobsRenderer {
684684
this.firstFilterMatch = null;
685685
for (const job of this.jobs.sorted) {
686686
const w = this.renderInfo[job.ident].logWindow;
687-
const show = query.test(job.url) ||
688-
(this.showNicks && query.test(job.started_by));
687+
const show =
688+
(byId("filter-job-id").checked && query.test(job.ident)) ||
689+
(byId("filter-job-url").checked && query.test(job.url)) ||
690+
(byId("filter-job-note").checked && query.test(job.note)) ||
691+
(byId("filter-job-pipeline").checked && (query.test(job.pipeline_id) || query.test(this.pipelines[job.pipeline_id]))) ||
692+
(this.showNicks && byId("filter-job-nick").checked && query.test(job.started_by));
689693
if (!show) {
690694
w.classList.add("log-window-hidden");
691695

@@ -1079,6 +1083,11 @@ class Dashboard {
10791083
const showNicks = args.showNicks ? Boolean(Number(args.showNicks)) : false;
10801084
const contextMenu = args.contextMenu ? Boolean(Number(args.contextMenu)) : true;
10811085
this.initialFilter = args.initialFilter ?? "^$";
1086+
const filterJobID = args.filterJobID ? Boolean(Number(args.filterJobID)) : true;
1087+
const filterJobURL = args.filterJobURL ? Boolean(Number(args.filterJobURL)) : true;
1088+
const filterJobNote = args.filterJobNote ? Boolean(Number(args.filterJobNote)) : true;
1089+
const filterJobPipe = args.filterJobPipe ? Boolean(Number(args.filterJobPipe)) : true;
1090+
const filterJobNick = args.filterJobNick ? Boolean(Number(args.filterJobNick)) : true;
10821091
const showAllHeaders = args.showAllHeaders ? Boolean(Number(args.showAllHeaders)) : true;
10831092
const showRunningJobs = args.showRunningJobs ? Boolean(Number(args.showRunningJobs)) : true;
10841093
const showFinishedJobs = args.showFinishedJobs ? Boolean(Number(args.showFinishedJobs)) : true;
@@ -1137,6 +1146,29 @@ class Dashboard {
11371146

11381147
if (!showNicks) {
11391148
addPageStyles(".job-nick-aligned { width: 0; }");
1149+
} else {
1150+
byId("filter-types").lastChild.after(
1151+
h("input", {
1152+
type: "checkbox",
1153+
id: "filter-job-nick",
1154+
onclick: () => { ds.jobsRenderer.applyFilter(); },
1155+
checked: true,
1156+
})
1157+
);
1158+
byId("filter-types").lastChild.after("\n\t\t\t");
1159+
byId("filter-types").lastChild.after(
1160+
h("label", { className: "filter-job", htmlFor: "filter-job-nick", textContent: "Nick" }),
1161+
);
1162+
byId("filter-types").lastChild.after(h("br"));
1163+
byId("filter-types").lastChild.after("\n");
1164+
}
1165+
1166+
byId("filter-job-id").checked = filterJobID;
1167+
byId("filter-job-url").checked = filterJobURL;
1168+
byId("filter-job-note").checked = filterJobNote;
1169+
byId("filter-job-pipeline").checked = filterJobPipe;
1170+
if (showNicks) {
1171+
byId("filter-job-nick").checked = filterJobNick;
11401172
}
11411173

11421174
if (args.initialFilter != null) {
@@ -1322,6 +1354,12 @@ ${String(kbPerSec).padStart(3, "0")} KB/s`;
13221354
ds.showFatalJobs(!byId("show-fatal-jobs").checked);
13231355
} else if (ev.which === 115 /* s */) {
13241356
ds.showAbortedJobs(!byId("show-aborted-jobs").checked);
1357+
} else if (ev.which === 117 /* u */) {
1358+
byId("filter-job-url").click();
1359+
} else if (ev.which === 101 /* e */) {
1360+
byId("filter-job-note").click();
1361+
} else if (ev.which === 112 /* p */) {
1362+
byId("filter-job-pipeline").click();
13251363
}
13261364
}
13271365

dashboard/dashboard.html

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
float: inline-start;
6666
}
6767

68+
#filter-details {
69+
display: inline flex;
70+
}
71+
72+
#filter-types {
73+
float: inline-start;
74+
}
75+
6876
.padded-page {
6977
padding: 20px 27px 20px 27px;
7078
}
@@ -451,7 +459,21 @@
451459
<a href="https://wiki.archiveteam.org/index.php?title=ArchiveBot" class="underlined-a">ArchiveBot</a>
452460
tracking <span id="num-crawls">0</span> crawls.
453461
See also <a href="pipelines" class="underlined-a">pipeline</a> or <a href="logs/recent" class="underlined-a">job</a> reports.
454-
Logs <input id="filter-box" type="text" size="21" title="Show logs for jobs matching this regular expression. For example ^https?://.*">
462+
<details id="filter-details">
463+
<summary>Logs</summary>
464+
<div id="filter-types">
465+
Search:<br>
466+
<input type="checkbox" id="filter-job-id" onclick="ds.jobsRenderer.applyFilter();" checked>
467+
<label class="filter-job" for="filter-job-id">ID</label><br>
468+
<input type="checkbox" id="filter-job-url" onclick="ds.jobsRenderer.applyFilter();" accesskey="u" checked>
469+
<label class="filter-job" for="filter-job-url">URL</label><br>
470+
<input type="checkbox" id="filter-job-note" onclick="ds.jobsRenderer.applyFilter();" accesskey="e" checked>
471+
<label class="filter-job" for="filter-job-note" title="Explain">Note</label><br>
472+
<input type="checkbox" id="filter-job-pipeline" onclick="ds.jobsRenderer.applyFilter();" accesskey="p" checked>
473+
<label class="filter-job" for="filter-job-pipeline">Pipe</label><br>
474+
</div>
475+
</details>
476+
<input id="filter-box" type="text" size="21" title="Show logs for jobs matching this regular expression. For example ^https?://.*">
455477
<input id="set-filter-all" onclick="ds.setFilter('');" type="button" value="All" class="button">
456478
<input id="set-filter-none" onclick="ds.setFilter('^$');" type="button" value="None" class="button">
457479
<input type="checkbox" id="show-all-headers" onclick="ds.showAllHeaders(this.checked);">
@@ -526,6 +548,9 @@
526548
<li><kbd>b</kbd> - show/hide header+log for failed jobs
527549
<li><kbd>c</kbd> - show/hide header+log for fatal jobs
528550
<li><kbd>s</kbd> - show/hide header+log for aborted jobs
551+
<li><kbd>u</kbd> - enable/disable URL search for job log filter
552+
<li><kbd>e</kbd> - enable/disable note/explain search for job log filter
553+
<li><kbd>p</kbd> - enable/disable pipeline search for job log filter
529554
<li><kbd>?</kbd> - show/hide help text
530555
</ul>
531556
<p>
@@ -542,6 +567,12 @@
542567
</p>
543568
<ul>
544569
<li>To specify an initial filter, add <kbd><span class="url-q-or-amp">?</span>initialFilter=TEXT</kbd> to the dashboard URL. The default is <kbd>^$</kbd>.</li>
570+
<li>To initially disable filtering by job details, add these to the dashboard URL. The default is to filter by them.
571+
<kbd><span class="url-q-or-amp">?</span>filterJobID=0</kbd>
572+
<kbd><span class="url-q-or-amp">?</span>filterJobURL=0</kbd>
573+
<kbd><span class="url-q-or-amp">?</span>filterJobNote=0</kbd>
574+
<kbd><span class="url-q-or-amp">?</span>filterJobPipe=0</kbd>
575+
</li>
545576
<li>To initially hide headers for hidden job logs, add <kbd><span class="url-q-or-amp">?</span>showAllHeaders=0</kbd> to the dashboard URL. The default is to show them.</li>
546577
<li>To initially hide different job types, add these to the dashboard URL. The default is to show them.
547578
<kbd><span class="url-q-or-amp">?</span>showRunningJobs=0</kbd>

0 commit comments

Comments
 (0)