Skip to content

Commit

Permalink
Merge branch 'master' into remove_deprecated_separator
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Jul 12, 2023
2 parents 0537362 + 1ec59c7 commit 663d67e
Show file tree
Hide file tree
Showing 86 changed files with 1,462 additions and 869 deletions.
18 changes: 18 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@
"matchStrings": ["ARG MAVEN_VERSION=(?<currentValue>.*?)\n"],
"depNameTemplate": "org.apache.maven:maven-core",
"datasourceTemplate": "maven"
},
{
"fileMatch": ["core/src/site/site.xml"],
"matchStrings": ["lit@(?<currentValue>.*?)/"],
"depNameTemplate": "lit",
"datasourceTemplate": "npm"
},
{
"fileMatch": ["core/src/site/site.xml"],
"matchStrings": ["webcomponentsjs@(?<currentValue>.*?)/"],
"depNameTemplate": "@webcomponents/webcomponentsjs",
"datasourceTemplate": "npm"
},
{
"fileMatch": ["core/src/site/site.xml"],
"matchStrings": ["<version>(?<currentValue>.*?)<\/version>"],
"depNameTemplate": "org.apache.maven.skins:maven-fluido-skin",
"datasourceTemplate": "maven"
}
],
"labels": ["dependencies", "skip-changelog"],
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ THE SOFTWARE.
<properties>
<asm.version>9.5</asm.version>
<slf4jVersion>2.0.7</slf4jVersion>
<stapler.version>1785.vf9cb_74a_b_ec5b_</stapler.version>
<stapler.version>1802.v9e2750160d01</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ THE SOFTWARE.
<plugins>
<plugin>
<!-- generate Jelly tag lib documentation -->
<groupId>org.kohsuke.stapler</groupId>
<artifactId>maven-stapler-plugin</artifactId>
<groupId>io.jenkins.tools.maven</groupId>
<artifactId>stapler-maven-plugin</artifactId>
<!-- Version specified in grandparent POM -->
<configuration>
<patterns>
Expand Down
21 changes: 21 additions & 0 deletions core/src/main/java/jenkins/model/ModelObjectWithContextMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ public ContextMenu add(String url, String icon, String iconXml, String text, boo
return this;
}

/** @since TODO */
public ContextMenu add(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge, String message) {
if (text != null && icon != null && url != null) {
MenuItem item = new MenuItem(url, icon, text);
item.iconXml = iconXml;
item.post = post;
item.requiresConfirmation = requiresConfirmation;
item.badge = badge;
item.message = message;
items.add(item);
}
return this;
}

