Skip to content

Commit 22369c9

Browse files
committed
Allow filtering by ID, URL, note, pipeline or nick
Default to enabling them all, allow and default enable nick filtering when nicks shown.
1 parent 3b9753c commit 22369c9

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

dashboard/assets/scripts/dashboard.js

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,13 @@ class JobsRenderer {
693693
this.firstFilterMatch = null;
694694
for (const job of this.jobs.sorted) {
695695
const w = this.renderInfo[job.ident].logWindow;
696-
if (!query.test(job.url)) {
696+
const show =
697+
(byId("filter-job-id").checked && query.test(job.ident)) ||
698+
(byId("filter-job-url").checked && query.test(job.url)) ||
699+
(byId("filter-job-note").checked && query.test(job.note)) ||
700+
(byId("filter-job-pipeline").checked && (query.test(job.pipeline_id) || query.test(this.pipelines[job.pipeline_id]))) ||
701+
(this.showNicks && byId("filter-job-nick").checked && query.test(job.started_by));
702+
if (!show) {
697703
w.classList.add("log-window-hidden");
698704

699705
unmatchedWindows.push(w);
@@ -1086,6 +1092,11 @@ class Dashboard {
10861092
const showNicks = args.showNicks ? Boolean(Number(args.showNicks)) : false;
10871093
const contextMenu = args.contextMenu ? Boolean(Number(args.contextMenu)) : true;
10881094
this.initialFilter = args.initialFilter ?? "^$";
1095+
const filterJobID = args.filterJobID ? Boolean(Number(args.filterJobID)) : true;
1096+
const filterJobURL = args.filterJobURL ? Boolean(Number(args.filterJobURL)) : true;
1097+
const filterJobNote = args.filterJobNote ? Boolean(Number(args.filterJobNote)) : true;
1098+
const filterJobPipe = args.filterJobPipe ? Boolean(Number(args.filterJobPipe)) : true;
1099+
const filterJobNick = args.filterJobNick ? Boolean(Number(args.filterJobNick)) : true;
10891100
const showAllHeaders = args.showAllHeaders ? Boolean(Number(args.showAllHeaders)) : true;
10901101
const showRunningJobs = args.showRunningJobs ? Boolean(Number(args.showRunningJobs)) : true;
10911102
const showFinishedJobs = args.showFinishedJobs ? Boolean(Number(args.showFinishedJobs)) : true;
@@ -1144,6 +1155,29 @@ class Dashboard {
11441155

11451156
if (!showNicks) {
11461157
addPageStyles(".job-nick-aligned { width: 0; }");
1158+
} else {
1159+
byId("filter-types").lastChild.after(
1160+
h("input", {
1161+
type: "checkbox",
1162+
id: "filter-job-nick",
1163+
onclick: () => { ds.jobsRenderer.applyFilter(); },
1164+
checked: true,
1165+
})
1166+
);
1167+
byId("filter-types").lastChild.after("\n\t\t\t");
1168+
byId("filter-types").lastChild.after(
1169+
h("label", { className: "filter-job", htmlFor: "filter-job-nick", textContent: "Nick" }),
1170+
);
1171+
byId("filter-types").lastChild.after(h("br"));
1172+
byId("filter-types").lastChild.after("\n");
1173+
}
1174+
1175+
byId("filter-job-id").checked = filterJobID;
1176+
byId("filter-job-url").checked = filterJobURL;
1177+
byId("filter-job-note").checked = filterJobNote;
1178+
byId("filter-job-pipeline").checked = filterJobPipe;
1179+
if (showNicks) {
1180+
byId("filter-job-nick").checked = filterJobNick;
11471181
}
11481182

11491183
if (args.initialFilter != null) {
@@ -1329,6 +1363,12 @@ ${String(kbPerSec).padStart(3, "0")} KB/s`;
13291363
ds.showFatalJobs(!byId("show-fatal-jobs").checked);
13301364
} else if (ev.which === 115 /* s */) {
13311365
ds.showAbortedJobs(!byId("show-aborted-jobs").checked);
1366+
} else if (ev.which === 117 /* u */) {
1367+
byId("filter-job-url").click();
1368+
} else if (ev.which === 101 /* e */) {
1369+
byId("filter-job-note").click();
1370+
} else if (ev.which === 112 /* p */) {
1371+
byId("filter-job-pipeline").click();
13321372
}
13331373
}
13341374

dashboard/dashboard.html

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,21 @@
448448
<a href="https://wiki.archiveteam.org/index.php?title=ArchiveBot" class="underlined-a">ArchiveBot</a>
449449
tracking <span id="num-crawls">0</span> crawls.
450450
See also <a href="pipelines" class="underlined-a">pipeline</a> or <a href="logs/recent" class="underlined-a">job</a> reports.
451-
Logs <input id="filter-box" type="text" size="21" title="Show logs for jobs matching this regular expression. For example ^https?://.*">
451+
<details class="drop-down">
452+
<summary>Logs</summary>
453+
<div id="filter-types">
454+
Search:<br>
455+
<input type="checkbox" id="filter-job-id" onclick="ds.jobsRenderer.applyFilter();" checked>
456+
<label class="filter-job" for="filter-job-id">ID</label><br>
457+
<input type="checkbox" id="filter-job-url" onclick="ds.jobsRenderer.applyFilter();" accesskey="u" checked>
458+
<label class="filter-job" for="filter-job-url">URL</label><br>
459+
<input type="checkbox" id="filter-job-note" onclick="ds.jobsRenderer.applyFilter();" accesskey="e" checked>
460+
<label class="filter-job" for="filter-job-note" title="Explain">Note</label><br>
461+
<input type="checkbox" id="filter-job-pipeline" onclick="ds.jobsRenderer.applyFilter();" accesskey="p" checked>
462+
<label class="filter-job" for="filter-job-pipeline">Pipe</label><br>
463+
</div>
464+
</details>
465+
<input id="filter-box" type="text" size="21" title="Show logs for jobs matching this regular expression. For example ^https?://.*">
452466
<input id="set-filter-all" onclick="ds.setFilter('');" type="button" value="All" class="button">
453467
<input id="set-filter-none" onclick="ds.setFilter('^$');" type="button" value="None" class="button">
454468
<input type="checkbox" id="show-all-headers" onclick="ds.showAllHeaders(this.checked);">
@@ -521,6 +535,9 @@
521535
<li><kbd>b</kbd> - show/hide header+log for failed jobs
522536
<li><kbd>c</kbd> - show/hide header+log for fatal jobs
523537
<li><kbd>s</kbd> - show/hide header+log for aborted jobs
538+
<li><kbd>u</kbd> - enable/disable URL search for job log filter
539+
<li><kbd>e</kbd> - enable/disable note/explain search for job log filter
540+
<li><kbd>p</kbd> - enable/disable pipeline search for job log filter
524541
<li><kbd>?</kbd> - show/hide help text
525542
</ul>
526543
<p>
@@ -537,6 +554,12 @@
537554
</p>
538555
<ul>
539556
<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>
557+
<li>To initially disable filtering by job details, add these to the dashboard URL. The default is to filter by them.
558+
<kbd><span class="url-q-or-amp">?</span>filterJobID=0</kbd>
559+
<kbd><span class="url-q-or-amp">?</span>filterJobURL=0</kbd>
560+
<kbd><span class="url-q-or-amp">?</span>filterJobNote=0</kbd>
561+
<kbd><span class="url-q-or-amp">?</span>filterJobPipe=0</kbd>
562+
</li>
540563
<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>
541564
<li>To initially hide different job types, add these to the dashboard URL. The default is to show them.
542565
<kbd><span class="url-q-or-amp">?</span>showRunningJobs=0</kbd>

0 commit comments

Comments
 (0)