-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-69658] - failed-test.jelly javascript un-inlined. (#451)
Co-authored-by: Basil Crow <[email protected]> Co-authored-by: Tim Jacomb <[email protected]>
- Loading branch information
1 parent
ab878c3
commit 05e2505
Showing
2 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}) | ||
}); | ||
}); |