Skip to content

Commit

Permalink
Replace dropdown button to remove dependency on YUI (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek authored Nov 6, 2024
1 parent c9f7ca9 commit 005441d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<revision>4</revision>
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<jenkins.version>2.401.3</jenkins.version>
<jenkins.version>2.452.3</jenkins.version>
<jenkinsRuleTimeout>0</jenkinsRuleTimeout>
<skip.surefire.tests>${skipTests}</skip.surefire.tests>
<skipITs>true</skipITs>
Expand All @@ -89,8 +89,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.401.x</artifactId>
<version>2671.va_73a_b_4c103fb_</version>
<artifactId>bom-2.452.x</artifactId>
<version>3208.vb_21177d4b_cd9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,32 @@
License.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form"
xmlns:l="/lib/layout" xmlns:dd="/lib/layout/dropdowns">
<j:if test="${it.hasPermission(it.PROVISION)}">
<j:set var="formId" value="${h.generateId()}"/>
<tr>
<td/>
<td colspan="${monitors.size()+1}">
<f:form action="${rootURL}/${it.url}/provision" method="post" name="provision">
<input type="submit" class="gce-provision-button" value="${%Provision via} ${it.displayName}"/>
<select name="configuration">
<j:forEach var="c" items="${it.configurations}">
<option value="${c.description}">${c.description}</option>
</j:forEach>
</select>
<st:once>
<script>
Behaviour.register({
".gce-provision-button" : function (e) {
new YAHOO.widget.Button(e, { type: "menu", menu: e.nextSibling });
}
});
</script>
</st:once>
<td colspan="${monitors.size()+2}">
<l:overflowButton icon="symbol-add"
text="${%Provision via} ${it.displayName}"
tooltip="${null}"
clazz="jenkins-!-margin-top-2">
<j:forEach var="t" items="${it.configurations}">
<dd:custom>
<button class="jenkins-dropdown__item"
data-type="gcloud-provision"
data-form="${formId}"
data-url="${t.description}">
${t.description}
</button>
</dd:custom>
</j:forEach>
</l:overflowButton>
<f:form action="${rootURL}/${it.url}/provision" method="post" name="provision" id="${formId}">
<input type="hidden" name="configuration"/>
</f:form>
<st:adjunct includes="com.google.jenkins.plugins.computeengine.ComputeEngineCloud.provision"/>
</td>
</tr>
</j:if>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Behaviour.specify("[data-type='gcloud-provision']", 'gcloud-provision', -99, function(e) {
e.addEventListener("click", function (event) {
const form = document.getElementById(e.dataset.form);
form.querySelector("[name='configuration']").value = e.dataset.url;
buildFormTree(form);
form.submit();
});
});

0 comments on commit 005441d

Please sign in to comment.