Skip to content

Commit

Permalink
Merge branch 'update-forms' into update-forms-2
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Jan 28, 2022
2 parents 9881a88 + f25a406 commit c029eb9
Show file tree
Hide file tree
Showing 276 changed files with 119 additions and 60 deletions.
4 changes: 2 additions & 2 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ THE SOFTWARE.

<properties>
<asm.version>9.2</asm.version>
<slf4jVersion>1.7.33</slf4jVersion>
<stapler.version>1638.v229a_24fa_b_17c</stapler.version>
<slf4jVersion>1.7.35</slf4jVersion>
<stapler.version>1642.ve454c4518974</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/AboutJenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class AboutJenkins extends ManagementLink {
@Override
public String getIconFileName() {
return "help.png";
return "help.svg";
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2289,4 +2289,10 @@ public static boolean isContextMenuVisible(Action a) {
return true;
}
}

@SuppressFBWarnings(value = "PREDICTABLE_RANDOM", justification = "True randomness isn't necessary for form item IDs")
@Restricted(NoExternalUse.class)
public static String generateItemId() {
return String.valueOf(Math.floor(Math.random() * 3000));
}
}
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/diagnosis/OldDataMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public Category getCategory() {

@Override
public String getIconFileName() {
return "document.png";
return "document.svg";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private WindowsInstallerLink(File jenkinsWar) {

@Override
public String getIconFileName() {
return "installer.gif";
return "installer.svg";
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,10 @@ public void setTemporarilyOffline(boolean temporarilyOffline, OfflineCause cause
@Exported
public String getIcon() {
// The machine was taken offline by someone
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "computer-user-offline.png";
if (isTemporarilyOffline() && getOfflineCause() instanceof OfflineCause.UserCause) return "computer-user-offline.svg";
// There is a "technical" reason the computer will not accept new builds
if (isOffline() || !isAcceptingTasks()) return "computer-x.png";
return "computer.png";
if (isOffline() || !isAcceptingTasks()) return "computer-x.svg";
return "computer.svg";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Descriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.jvnet.tiger_types.Types;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.BindInterceptor;
Expand All @@ -91,7 +92,6 @@
import org.kohsuke.stapler.WebApp;
import org.kohsuke.stapler.jelly.JellyCompatibleFacet;
import org.kohsuke.stapler.lang.Klass;
import org.springframework.util.StringUtils;

/**
* Metadata about a configurable instance.
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/ManagementLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public abstract class ManagementLink implements ExtensionPoint, Action {

/**
* Mostly works like {@link Action#getIconFileName()}, except that
* the expected icon size is 48x48, not 24x24. So if you give
* just a file name, "/images/48x48" will be assumed.
* the expected icon format is SVG. So if you give just a file name, "/images/svgs" will be assumed.
*
* @return
* As a special case, return null to exclude this object from the management link.
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/RunMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import jenkins.model.lazy.AbstractLazyLoadRunMap;
import jenkins.model.lazy.BuildReference;
import jenkins.model.lazy.LazyBuildMixIn;
import org.apache.commons.collections.comparators.ReverseComparator;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

Expand Down Expand Up @@ -160,7 +159,7 @@ public R oldestValue() {

/**
* @deprecated as of 1.485
* Use {@link ReverseComparator}
* Use {@link Comparator#reverseOrder}
*/
@Deprecated
public static final Comparator<Comparable> COMPARATOR = Comparator.reverseOrder();
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ public AsynchPeople(View parent) {
JSONObject entry = new JSONObject().
accumulate("id", u.getId()).
accumulate("fullName", u.getFullName()).
accumulate("url", u.getUrl()).
accumulate("url", u.getUrl() + "/").
accumulate("avatar", i.avatar != null ? i.avatar : Stapler.getCurrentRequest().getContextPath() + Functions.getResourcePath() + "/images/svgs/person.svg").
accumulate("timeSortKey", i.getTimeSortKey()).
accumulate("lastChangeTimeString", i.getLastChangeTimeString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public String getDescription() {

@Override
public String getIconFileName() {
return "secure.png";
return "secure.svg";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ public static final class ManageUserLinks extends ManagementLink {
@Override
public String getIconFileName() {
if (Jenkins.get().getSecurityRealm() instanceof HudsonPrivateSecurityRealm)
return "user.png";
return "user.svg";
else
return null; // not applicable now
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/util/FormValidation.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import jenkins.util.SystemProperties;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.springframework.util.StringUtils;

/**
* Represents the result of the form field validation.
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/CliLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class CliLink extends ManagementLink {

@Override
public String getIconFileName() {
return "terminal.png";
return "terminal.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ConfigureLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ConfigureLink extends ManagementLink {

@Override
public String getIconFileName() {
return "gear2.png";
return "gear.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ConsoleLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ConsoleLink extends ManagementLink {

@Override
public String getIconFileName() {
return "notepad.png";
return "notepad.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/NodesLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class NodesLink extends ManagementLink {

@Override
public String getIconFileName() {
return "network.png";
return "network.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/PluginsLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PluginsLink extends ManagementLink {

@Override
public String getIconFileName() {
return "plugin.png";
return "plugin.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ReloadLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ReloadLink extends ManagementLink {

@Override
public String getIconFileName() {
return "refresh.png";
return "refresh.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/ShutdownLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ShutdownLink extends ManagementLink {

@Override
public String getIconFileName() {
return "system-log-out.png";
return "system-log-out.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/StatisticsLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class StatisticsLink extends ManagementLink {

@Override
public String getIconFileName() {
return "monitor.png";
return "monitor.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/SystemInfoLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class SystemInfoLink extends ManagementLink {

@Override
public String getIconFileName() {
return "computer.png";
return "computer.svg";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/management/SystemLogLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class SystemLogLink extends ManagementLink {

@Override
public String getIconFileName() {
return "clipboard.png";
return "clipboard.svg";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public ContextMenu add(Node n) {
Computer c = n.toComputer();
return add(new MenuItem()
.withDisplayName(n.getDisplayName())
.withIconClass(c == null ? "icon-computer" : c.getIconClassName())
.withStockIcon(c == null ? "computer.svg" : c.getIcon())
.withContextRelativeUrl(n.getSearchUrl()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.sf.json.JSONObject;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;

/**
Expand All @@ -64,6 +65,11 @@ public Set<String> getIgnoredWarnings() {
return Collections.unmodifiableSet(ignoredWarnings);
}

@DataBoundSetter // unused; for CasC support only
public void setIgnoredWarnings(Set<String> ignoredWarnings) {
this.ignoredWarnings = new HashSet<>(ignoredWarnings);
}

public boolean isIgnored(@NonNull UpdateSite.Warning warning) {
return ignoredWarnings.contains(warning.id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class GlobalToolConfiguration extends ManagementLink {

@Override
public String getIconFileName() {
return "setting.png";
return "setting.svg";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ THE SOFTWARE.
${%No files in directory}
<j:if test="${showSymlinkWarning}">
<p>
<img id="symlinkalert" src="${imagesURL}/16x16/warning.png"/>
<img id="symlinkalert" src="${imagesURL}/svgs/warning.svg" width="16" height="16" />
${%Symlinks are hidden}
</p>
</j:if>
Expand Down Expand Up @@ -114,7 +114,7 @@ THE SOFTWARE.
</table>
<j:if test="${showSymlinkWarning}">
<p>
<img id="alert" src="${imagesURL}/16x16/warning.png"/>
<img id="alert" src="${imagesURL}/svgs/warning.svg" width="16" height="16" />
${%Symlinks are hidden}
</p>
</j:if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ THE SOFTWARE.
<l:main-panel>

<h1>
<img src="${imagesURL}/48x48/${it.icon}" width="48" height="48" alt=""/>
<img src="${imagesURL}/svgs/${it.icon}" width="48" height="48" alt=""/>
${it.caption} ${%System Information}
<j:if test="${!empty(it.node.nodeDescription)}">
<span style="font-size:smaller">(${it.node.nodeDescription})</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
{ "name": "email-ext", "suggested": true },
{ "name": "emailext-template" },
{ "name": "mailer", "suggested": true },
{ "name": "publish-over-ssh" },
{ "name": "ssh" }
]
},
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/jenkins/model/Jenkins/manage.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ THE SOFTWARE.

<j:if test="${icon!=null}">
<div class="jenkins-section__item">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL + '/48x48/' + icon}" />
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL + '/svgs/' + icon}" />
<j:set var="alt" value="${icon.replaceAll('\\d*\\.[^.]+$', '')}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(m.urlName, iconUrl, m.displayName, m.requiresPOST, m.requiresConfirmation) : null}
<j:choose>
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/lib/form/entry.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ THE SOFTWARE.
<j:when test="${possiblyEscapedTitle!=null}">
<div class="jenkins-form-label help-sibling">
<j:out value="${possiblyEscapedTitle}" />
<f:helpLink url="${attrs.help}" featureName="${title}"/>
<f:helpLink url="${attrs.help}" featureName="${attrs.title}"/>
</div>
<j:if test="${!empty(attrs.description)}">
<f:description>
Expand All @@ -98,7 +98,7 @@ THE SOFTWARE.
<j:otherwise>
<div class="setting-main help-sibling">
<d:invokeBody />
<f:helpLink url="${attrs.help}" featureName="${title}"/>
<f:helpLink url="${attrs.help}" featureName="${attrs.title}"/>
</div>
<!-- used to display the form validation error -->
<div class="validation-error-area tr"><div colspan="2"></div><div></div><div></div></div>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/form/radio.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ THE SOFTWARE.
Description text for the radiobutton, visible below the title.
</st:attribute>
</st:documentation>
<j:set var="itemId" value="${attrs.id ?: h.generateItemId()}" />
<div class="jenkins-radio">
<input class="jenkins-radio__input" type="radio" name="${attrs.name}" onclick="${attrs.onclick}"
id="${attrs.id}" value="${attrs.value}" checked="${attrs.checked?'true':null}"
id="${itemId}" value="${attrs.value}" checked="${attrs.checked?'true':null}"
disabled="${readOnlyMode?'true':null}" />
<label class="jenkins-radio__label ${attrs.id != null ? '' : 'attach-previous'}" for="${attrs.id}">${attrs.title}</label>
<label class="jenkins-radio__label" for="${itemId}">${attrs.title}</label>
<j:if test="${description != null}">
<div class="jenkins-radio__description">
${description}
Expand Down
9 changes: 4 additions & 5 deletions core/src/main/resources/lib/form/serverTcpPort.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ int port = instance ? instance[field] : 0
def f = namespace(lib.FormTagLib)

def type = "${field}.type"
def id = "${field}Id" // TODO: get rid of this

div(name: field) {
f.radio(name: type, value: "fixed", title: _("Fixed"), id: "radio-tcp-fixed", checked: port > 0) {
input(type: "number", class: "jenkins-input", name: "value", id: id, placeholder: _("Port"),
f.radio(name: type, value: "fixed", title: _("Fixed"), id: "radio-${field}-fixed", checked: port > 0) {
input(type: "number", class: "jenkins-input", name: "value", id: "${field}Id", placeholder: _("Port"),
value: port > 0 ? port : null, min: 0, max: 65535, step: 1)
}

f.radio(name: type, value: "random", title: _("Random"), id: "radio-tcp-random", checked: port == 0)
f.radio(name: type, value: "random", title: _("Random"), id: "radio-${field}-random", checked: port == 0)

f.radio(name: type, value: "disable", title: _("Disable"), id: "radio-tcp-disable", checked: port == -1)
f.radio(name: type, value: "disable", title: _("Disable"), id: "radio-${field}-disable", checked: port == -1)
}
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/executors.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THE SOFTWARE.
<st:nbsp/>
<j:choose>
<j:when test="${c.offlineCause!=null and !c.connecting}">
(<l:icon class="icon-error icon-sm" title="${c.offlineCause}"/> ${%offline})
(<img src="${imagesURL}/svgs/error.svg" width="16" height="16" title="${c.offlineCause}"/> ${%offline})
</j:when>
<j:when test="${c.connecting}">
(<l:icon class="icon-hourglass icon-sm"/>${%launching})
Expand Down
Loading

0 comments on commit c029eb9

Please sign in to comment.