From b8220b249cf523082805a53294c41d9989f8e0ad Mon Sep 17 00:00:00 2001 From: Yaroslav <91559310+yaroslavafenkin@users.noreply.github.com> Date: Thu, 17 Oct 2024 19:29:42 +0300 Subject: [PATCH 1/2] [JENKINS-73951][JENKINS-73952] Improve CSP compatibility (#321) * [JENKINS-73952] Extract inline event handler from SubversionTagAction/tagForm.jelly * [JENKINS-73951] Extract event handler from SubversionSCM/DescriptorImpl/credentialOK.jelly * Fix adjunct name * Address review feedback --- .../SubversionSCM/DescriptorImpl/credential-ok.js | 5 +++++ .../DescriptorImpl/credentialOK.jelly | 5 +++-- .../SubversionTagAction/svn-tagform-update-row.js | 14 ++++++++++++++ .../hudson/scm/SubversionTagAction/tagForm.jelly | 12 +++--------- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credential-ok.js create mode 100644 src/main/resources/hudson/scm/SubversionTagAction/svn-tagform-update-row.js diff --git a/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credential-ok.js b/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credential-ok.js new file mode 100644 index 000000000..97665d0c2 --- /dev/null +++ b/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credential-ok.js @@ -0,0 +1,5 @@ +window.addEventListener("DOMContentLoaded", () => { + document.querySelector(".svn-credential-ok-close").addEventListener("click", () => { + window.close(); + }); +}); diff --git a/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credentialOK.jelly b/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credentialOK.jelly index b7fb90b5f..1676d2ce0 100644 --- a/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credentialOK.jelly +++ b/src/main/resources/hudson/scm/SubversionSCM/DescriptorImpl/credentialOK.jelly @@ -31,7 +31,8 @@ THE SOFTWARE.

${%Authentication was successful. Information is stored in Jenkins now.}

- + + - \ No newline at end of file + diff --git a/src/main/resources/hudson/scm/SubversionTagAction/svn-tagform-update-row.js b/src/main/resources/hudson/scm/SubversionTagAction/svn-tagform-update-row.js new file mode 100644 index 000000000..5c7f2692d --- /dev/null +++ b/src/main/resources/hudson/scm/SubversionTagAction/svn-tagform-update-row.js @@ -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); + }); +}); diff --git a/src/main/resources/hudson/scm/SubversionTagAction/tagForm.jelly b/src/main/resources/hudson/scm/SubversionTagAction/tagForm.jelly index 2f071b735..20a61bfd5 100644 --- a/src/main/resources/hudson/scm/SubversionTagAction/tagForm.jelly +++ b/src/main/resources/hudson/scm/SubversionTagAction/tagForm.jelly @@ -68,6 +68,7 @@ THE SOFTWARE.

${%Create more tags}

+
@@ -78,8 +79,8 @@ THE SOFTWARE.
- +
- From 53233cfc8eb305b0932f96c516f3c788c7585e24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:05:27 -0700 Subject: [PATCH 2/2] Bump org.jenkins-ci.plugins:plugin from 4.86 to 4.88 (#318) Bumps [org.jenkins-ci.plugins:plugin](https://github.com/jenkinsci/plugin-pom) from 4.86 to 4.88. - [Release notes](https://github.com/jenkinsci/plugin-pom/releases) - [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md) - [Commits](https://github.com/jenkinsci/plugin-pom/compare/plugin-4.86...plugin-4.88) --- updated-dependencies: - dependency-name: org.jenkins-ci.plugins:plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4a0608c6f..a3ea9ed89 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ THE SOFTWARE. org.jenkins-ci.plugins plugin - 4.86 + 4.88