From c7504142f53dc5f7d2a11ac00a87e699e2bd0e3e Mon Sep 17 00:00:00 2001 From: Yaroslav Afenkin <91559310+yaroslavafenkin@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:20:03 +0200 Subject: [PATCH 1/2] Fix the dropdown styling regression --- src/main/webapp/css/analytics.css | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/webapp/css/analytics.css b/src/main/webapp/css/analytics.css index 66b766c4..0564c788 100644 --- a/src/main/webapp/css/analytics.css +++ b/src/main/webapp/css/analytics.css @@ -9,3 +9,30 @@ .sauce-labs-statistics > p { margin: 0; } + +.dropdown { + position: relative; + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + min-width: 160px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + padding: 12px 16px; + z-index: 1; + overflow-y: scroll; + white-space: pre; +} + +.show { + display:block; +} + +.divider { + width:5px; + height:auto; + display:inline-block; +} From 3f536186f419d7da0da6c2db8b5117ec773ef68f Mon Sep 17 00:00:00 2001 From: Yaroslav Afenkin <91559310+yaroslavafenkin@users.noreply.github.com> Date: Tue, 24 Dec 2024 18:13:29 +0200 Subject: [PATCH 2/2] [JENKINS-74149][JENKINS-74148] Extract inline JavaScript --- .../SauceOnDemandBuildAction/floatingBox.jelly | 2 +- .../SauceOnDemandProjectAction/jobMain.jelly | 2 +- src/main/webapp/css/analytics.css | 8 ++++---- src/main/webapp/js/dropdown.js | 12 +++++++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandBuildAction/floatingBox.jelly b/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandBuildAction/floatingBox.jelly index 5649bb4b..612c9432 100755 --- a/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandBuildAction/floatingBox.jelly +++ b/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandBuildAction/floatingBox.jelly @@ -46,7 +46,7 @@ ${job.getStatus()}
- + diff --git a/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction/jobMain.jelly b/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction/jobMain.jelly index 3e37df79..7a93136b 100755 --- a/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction/jobMain.jelly +++ b/src/main/resources/hudson/plugins/sauce_ondemand/SauceOnDemandProjectAction/jobMain.jelly @@ -49,7 +49,7 @@ ${job.getStatus()}
- + diff --git a/src/main/webapp/css/analytics.css b/src/main/webapp/css/analytics.css index 0564c788..79f9fe83 100644 --- a/src/main/webapp/css/analytics.css +++ b/src/main/webapp/css/analytics.css @@ -28,11 +28,11 @@ } .show { - display:block; + display: block; } .divider { - width:5px; - height:auto; - display:inline-block; + width: 5px; + height: auto; + display: inline-block; } diff --git a/src/main/webapp/js/dropdown.js b/src/main/webapp/js/dropdown.js index 177e1cd3..974f783d 100644 --- a/src/main/webapp/js/dropdown.js +++ b/src/main/webapp/js/dropdown.js @@ -1,5 +1,5 @@ -function dropdown(target) { - target.parentNode.getElementsByClassName("dropdown-content")[0].classList.toggle("show"); +function dropdown(event) { + event.target.parentNode.getElementsByClassName("dropdown-content")[0].classList.toggle("show"); } // close the dropdown if the user clicks outside the button or dropdown content @@ -14,4 +14,10 @@ window.onclick = function(event) { } } } -} \ No newline at end of file +} + +document.addEventListener("DOMContentLoaded", () => { + document.querySelectorAll(".dropdown-button").forEach((button) => { + button.addEventListener("click", dropdown); + }); +});