Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-73951][JENKINS-73952] Improve CSP compatibility #321

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.addEventListener("DOMContentLoaded", () => {
document.querySelector(".svn-credential-ok-close").addEventListener("click", () => {
window.close();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ THE SOFTWARE.
<p>
${%Authentication was successful. Information is stored in Jenkins now.}
</p>
<input type="button" value="${%Close}" class="yui-button" onclick="window.close()" />
<st:adjunct includes="hudson.scm.SubversionSCM.DescriptorImpl.credential-ok"/>
<button class="jenkins-button svn-credential-ok-close">${%Close}</button>
</l:main-panel>
</l:layout>
</j:jelly>
</j:jelly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// update the visual feedback depending on the checkbox state
function updateRow(changeEvent) {
const checkbox = changeEvent.target;
checkbox.parentNode.parentNode.style.color = checkbox.checked ? "inherit" : "grey";

const index = checkbox.getAttribute("data-index");
document.querySelector(`input[name="name${index}"]`).disabled = !checkbox.checked;
}

window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".svn-tagform-tag-checkbox").forEach((checkbox) => {
checkbox.addEventListener("change", updateRow);
});
});
12 changes: 3 additions & 9 deletions src/main/resources/hudson/scm/SubversionTagAction/tagForm.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ THE SOFTWARE.
<j:if test="${it.isTagged()}">
<h2>${%Create more tags}</h2>
</j:if>
<st:adjunct includes="hudson.scm.SubversionTagAction.svn-tagform-update-row"/>
<form action="submit" method="post" enctype="multipart/form-data" name="tag">
<table class="middle-align">
<tr>
Expand All @@ -78,8 +79,8 @@ THE SOFTWARE.
<j:forEach var="m" items="${tags.keySet()}" varStatus="loop">
<tr>
<td><j:if test="${tags.size()!=1}">
<input type="checkbox" name="tag${loop.index}" checked="true"
id="tag${loop.index}" onchange="updateRow(this,${loop.index})" />
<input type="checkbox" name="tag${loop.index}" checked="true" class="svn-tagform-tag-checkbox"
id="tag${loop.index}" data-index="${loop.index}" />
</j:if></td>
<td style="white-space:nowrap;"><label for="tag${loop.index}">
${m.url} (rev.${m.revision})
Expand All @@ -103,13 +104,6 @@ THE SOFTWARE.
</f:entry>
</table>
<f:submit value="${%Tag}" />
<script>
<!-- update the visual feedback depending on the checkbox state -->
function updateRow(e,i) {
e.parentNode.parentNode.style.color = e.checked ? "inherit" : "grey";
$("name"+i).disabled = !e.checked;
}
</script>
</form>
</j:if>
</l:main-panel>
Expand Down
Loading