/**
* Add a header row (no icon, no URL, rendered in header style).
*
Expand Down Expand Up @@ -340,6 +354,8 @@ class MenuItem {

private Badge badge;

private String message;

/**
* The type of menu item
* @since 2.340
Expand Down Expand Up @@ -369,6 +385,11 @@ public Badge getBadge() {
return badge;
}

@Exported
public String getMessage() {
return message;
}

public MenuItem(String url, String icon, String displayName) {
withUrl(url).withIcon(icon).withDisplayName(displayName);
}
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,22 @@ public List<RunT> getEstimatedDurationCandidates() {
List<RunT> candidates = new ArrayList<>(3);
for (Result threshold : List.of(Result.UNSTABLE, Result.FAILURE)) {
for (RunT build : loadedBuilds) {
if (candidates.contains(build)) {
continue;
}
if (!build.isBuilding()) {
Result result = build.getResult();
if (result != null && result.isBetterOrEqualTo(threshold)) {
candidates.add(build);
if (candidates.size() == 3) {
LOGGER.fine(() -> "Candidates: " + candidates);
return candidates;
}
}
}
}
}
LOGGER.fine(() -> "Candidates: " + candidates);
return candidates;
}

Expand Down
55 changes: 50 additions & 5 deletions core/src/main/resources/hudson/PluginManager/_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ Behaviour.specify("#filter-box", "_table", 0, function (e) {
return;
}

var pluginI18n = select(".plugins.i18n");
function i18n(messageId) {
return pluginI18n.getAttribute("data-" + messageId);
}

// Create a map of the plugin rows, making it easy to index them.
var plugins = {};
for (var i = 0; i < pluginTRs.length; i++) {
Expand Down Expand Up @@ -482,6 +477,52 @@ window.addEventListener("load", function () {
});
}

const uninstallButtons = document.querySelectorAll(
"[data-action='uninstall']"
);
uninstallButtons.forEach((uninstallButton) => {
uninstallButton.addEventListener("click", () => {
const title = uninstallButton.dataset.message;
const href = uninstallButton.dataset.href;

const options = {
message: i18n("uninstall-description"),
type: "destructive",
};

dialog.confirm(title, options).then(
() => {
var form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("action", href);
crumb.appendToForm(form);
document.body.appendChild(form);
form.submit();
},
() => {}
);
});
});

// Enable/disable the 'Update' button depending on if any updates are checked
const anyCheckboxesSelected = () => {
return (
document.querySelectorAll("input[type='checkbox']:checked:not(:disabled)")
.length > 0
);
};
const updateButton = document.querySelector("#button-update");
const checkboxes = document.querySelectorAll(
"input[type='checkbox'], [data-select], .jenkins-table__checkbox"
);
checkboxes.forEach((checkbox) => {
checkbox.addEventListener("click", () => {
setTimeout(() => {
updateButton.disabled = !anyCheckboxesSelected();
});
});
});

// Show update center error if element exists
const updateCenterError = document.querySelector("#update-center-error");
if (updateCenterError) {
Expand All @@ -491,3 +532,7 @@ window.addEventListener("load", function () {
);
}
});

function i18n(messageId) {
return document.querySelector("#i18n").getAttribute("data-" + messageId);
}
33 changes: 22 additions & 11 deletions core/src/main/resources/hudson/PluginManager/available.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,34 @@ THE SOFTWARE.
value="${request.getParameter('filter')}" />
</div>
<div class="jenkins-app-bar__controls">
<l:isAdmin>
<div class="jenkins-split-button">
<button id="button-install" form="form" type="submit" name="dynamicLoad" class="jenkins-button jenkins-button--primary">
<div class="jenkins-dropdown__item__icon">
<l:icon src="symbol-download" />
</div>
${%Install}
</button>
<l:overflowButton id="button-install-after-restart"
icon="symbol-chevron-down"
tooltip="${null}"
clazz="jenkins-button--primary">
<button form="form" type="submit" class="jenkins-dropdown__item">
<div class="jenkins-dropdown__item__icon">
<l:icon src="symbol-download" />
</div>
${%Install after restart}
</button>
</l:overflowButton>
</div>
</l:isAdmin>
<st:include page="check.jelly"/>
</div>
</div>

<script src="${resURL}/jsbundles/plugin-manager-ui.js" type="text/javascript"/>

<form method="post" action="install">
<form id="form" method="post" action="install">
<table id="plugins" class="jenkins-table sortable"
data-hasAdmin="${h.hasPermission(app.ADMINISTER)}">
<thead>
Expand All @@ -65,16 +86,6 @@ THE SOFTWARE.
</thead>
<tbody/>
</table>

<div id="bottom-sticker">
<div class="bottom-sticker-inner">
<l:isAdmin>
<f:submit value="${%Install without restart}" name="dynamicLoad"/>
<span style="margin-left:2em;"></span>
<f:submit value="${%Download now and install after restart}"/>
</l:isAdmin>
</div>
</div>
</form>
</l:main-panel>
</l:layout>
Expand Down
35 changes: 19 additions & 16 deletions core/src/main/resources/hudson/PluginManager/installed.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ THE SOFTWARE.
<div class="alert alert-warning"><strong>${%Warning}</strong>: ${%requires.restart}</div>
</j:if>

<div class="plugins i18n"
data-cannot-enable="${%This plugin cannot be enabled}"
data-cannot-disable="${%This plugin cannot be disabled}"
data-cannot-uninstall="${%This plugin cannot be uninstalled}"
data-disabled-dependencies="${%It has one or more unsatisfied dependencies}"
data-enabled-dependents="${%It has one or more enabled dependents}"
data-installed-dependents="${%It has one or more installed dependents}"
data-detached-disable="${%detached-disable}"
data-detached-uninstall="${%detached-uninstall}"
data-detached-possible-dependents="${%detached-possible-dependents}"
/>
<template id="i18n"
data-cannot-enable="${%This plugin cannot be enabled}"
data-cannot-disable="${%This plugin cannot be disabled}"
data-cannot-uninstall="${%This plugin cannot be uninstalled}"
data-disabled-dependencies="${%It has one or more unsatisfied dependencies}"
data-enabled-dependents="${%It has one or more enabled dependents}"
data-installed-dependents="${%It has one or more installed dependents}"
data-detached-disable="${%detached-disable}"
data-detached-uninstall="${%detached-uninstall}"
data-detached-possible-dependents="${%detached-possible-dependents}"
data-uninstall-description="${%uninstall-description}" />

<table id="plugins" class="jenkins-table sortable">
<j:choose>
Expand Down Expand Up @@ -225,11 +225,14 @@ THE SOFTWARE.
</j:forEach>
</div>
</j:if>
<form class="jenkins-buttons-row" method="post" action="plugin/${p.shortName}/uninstall">
<button class="jenkins-table__button jenkins-!-destructive-color uninstall" tooltip="${%Uninstall} ${p.updateInfo.displayName?:p.displayName}">
<l:icon src="symbol-close-circle"/>
</button>
</form>
<button data-action="uninstall"
type="button"
class="jenkins-table__button jenkins-!-destructive-color"
tooltip="${%Uninstall} ${p.updateInfo.displayName ?: p.displayName}"
data-href="plugin/${p.shortName}/doUninstall"
data-message="${%uninstall-title(p.updateInfo.displayName ?: p.displayName)}">
<l:icon src="symbol-close-circle"/>
</button>
</j:otherwise>
</j:choose>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ adoptThisPlugin=\
<strong>This plugin is up for adoption!</strong> We are looking for new maintainers. \
Visit our <a href="https://www.jenkins.io/doc/developer/plugin-governance/adopt-a-plugin/" rel="noopener noreferrer" target="_blank">Adopt a Plugin</a> initiative for more information.
reportIssue=Report an issue with this plugin
uninstall-title=Are you sure you want to uninstall {0}?
uninstall-description=This will remove the plugin binary from your $JENKINS_HOME, but it will leave the configuration files of the plugin untouched
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ It\ has\ one\ or\ more\ disabled\ dependencies=Mindestens eine Abhängigkeit ist
This\ plugin\ cannot\ be\ uninstalled=Dieses Plugin kann nicht deinstalliert werden.
No\ description\ available.=Keine Beschreibung verfügbar.
This\ plugin\ cannot\ be\ enabled=Dieses Plugin kann nicht aktiviert werden.
uninstall-title=Sind sie sicher dass sie {0} deinstallieren wollen?
uninstall-description=Dadurch wird die Plugin-Binärdatei aus $JENKINS_HOME entfernt, aber die Konfigurationsdateien des Plugins bleiben erhalten
22 changes: 10 additions & 12 deletions core/src/main/resources/hudson/PluginManager/updates.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,21 @@ THE SOFTWARE.
value="${request.getParameter('filter')}" />
</div>
<div class="jenkins-app-bar__controls">
<st:include page="check.jelly"/>
<l:isAdmin>
<j:if test="${!empty(list)}">
<button id="button-update" form="form" type="submit" class="jenkins-button jenkins-button--primary" disabled="true">
<l:icon src="symbol-download" />
${%Update}
</button>
</j:if>
</l:isAdmin>
<st:include page="check.jelly" />
</div>
</div>

<st:adjunct includes="hudson.PluginManager._table"/>

<form method="post" action="install">
<form id="form" method="post" action="install">
<j:set var="cache" value="${it.createCache()}"/>

<table id="plugins" class="jenkins-table sortable">
Expand Down Expand Up @@ -232,16 +240,6 @@ THE SOFTWARE.
</j:otherwise>
</j:choose>
</table>

<div id="bottom-sticker">
<div class="bottom-sticker-inner">
<l:isAdmin>
<j:if test="${!empty(list)}">
<f:submit value="${%Download now and install after restart}"/>
</j:if>
</l:isAdmin>
</div>
</div>
<d:invokeBody/>
</form>
</l:main-panel>
Expand Down
40 changes: 40 additions & 0 deletions core/src/main/resources/hudson/logging/LogRecorder/sidepanel.jelly
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<!--
Side panel for the log recorder
-->
<?jelly escape-by-default='true'?>
<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" xmlns:i="jelly:fmt">
<l:header />
<l:side-panel>
<l:tasks>
<l:task href="." icon="symbol-journal" title="${%Log records}"/>
<l:isAdmin>
<l:task href="configure" icon="symbol-settings" title="${%Configure}"/>
<l:delete title="${%Delete}" message="${%delete.logrecorder(it.displayName)}" />
</l:isAdmin>
</l:tasks>
</l:side-panel>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ THE SOFTWARE.
<l:side-panel>
<l:tasks>
<l:task contextMenu="false" href="${rootURL}/${it.url}" icon="${it.iconClassName}" title="${%Status}"/>
<l:task confirmationMessage="${%delete.confirm(it.name)}" href="${rootURL}/${it.url}doDelete" icon="icon-edit-delete icon-md" permission="${it.DELETE}" title="${%Delete Agent}" post="true" requiresConfirmation="true"/>
<l:delete permission="${it.DELETE}" title="${%Delete Agent}" message="${%delete.confirm(it.name)}"/>
<l:task href="${rootURL}/${it.url}configure" icon="symbol-settings" permission="${it.EXTENDED_READ}"
title="${it.hasPermission(it.CONFIGURE) ? '%Configure' : '%View Configuration'}"/>
<l:task href="${rootURL}/${it.url}builds" icon="symbol-build-history" title="${%Build History}"/>
Expand Down
Loading

0 comments on commit 663d67e

Please sign in to comment.