diff --git a/src/main/resources/lib/hudson/test/failed-test.jelly b/src/main/resources/lib/hudson/test/failed-test.jelly
index 2ebb0d434..2f0f98c3d 100644
--- a/src/main/resources/lib/hudson/test/failed-test.jelly
+++ b/src/main/resources/lib/hudson/test/failed-test.jelly
@@ -60,14 +60,13 @@ THE SOFTWARE.
}
+
-
-
-
-
+
+
-
+
diff --git a/src/main/resources/lib/hudson/test/js/failureSummary.js b/src/main/resources/lib/hudson/test/js/failureSummary.js
index 2ba8a909a..f178bfaef 100644
--- a/src/main/resources/lib/hudson/test/js/failureSummary.js
+++ b/src/main/resources/lib/hudson/test/js/failureSummary.js
@@ -1,20 +1,47 @@
-function showFailureSummary(id,query) {
- var element = document.getElementById(id)
+const PREFIX = "test-";
+const SHOWLINK_SUFFIX = "-showlink";
+const HIDELINK_SUFFIX = "-hidelink";
+
+function showFailureSummary(summaryId, query) {
+ let element = document.getElementById(summaryId);
+
element.style.display = "";
- document.getElementById(id + "-showlink").style.display = "none";
- document.getElementById(id + "-hidelink").style.display = "";
+ document.getElementById(summaryId + SHOWLINK_SUFFIX).style.display = "none";
+ document.getElementById(summaryId + HIDELINK_SUFFIX).style.display = "";
if (typeof query !== 'undefined') {
- var rqo = new XMLHttpRequest();
+ let rqo = new XMLHttpRequest();
rqo.open('GET', query, true);
rqo.onreadystatechange = function() { element.innerHTML = rqo.responseText; }
rqo.send(null);
}
}
-function hideFailureSummary(id) {
- document.getElementById(id).style.display = "none";
- document.getElementById(id + "-showlink").style.display = "";
- document.getElementById(id + "-hidelink").style.display = "none";
+function hideFailureSummary(summaryId) {
+ document.getElementById(summaryId).style.display = "none";
+ document.getElementById(summaryId + SHOWLINK_SUFFIX).style.display = "";
+ document.getElementById(summaryId + HIDELINK_SUFFIX).style.display = "none";
}
+
+
+document.addEventListener('DOMContentLoaded', () => {
+ const testShowlinks = document.querySelectorAll("a[id*=test-][id*=-showlink]");
+ testShowlinks.forEach((element) => {
+ element.addEventListener('click', (event) => {
+ const id = element.id.replace(PREFIX, '').replace(SHOWLINK_SUFFIX, '');
+ const summaryId = PREFIX + id;
+ showFailureSummary(summaryId, document.URL + id + "summary");
+ })
+ });
+
+ // add the onclick behavior for all the "hidelinks"
+ const testHidelinks = document.querySelectorAll("a[id*=test-][id*=-hidelink]");
+ testHidelinks.forEach((element) => {
+ element.addEventListener('click', (event) => {
+ const id = element.id.replace(PREFIX, '').replace(HIDELINK_SUFFIX, '');
+ const summaryId = PREFIX + id;
+ hideFailureSummary(summaryId);
+ })
+ });
+});