Skip to content

Commit

Permalink
Merge branch 'master' into new-search-bar-component
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jul 25, 2022
2 parents 6cfce9f + ef7f408 commit 591e983
Show file tree
Hide file tree
Showing 61 changed files with 677 additions and 6,480 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.3</version>
<version>1.4</version>
</extension>
</extensions>
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This page provides information about contributing code to the Jenkins core codeb
* Apache Maven 3.8.1 or above. You can [download Maven here](https://maven.apache.org/download.cgi).
In the Jenkins project we usually use the most recent Maven release.
* Any IDE which supports importing Maven projects.
* Install [NodeJS](https://nodejs.org/en/). **Note:** only needed to work on the frontend assets found in the `war` module.
* Frontend tasks are run using [yarn](https://yarnpkg.com/lang/en/). Run `npm install -g yarn` to install it.
* Install [NodeJS 16.x](https://nodejs.org/en/). **Note:** only needed to work on the frontend assets found in the `war` module.
* Frontend tasks are run using [yarn](https://yarnpkg.com/). Run `npm install -g yarn` to install it.
4. Set up your development environment as described in [Preparing for Plugin Development](https://www.jenkins.io/doc/developer/tutorial/prepare/)

If you want to contribute to Jenkins, or just learn about the project,
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for (i = 0; i < buildTypes.size(); i++) {
// Now run the actual build.
stage("${buildType} Build / Test") {
timeout(time: 6, unit: 'HOURS') {
realtimeJUnit(healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml,war/target/jest-result.xml') {
realtimeJUnit(healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml') {
def mavenOptions = [
'-Pdebug',
'-Penable-jacoco',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3538/badge)](https://bestpractices.coreinfrastructure.org/projects/3538)

In a nutshell, Jenkins is the leading open-source automation server.
Built with Java, it provides over 1,700 [plugins](https://plugins.jenkins.io/) to support automating virtually anything,
Built with Java, it provides over 1,800 [plugins](https://plugins.jenkins.io/) to support automating virtually anything,
so that humans can spend their time doing things machines cannot.

# What to Use Jenkins for and When to Use It
Expand Down
1 change: 0 additions & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 0 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,11 @@ THE SOFTWARE.
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ THE SOFTWARE.
<p>${%Or}</p>
<f:entry title="${%URL}">
<f:textbox name="pluginUrl"
class="jenkins-input validated" checkUrl="'checkPluginUrl?value='+this.value"/>
class="jenkins-input validated" checkUrl="checkPluginUrl" checkDependsOn="" />
</f:entry>
<f:submit value="${%Deploy}"/>
</f:form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ THE SOFTWARE.
<f:textbox name="parameter.name" value="${instance.name}" />
</f:entry>
<f:entry title="${%Choices}" help="/help/parameter/choice-choices.html">
<f:textarea checkUrl="'${rootURL}/descriptorByName/hudson.model.ChoiceParameterDefinition/checkChoices?value='+encodeURIComponent(this.value)" name="parameter.choices" value="${instance.choicesText}" />
<f:textarea checkUrl="${rootURL}/descriptorByName/hudson.model.ChoiceParameterDefinition/checkChoices" checkDependsOn="" name="parameter.choices" value="${instance.choicesText}" />
</f:entry>
<f:entry title="${%Description}" help="/help/parameter/description.html">
<f:textarea name="parameter.description" value="${instance.description}" codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription" />
</f:entry>
</j:jelly>
</j:jelly>
16 changes: 5 additions & 11 deletions core/src/main/resources/hudson/model/View/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,15 @@ THE SOFTWARE.
<t:editableDescription permission="${it.CONFIGURE}"/>
</div>
</st:include>

<j:set var="items" value="${it.items}"/>
<st:include page="main.jelly" />
</l:main-panel>
<l:header>
<!-- for screen resolution detection -->
<l:yui module="cookie" />
<script id="screenResolution-script" data-use-secure-cookie="${request.secure}">
var selfScript = document.querySelector('#screenResolution-script');
var secureCookie = selfScript.getAttribute('data-use-secure-cookie');
YAHOO.util.Cookie.set("screenResolution", screen.width+"x"+screen.height, {
path: "/",
secure: secureCookie === 'true'
});
</script>
<!-- for screen resolution detection -->
<l:yui module="cookie" />
<script id="screenResolution-script" data-use-secure-cookie="${request.secure}"/>
<st:adjunct includes="hudson.model.View.screen-resolution"/>
</l:header>
</l:layout>
</st:compress>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(function() {
var selfScript = document.querySelector('#screenResolution-script');
var secureCookie = selfScript.getAttribute('data-use-secure-cookie');
YAHOO.util.Cookie.set("screenResolution", screen.width + "x" + screen.height, {
path: "/",
secure: secureCookie === 'true'
});
})();
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="${%Startup Schedule}" help="/descriptor/hudson.triggers.TimerTrigger/help/spec">
<f:textarea name="retentionStrategy.startTimeSpec" checkUrl="'${rootURL}/retentionStrategy/SimpleScheduledRetentionStrategy/check?value='+encodeURIComponent(this.value)"
<f:textarea name="retentionStrategy.startTimeSpec" checkUrl="${rootURL}/retentionStrategy/SimpleScheduledRetentionStrategy/check" checkDependsOn=""
value="${instance.startTimeSpec}"/>
</f:entry>
<f:entry title="${%Scheduled Uptime}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ul>

<p style="text-align: center; margin: 10px 0 0 0;">
<a href="${rootURL}/manage" onclick="document.location.href='${rootURL}/manage';">
<a href="${rootURL}/manage">
${%Manage Jenkins}
</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE.

<j:if test="${activeMonitors != null and activeMonitors.size() > 0}">
<st:adjunct includes="jenkins.management.AdministrativeMonitorsDecorator.resources"/>

<j:set var="activeNonSecurityAM" value="${it.filterNonSecurityAdministrativeMonitors(activeMonitors)}" />
<j:set var="activeNonSecurityAMCount" value="${activeNonSecurityAM.size()}" />
<j:set var="activeSecurityAM" value="${it.filterSecurityAdministrativeMonitors(activeMonitors)}" />
Expand Down Expand Up @@ -69,22 +69,5 @@ THE SOFTWARE.
</div>
</j:if>
</div>
<script type="text/javascript">
(function() {
var amContainer = document.getElementById("visible-am-container");
var amInsertion = document.getElementById("visible-am-insertion");

if (amInsertion) {
amInsertion.appendChild(amContainer);
}

var secAmContainer = document.getElementById("visible-sec-am-container");
var secAmInsertion = document.getElementById("visible-sec-am-insertion");

if (secAmInsertion) {
secAmInsertion.appendChild(secAmContainer);
}
})();
</script>
</j:if>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,19 @@
});
});
})();

document.addEventListener('DOMContentLoaded', function() {
var amContainer = document.getElementById("visible-am-container");
var amInsertion = document.getElementById("visible-am-insertion");

if (amInsertion) {
amInsertion.appendChild(amContainer);
}

var secAmContainer = document.getElementById("visible-sec-am-container");
var secAmInsertion = document.getElementById("visible-sec-am-insertion");

if (secAmInsertion) {
secAmInsertion.appendChild(secAmContainer);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<l:icon src="symbol-help-circle"/>
</a>

<div id="search-box-completion" />
<script>createSearchBox("${searchURL}");</script>
<div id="search-box-completion" data-search-url="${searchURL}" />
<st:adjunct includes="jenkins.views.JenkinsHeader.search-box" />
</div>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(function() {
var element = document.getElementById('search-box-completion');
if (element) {
createSearchBox(element.getAttribute('data-search-url'));
}
})();
10 changes: 8 additions & 2 deletions core/src/main/resources/lib/form/checkbox.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ THE SOFTWARE.
If this attribute is unspecified or null, it defaults to unchecked, otherwise checked.
</st:attribute>
<st:attribute name="id" />
<st:attribute name="onclick" />
<st:attribute name="onclick" deprecated="true">
Inline JavaScript to execute when the checkbox is clicked.
Deprecated because this attribute is incompatible with adding Content-Security-Policy to the Jenkins UI in the future.
Set 'id' or 'class' attributes as appropriate to look up this element in external Javascript files (e.g. adjuncts)
to add the desired behavior there (DOMContentLoaded event in static forms, Behaviour.specify if this element may be
dynamically added). See https://github.com/jenkinsci/jenkins/pull/6852 for an example.
</st:attribute>
<st:attribute name="class" />
<st:attribute name="negative" />
<st:attribute name="readonly">
<st:attribute name="readonly" deprecated="true">
If set to true, this will take precedence over the onclick attribute and prevent the state of the checkbox from being changed.

Note: if you want an actual read only checkbox then add:
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/lib/form/combobox/combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Behaviour.specify("INPUT.combobox2", 'combobox', 100, function(e) {
new Ajax.Request(e.getAttribute("fillUrl"),{
parameters: params,
onSuccess : function(rsp) {
items = eval('('+rsp.responseText+')');
items = JSON.parse(rsp.responseText);
}
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function createFilterMenuButton(button, menu, menuAlignment, menuMinScrollHeight

menuButton._menu.element.appendChild(filter);
menuButton._menu.showEvent.subscribe(function () {
filter.firstElementChild.value = '';
_applyFilterKeyword(menuButton._menu, filter.firstElementChild);
filter.style.display = (_getItemList(menuButton._menu).children.length >= MIN_NUM_OPTIONS) ? '' : 'NONE';
});
Expand All @@ -31,7 +30,7 @@ function _createFilterMenuButton(menu) {
filterInput.setAttribute("spellcheck", "false");
filterInput.setAttribute("type", "search");

filterInput.addEventListener('input', (event) => _applyFilterKeyword(menu, event));
filterInput.addEventListener('input', (event) => _applyFilterKeyword(menu, event.currentTarget));

const filterContainer = document.createElement("div");
filterContainer.appendChild(filterInput);
Expand All @@ -40,7 +39,7 @@ function _createFilterMenuButton(menu) {
}

function _applyFilterKeyword(menu, filterInput) {
const filterKeyword = (filterInput.currentTarget.value || '').toLowerCase();
const filterKeyword = (filterInput.value || '').toLowerCase();
const itemList = _getItemList(menu);
let item, match;
for (item of itemList.children) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/optionalBlock.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ THE SOFTWARE.
<div class="optionalBlock-container jenkins-form-item">
<div class="help-sibling tr optional-block-start row-group-start ${attrs.inline?'':'row-set-start'}" hasHelp="${attrs.help!=null}"><!-- this ID marks the beginning -->
<div class="jenkins-checkbox-help-wrapper">
<f:checkbox name="${attrs.name}" class="optional-block-control block-control" onclick="javascript:updateOptionalBlock(this,true)"
<f:checkbox name="${attrs.name}" class="optional-block-control block-control optional-block-event-item"
negative="${attrs.negative}" checked="${attrs.checked}" field="${attrs.field}" title="${title}" />
<f:helpLink url="${attrs.help}" featureName="${title}"/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/form/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function updateListBox(listBox,url,config) {

var selectionSet = false; // is the selection forced by the server?
var possibleIndex = null; // if there's a new option that matches the current value, remember its index
var opts = eval('('+rsp.responseText+')').values;
var opts = JSON.parse(rsp.responseText).values;
for( var i=0; i<opts.length; i++ ) {
l.options[i] = new Option(opts[i].name,opts[i].value);
if(opts[i].selected) {
Expand Down
10 changes: 0 additions & 10 deletions core/src/main/resources/lib/form/toggleSwitch.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,10 @@ THE SOFTWARE.
If this attribute is unspecified or null, it defaults to unchecked, otherwise checked.
</st:attribute>
<st:attribute name="id"/>
<st:attribute name="onclick"/>
<st:attribute name="class"/>
<st:attribute name="invertLabel">
Move the label of the toggle switch to the opposite side
</st:attribute>
<st:attribute name="readonly">
If set to true, this will take precedence over the onclick attribute and prevent the state of the checkbox from
being changed.

Note: if you want an actual read only checkbox then add:
&lt;j:set var="readOnlyMode" value="true"/&gt; inside your entry tag
See https://www.jenkins.io/doc/developer/views/read-only/#enabling-read-only-view-support
</st:attribute>
<st:attribute name="field">
Used for databinding. TBD.
</st:attribute>
Expand All @@ -80,7 +71,6 @@ THE SOFTWARE.
name="${name}"
value="${value}"
id="${id}"
onclick="${readonly=='true' ? 'return false;' : onclick}"
class="jenkins-toggle-switch__input ${attrs.class} ${checkUrl!=null?'validated':''}"
checkUrl="${checkUrl}"
checkDependsOn="${checkDependsOn}" json="${json}"
Expand Down
24 changes: 24 additions & 0 deletions core/src/main/resources/lib/hudson/build-caption.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function(){
function updateBuildCaptionIcon(){
new Ajax.Request("statusIcon",{
method: "get",
onComplete: function(rsp,_) {
var isBuilding = rsp.getResponseHeader("X-Building");
if (isBuilding == "true") {
setTimeout(updateBuildCaptionIcon, 5000)
} else {
var progressBar = document.querySelector(".build-caption-progress-container");
if (progressBar) {
progressBar.style.display = "none";
}
}
document.querySelector(".build-caption .icon-xlg").outerHTML = rsp.responseText;
}
});
}

window.addEventListener("load", function(){
Event.observe(window, "jenkins:consoleFinished", updateBuildCaptionIcon);
});

})();
29 changes: 2 additions & 27 deletions core/src/main/resources/lib/hudson/buildCaption.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,6 @@ THE SOFTWARE.
</tr></table>
</div>
</j:if>
<script>
(function(){
function updateBuildCaptionIcon(){
new Ajax.Request("statusIcon",{
method: "get",
onComplete: function(rsp,_) {
var isBuilding = rsp.getResponseHeader("X-Building");
if (isBuilding == "true") {
setTimeout(updateBuildCaptionIcon, 5000)
} else {
var progressBar = document.querySelector(".build-caption-progress-container");
if (progressBar) {
progressBar.style.display = "none";
}
}
document.querySelector(".build-caption .icon-xlg").outerHTML = rsp.responseText;
}
});
}

window.addEventListener("load", function(){
Event.observe(window, "jenkins:consoleFinished", updateBuildCaptionIcon);
});

})();
</script>
</h1>
<st:adjunct includes="lib.hudson.build-caption"/>
</h1>
</j:jelly>
5 changes: 2 additions & 3 deletions core/src/main/resources/lib/hudson/executors.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ THE SOFTWARE.
</l:pane>
<!-- schedule updates only for the full page reload -->
<j:if test="${ajax==null and h.hasPermission(app.READ)}">
<script defer="defer">
refreshPart('executors',"${rootURL}/${h.hasView(it,'ajaxExecutors')?it.url:''}ajaxExecutors");
</script>
<div class="widget-refresh-reference" data-id="executors" data-url="${rootURL}/${h.hasView(it,'ajaxExecutors')?it.url:''}ajaxExecutors"/>
<st:adjunct includes="lib.hudson.widget-refresh"/>
</j:if>
</j:jelly>
Loading

0 comments on commit 591e983

Please sign in to comment.