summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-05 19:41:02 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-07-07 23:52:08 -0400
commitcdd88238a73c7c94b266cf3b74fd03375fedd4f6 (patch)
treedff1258e78b552ebd87aa16c449eb5f492045036
parenteae8ed66003246976407e5ac3162b80d985c25dc (diff)
Add filtering to test status report
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--ci/commit-filter70
-rwxr-xr-xci/test-job-done.sh12
2 files changed, 78 insertions, 4 deletions
diff --git a/ci/commit-filter b/ci/commit-filter
new file mode 100644
index 0000000..c2abea9
--- /dev/null
+++ b/ci/commit-filter
@@ -0,0 +1,70 @@
+<!--
+https://choosealicense.com/licenses/0bsd/
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
+
+add the following after the </h1>, before <table>
+maybe relocate the script block to within <head></head>
+-->
+
+<style>
+ .hide-without-js {
+ display: none;
+ }
+ .filtered {
+ display: none;
+ }
+ #filters {
+ margin: 1em 0;
+ }
+ #filters label{
+ margin-left: 0.3em;
+ }
+</style>
+<div id="filters" class="hide-without-js">
+ Filter by:
+</div>
+<template id="filter-template" style="display:none">
+ <label class="checkbox-inline"><input type="checkbox" checked="checked" /></label>
+</template>
+<script>
+(function () {
+ function get_row_status(el) {
+ return el.querySelector("td:nth-child(2)").textContent.trim()
+ }
+ function refresh_filters() {
+ const shown_statuses = new Set()
+ for (const el of document.querySelectorAll("#filters label")) {
+ if (el.querySelector("input").checked) {
+ shown_statuses.add(el.textContent.trim())
+ }
+ }
+ const el_table = document.querySelector("table")
+ for (const el of el_table.querySelectorAll("tr")) {
+ const status = get_row_status(el)
+ if (shown_statuses.has(status)) {
+ el.classList.remove("filtered")
+ } else {
+ el.classList.add("filtered")
+ }
+ }
+ }
+ document.addEventListener("DOMContentLoaded", (event) => {
+ const js_class_name = "hide-without-js"
+ for (const el of document.getElementsByClassName(js_class_name)) {
+ el.classList.remove(js_class_name)
+ }
+ const result_types = new Set()
+ for (const el of document.querySelectorAll("tr")) {
+ result_types.add(get_row_status(el))
+ }
+ const el_filters = document.querySelector("#filters")
+ const el_filter_template = document.querySelector("#filter-template").content
+ for (const result of result_types) {
+ const el_new_filter = el_filter_template.cloneNode(true)
+ el_new_filter.querySelector("label").appendChild(document.createTextNode(` ${result}`))
+ el_new_filter.querySelector("input").addEventListener("change", refresh_filters)
+ el_filters.appendChild(el_new_filter)
+ }
+ })
+})()
+</script> \ No newline at end of file
diff --git a/ci/test-job-done.sh b/ci/test-job-done.sh
index 8e519ce..a92f0e2 100755
--- a/ci/test-job-done.sh
+++ b/ci/test-job-done.sh
@@ -6,6 +6,8 @@ set -o errtrace
[[ -f ~/.ktestrc ]] && . ~/.ktestrc
+CI_DIR=$(dirname "$(readlink -f "$0")")
+
cd /home/bcachefs/linux
BRANCH=$1
@@ -37,11 +39,13 @@ git_commit_html()
echo '<body>'
echo '<div class="container">'
- echo '<table class="table">'
-
- echo "<tr>"
+ echo "<h3>"
echo "<th>$COMMIT_SUBJECT</th>"
- echo "</tr>"
+ echo "</h3>"
+
+ cat $CI_DIR/commit-filter
+
+ echo '<table class="table">'
for STATUS in $(find $OUTPUT -name status); do
TESTNAME=$(basename $(dirname $STATUS))