Skip to content

Commit cef4726

Browse files
committed
Allow hiding jobs based on their status
Hiding finished jobs can save space when there are a lot of them.
1 parent 9c5d1bd commit cef4726

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

dashboard/assets/scripts/dashboard.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,10 @@ class Dashboard {
10411041
const contextMenu = args.contextMenu ? Boolean(Number(args.contextMenu)) : true;
10421042
this.initialFilter = args.initialFilter ?? "^$";
10431043
const showAllHeaders = args.showAllHeaders ? Boolean(Number(args.showAllHeaders)) : true;
1044+
const showRunningJobs = args.showRunningJobs ? Boolean(Number(args.showRunningJobs)) : true;
1045+
const showFinishedJobs = args.showFinishedJobs ? Boolean(Number(args.showFinishedJobs)) : true;
1046+
const showFatalJobs = args.showFatalJobs ? Boolean(Number(args.showFatalJobs)) : true;
1047+
const showAbortedJobs = args.showAbortedJobs ? Boolean(Number(args.showAbortedJobs)) : true;
10441048
const loadRecent = args.loadRecent ? Boolean(Number(args.loadRecent)) : true;
10451049
this.debug = args.debug ? Boolean(Number(args.debug)) : false;
10461050

@@ -1109,6 +1113,11 @@ class Dashboard {
11091113

11101114
this.showAllHeaders(showAllHeaders);
11111115

1116+
this.showRunningJobs(showRunningJobs);
1117+
this.showFinishedJobs(showFinishedJobs);
1118+
this.showFatalJobs(showFatalJobs);
1119+
this.showAbortedJobs(showAbortedJobs);
1120+
11121121
const finishSetup = () => {
11131122
byId("meta-info").innerHTML = "";
11141123

@@ -1235,6 +1244,14 @@ ${String(kbPerSec).padStart(3, "0")} KB/s`;
12351244
window.open(this.jobsRenderer.firstFilterMatch.url);
12361245
} else if (ev.which === 104 /* h */) {
12371246
ds.showAllHeaders(!byId("show-all-headers").checked);
1247+
} else if (ev.which === 114 /* r */) {
1248+
ds.showRunningJobs(!byId("show-running-jobs").checked);
1249+
} else if (ev.which === 100 /* d */) {
1250+
ds.showFinishedJobs(!byId("show-finished-jobs").checked);
1251+
} else if (ev.which === 99 /* c */) {
1252+
ds.showFatalJobs(!byId("show-fatal-jobs").checked);
1253+
} else if (ev.which === 115 /* s */) {
1254+
ds.showAbortedJobs(!byId("show-aborted-jobs").checked);
12381255
}
12391256
}
12401257

@@ -1294,6 +1311,26 @@ ${String(kbPerSec).padStart(3, "0")} KB/s`;
12941311
byId('show-all-headers').checked = value;
12951312
byId('hide-headers').sheet.disabled = value;
12961313
}
1314+
1315+
showRunningJobs(value) {
1316+
byId('show-running-jobs').checked = value;
1317+
byId('hide-running').sheet.disabled = value;
1318+
}
1319+
1320+
showFinishedJobs(value) {
1321+
byId('show-finished-jobs').checked = value;
1322+
byId('hide-done').sheet.disabled = value;
1323+
}
1324+
1325+
showFatalJobs(value) {
1326+
byId('show-fatal-jobs').checked = value;
1327+
byId('hide-fatal').sheet.disabled = value;
1328+
}
1329+
1330+
showAbortedJobs(value) {
1331+
byId('show-aborted-jobs').checked = value;
1332+
byId('hide-aborted').sheet.disabled = value;
1333+
}
12971334
}
12981335

12991336
const ds = new Dashboard();

dashboard/dashboard.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
font-size: 18px;
5858
}
5959

