Skip to content

Commit

Permalink
Merge branch 'master' into remove-yui
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinter69 committed Oct 7, 2024
2 parents f032590 + 4d7b7bf commit 13c227e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Jenkins Security Scan

on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:

permissions:
security-events: write
contents: read
actions: read

jobs:
security-scan:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.82</version>
<version>4.88</version>
<relativePath />
</parent>
<artifactId>matrix-project</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/hudson/matrix/LabelAxis.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@
package hudson.matrix;

import hudson.Extension;
import hudson.Functions;
import java.io.IOException;
import java.util.Set;
import jenkins.model.Jenkins;
import hudson.model.labels.LabelAtom;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundConstructor;

import java.util.ArrayList;
import java.util.List;

import static hudson.Functions.htmlAttributeEscape;
import static hudson.Functions.jsStringEscape;

/**
* {@link Axis} that selects label expressions.
*
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/hudson/matrix/MatrixProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@

import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.TokenList;
Expand Down Expand Up @@ -1125,6 +1127,11 @@ public List<AxisDescriptor> getAxisDescriptors() {
return r;
}

@Restricted(NoExternalUse.class)
public FormValidation doCheckDisplayNameOrNull(@AncestorInPath MatrixProject job, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, job.getName());
}

/**
* @deprecated as of 1.456
* This was only exposed for Jelly.
Expand Down
41 changes: 41 additions & 0 deletions src/main/resources/hudson/matrix/LabelAxis/label-axis-resources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Behaviour.specify("DIV.labelAxis-tree", 'LabelAxis', 0, function(e) {
var tree = new YAHOO.widget.TreeView(e);

var i18nContainer = document.querySelector(".label-axis-i18n");
var labels = new YAHOO.widget.TextNode(i18nContainer.getAttribute("data-i18n-labels"), tree.getRoot(), false);
var machines = new YAHOO.widget.TextNode(i18nContainer.getAttribute("data-i18n-individual-nodes"), tree.getRoot(), false);

var values = (e.getAttribute("values") || "").split("/");
function has(v) {
return values.includes(v) ? 'checked="checked" ' : "";
}

var labelAxisDataContainer = document.querySelector(".label-axis-data-container");
labelAxisDataContainer.childNodes.forEach(node => {
var labelCheckbox = node.getAttribute("data-label-checkbox");

var CHECKED_ATTR_INSERT_IDX = "<input ".length;
var output = [labelCheckbox.slice(0, CHECKED_ATTR_INSERT_IDX),
has(node.getAttribute("data-label-atom")), labelCheckbox.slice(CHECKED_ATTR_INSERT_IDX)].join('');
var label = node.getAttribute("data-label");
new YAHOO.widget.HTMLNode(output, label === "machines" ? machines : labels, false);
});

tree.draw();
/*
force the rendering of HTML, so that input fields are there
even when the form is submitted without this tree expanded.
*/
tree.expandAll();
tree.collapseAll();

/*
cancel the event.
from http://yuilibrary.com/forum/viewtopic.php?f=89&t=8209&p=26239&hilit=HTMLNode#p26239
"To prevent toggling and allow the link to work, add a listener to the clickEvent on that tree and simply return false"
*/
tree.subscribe("clickEvent", function(node) {
return false;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ THE SOFTWARE.
</f:optionalBlock>

<f:entry title="${%Display Name}" field="displayNameOrNull">
<f:textbox checkUrl="'${rootURL}/checkDisplayName?displayName='+encodeURIComponent(this.value)+'&amp;jobName='+encodeURIComponent('${h.jsStringEscape(it.name)}')"/>
<f:textbox/>
</f:entry>
</f:advanced>
</f:section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refreshPart('matrix',"./ajaxMatrix");
4 changes: 1 addition & 3 deletions src/main/resources/lib/hudson/matrix-project/matrix.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ THE SOFTWARE.
</j:otherwise>
</j:choose>
<j:if test="${ajax==null and attrs.autoRefresh and !h.isAutoRefresh(request)}">
<script defer="defer">
refreshPart('matrix',"./ajaxMatrix");
</script>
<st:adjunct includes="lib.hudson.matrix-project.matrix-resources"/>
</j:if>
</div>
</j:jelly>

0 comments on commit 13c227e

Please sign in to comment.