diff --git a/web/index.html b/web/index.html
index 53ce2513..493139d9 100644
--- a/web/index.html
+++ b/web/index.html
@@ -72,6 +72,8 @@
About
+
+
Results Filter
diff --git a/web/script.js b/web/script.js
index 4d2398a9..18ffd49b 100644
--- a/web/script.js
+++ b/web/script.js
@@ -270,6 +270,7 @@
function load(dir) {
document.getElementsByTagName("body")[0].classList.add("loading");
+ document.getElementById("run-selection-msg").innerHTML = "";
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open('GET', 'logs/' + dir + '/result.json');
@@ -277,15 +278,33 @@
if(xhr.readyState !== XMLHttpRequest.DONE) return;
if(xhr.status !== 200) {
console.log("Received status: ", xhr.status);
+ var run = dir.replace("logs_", "");
+ var errMsg = 'Error: could not locate result for "' + run + '" run';
+ document.getElementById("run-selection-msg").innerHTML = errMsg;
+ var refresh = window.location.protocol + "//" + window.location.host + window.location.pathname + "?run=" + run;
+ window.history.pushState(null, null, refresh);
return;
}
- process(xhr.response);
+ var result = xhr.response;
+ var selectedRun = result.log_dir.replace("logs_", "");
+ var refresh = window.location.protocol + "//" + window.location.host + window.location.pathname + "?run=" + selectedRun;
+ window.history.pushState(null, null, refresh);
+ process(result);
document.getElementsByTagName("body")[0].classList.remove("loading");
};
xhr.send();
}
- load("latest");
+ var selectedRun = null;
+ var queryParams = (new URL(document.location)).searchParams;
+ if (queryParams.has("run") === true) {
+ // if the request used a specific run (like ?run=123), then
+ // load that specifc one
+ selectedRun = queryParams.get("run")
+ load("logs_" + selectedRun);
+ } else {
+ load("latest");
+ }
// enable loading of old runs
var xhr = new XMLHttpRequest();
@@ -308,6 +327,11 @@
load(ev.currentTarget.value);
});
document.getElementById("available-runs").appendChild(s);
+ if (selectedRun != null) {
+ // just set the selected run, no need to trigger "change"
+ // event here
+ s.value = "logs_" + selectedRun;
+ }
};
xhr.send();
})();