60+
#jobs {
61+
display: inline flex;
62+
}
63+
64+
#show-jobs {
65+
float: inline-start;
66+
}
67+
6068
.padded-page {
6169
padding: 20px 27px 20px 27px;
6270
}
@@ -397,6 +405,34 @@
397405
content-visibility: hidden;
398406
}
399407
</style>
408+
<style id="hide-running">
409+
.log-container:not(
410+
:has(.job-info-done),
411+
:has(.job-info-fatal),
412+
:has(.job-info-aborted)
413+
) {
414+
display: none;
415+
content-visibility: hidden;
416+
}
417+
</style>
418+
<style id="hide-done">
419+
.log-container:has(.job-info-done) {
420+
display: none;
421+
content-visibility: hidden;
422+
}
423+
</style>
424+
<style id="hide-fatal">
425+
.log-container:has(.job-info-fatal) {
426+
display: none;
427+
content-visibility: hidden;
428+
}
429+
</style>
430+
<style id="hide-aborted">
431+
.log-container:has(.job-info-aborted) {
432+
display: none;
433+
content-visibility: hidden;
434+
}
435+
</style>
400436
<div id="context-menu"></div>
401437
<div class="padded-page">
402438
<div class="header">
@@ -409,6 +445,19 @@
409445
<input id="set-filter-none" onclick="ds.setFilter('^$');" type="button" value="None" class="button">
410446
<input type="checkbox" id="show-all-headers" onclick="ds.showAllHeaders(this.checked);">
411447
<label for="show-all-headers">All headers</label>
448+
<details id="jobs">
449+
<summary>Jobs</summary>
450+
<div id="show-jobs">
451+
<input type="checkbox" id="show-running-jobs" onclick="ds.showRunningJobs(this.checked);" accesskey="r">
452+
<label for="show-running-jobs">Running</label><br>
453+
<input type="checkbox" id="show-finished-jobs" onclick="ds.showFinishedJobs(this.checked);" accesskey="d">
454+
<label class="job-info-done" for="show-finished-jobs">Finished</label><br>
455+
<input type="checkbox" id="show-fatal-jobs" onclick="ds.showFatalJobs(this.checked);" accesskey="c">
456+
<label class="job-info-fatal" for="show-fatal-jobs">Fatal</label><br>
457+
<input type="checkbox" id="show-aborted-jobs" onclick="ds.showAbortedJobs(this.checked);" accesskey="s">
458+
<label class="job-info-aborted" for="show-aborted-jobs">Aborted</label><br>
459+
</div>
460+
</details>
412461
</div>
413462
<div id="header-right">
414463
<div id="meta-info"><span class="adbox">😊</span></div>
@@ -458,6 +507,10 @@
458507
<li><kbd>i</kbd> - use the initial job log filter
459508
<li><kbd>v</kbd> - open the job URL of the first-shown job log
460509
<li><kbd>h</kbd> - show/hide headers for hidden job logs
510+
<li><kbd>r</kbd> - show/hide header+log for running jobs
511+
<li><kbd>d</kbd> - show/hide header+log for finished jobs
512+
<li><kbd>c</kbd> - show/hide header+log for fatal jobs
513+
<li><kbd>s</kbd> - show/hide header+log for aborted jobs
461514
<li><kbd>?</kbd> - show/hide help text
462515
</ul>
463516
<p>
@@ -475,6 +528,12 @@
475528
<ul>
476529
<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>
477530
<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>
531+
<li>To initially hide different job types, add these to the dashboard URL. The default is to show them.
532+
<kbd><span class="url-q-or-amp">?</span>showRunningJobs=0</kbd>
533+
<kbd><span class="url-q-or-amp">?</span>showFinishedJobs=0</kbd>
534+
<kbd><span class="url-q-or-amp">?</span>showFatalJobs=0</kbd>
535+
<kbd><span class="url-q-or-amp">?</span>showAbortedJobs=0</kbd>
536+
</li>
478537
<li>To retain more lines in the log windows, add <kbd><span class="url-q-or-amp">?</span>historyLines=1000</kbd> to the dashboard URL. The default is <code>500</code>, or <code>250</code> on mobile.</li>
479538
<li>To update the dashboard more frequently, add <kbd><span class="url-q-or-amp">?</span>batchTimeWhenVisible=33</kbd> to the dashboard URL. The default is <code>125</code> (8 Hz).</li>
480539
<li>To skip loading of recent (buffered) log data for jobs, add <kbd><span class="url-q-or-amp">?</span>loadRecent=0</kbd> to the dashboard URL. Inactive jobs will not appear.</li>

0 commit comments

Comments
 (0)