diff --git a/.github/renovate.json b/.github/renovate.json index 90c5a18d9f6d..cfd588a66b8d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -71,16 +71,6 @@ "org.fusesource.jansi:jansi" ] }, - { - "description": "Depends on commons-lang3 which is in progress for removal from core. See: https://issues.jenkins.io/browse/JENKINS-73355", - "matchManagers": [ - "maven" - ], - "enabled": false, - "matchPackageNames": [ - "org.apache.commons:commons-compress" - ] - }, { "description": "Contains incompatible API changes and needs compatibility work. See: https://github.com/jenkinsci/jenkins/pull/4224", "matchManagers": [ diff --git a/bom/pom.xml b/bom/pom.xml index 61de025b3e9b..f94253ce6f70 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -191,11 +191,6 @@ THE SOFTWARE. ant 1.10.15 - - org.apache.commons - commons-compress - 1.26.1 - org.apache.commons commons-fileupload2 diff --git a/core/pom.xml b/core/pom.xml index 9bff5e5ad0b2..0b9cb30d8763 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -285,17 +285,6 @@ THE SOFTWARE. org.apache.ant ant - - org.apache.commons - commons-compress - - - - org.apache.commons - commons-lang3 - - - org.apache.commons commons-fileupload2-core diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 150b1b658c16..67801475233d 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -62,6 +62,7 @@ import hudson.model.View; import hudson.scm.SCM; import hudson.scm.SCMDescriptor; +import hudson.search.SearchFactory; import hudson.search.SearchableModelObject; import hudson.security.ACL; import hudson.security.AccessControlled; @@ -124,6 +125,7 @@ import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.DecimalFormat; +import java.text.MessageFormat; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; @@ -2576,4 +2578,34 @@ static String guessIcon(String iconGuess, String rootURL) { public static String generateItemId() { return String.valueOf(Math.floor(Math.random() * 3000)); } + + @Restricted(NoExternalUse.class) + public static ExtensionList getSearchFactories() { + return SearchFactory.all(); + } + + /** + * @param keyboardShortcut the shortcut to be translated + * @return the translated shortcut, e.g. CMD+K to ⌘+K for macOS, CTRL+K for Windows + */ + @Restricted(NoExternalUse.class) + public static String translateModifierKeysForUsersPlatform(String keyboardShortcut) { + StaplerRequest2 currentRequest = Stapler.getCurrentRequest2(); + currentRequest.getWebApp().getDispatchValidator().allowDispatch(currentRequest, Stapler.getCurrentResponse2()); + String userAgent = currentRequest.getHeader("User-Agent"); + + List platformsThatUseCommand = List.of("MAC", "IPHONE", "IPAD"); + boolean useCmdKey = platformsThatUseCommand.stream().anyMatch(e -> userAgent.toUpperCase().contains(e)); + + return keyboardShortcut.replace("CMD", useCmdKey ? "⌘" : "CTRL"); + } + + @Restricted(NoExternalUse.class) + public static String formatMessage(String format, Object args) { + if (format == null) { + return args.toString(); + } + + return MessageFormat.format(format, args); + } } diff --git a/core/src/main/java/hudson/model/Descriptor.java b/core/src/main/java/hudson/model/Descriptor.java index 33c981d657f5..c55b7982695e 100644 --- a/core/src/main/java/hudson/model/Descriptor.java +++ b/core/src/main/java/hudson/model/Descriptor.java @@ -474,6 +474,12 @@ public void calcAutoCompleteSettings(String field, Map attribute if (method == null) return; // no auto-completion + // build query parameter line by figuring out what should be submitted + List depends = buildFillDependencies(method, new ArrayList<>()); + if (!depends.isEmpty()) { + attributes.put("fillDependsOn", String.join(" ", depends)); + } + attributes.put("autoCompleteUrl", String.format("%s/%s/autoComplete%s", getCurrentDescriptorByNameUrl(), getDescriptorUrl(), capitalizedFieldName)); } diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index d22c25e98e3d..7d140656e363 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -541,7 +541,7 @@ public void find(String token, List result) { public void suggest(String token, List result) { find(token, result); } - }).add("configure", "config", "configure"); + }); } @Override diff --git a/core/src/main/java/hudson/search/Search.java b/core/src/main/java/hudson/search/Search.java index 7773d9e9d696..9bd624e34742 100644 --- a/core/src/main/java/hudson/search/Search.java +++ b/core/src/main/java/hudson/search/Search.java @@ -158,7 +158,7 @@ public void doSuggestOpenSearch(StaplerRequest2 req, StaplerResponse2 rsp, @Quer public void doSuggest(StaplerRequest2 req, StaplerResponse2 rsp, @QueryParameter String query) throws IOException, ServletException { Result r = new Result(); for (SuggestedItem item : getSuggestions(req, query)) - r.suggestions.add(new Item(item.getPath())); + r.suggestions.add(new Item(item.getPath(), item.getUrl())); rsp.serveExposedBean(req, r, Flavor.JSON); } @@ -252,12 +252,25 @@ public static class Result { @ExportedBean(defaultVisibility = 999) public static class Item { + @Exported @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "read by Stapler") public String name; + private final String url; + public Item(String name) { + this(name, null); + } + + public Item(String name, String url) { this.name = name; + this.url = url; + } + + @Exported + public String getUrl() { + return url; } } diff --git a/core/src/main/java/hudson/search/SuggestedItem.java b/core/src/main/java/hudson/search/SuggestedItem.java index 9ba455270e58..6911d002fe50 100644 --- a/core/src/main/java/hudson/search/SuggestedItem.java +++ b/core/src/main/java/hudson/search/SuggestedItem.java @@ -62,7 +62,7 @@ private void getPath(StringBuilder buf) { buf.append(item.getSearchName()); else { parent.getPath(buf); - buf.append(' ').append(item.getSearchName()); + buf.append(" » ").append(item.getSearchName()); } } diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index 312f7a804cde..e643e848dd9b 100644 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -2346,9 +2346,7 @@ public String getSearchUrl() { public SearchIndexBuilder makeSearchIndex() { SearchIndexBuilder builder = super.makeSearchIndex(); if (hasPermission(ADMINISTER)) { - builder.add("configure", "config", "configure") - .add("manage") - .add("log"); + builder.add("manage", Messages.ManageJenkinsAction_DisplayName()); } builder.add(new CollectionSearchIndex() { @Override diff --git a/core/src/main/java/jenkins/telemetry/Telemetry.java b/core/src/main/java/jenkins/telemetry/Telemetry.java index 1f60e319f97d..de081c16954b 100644 --- a/core/src/main/java/jenkins/telemetry/Telemetry.java +++ b/core/src/main/java/jenkins/telemetry/Telemetry.java @@ -130,6 +130,11 @@ public static ExtensionList all() { return ExtensionList.lookup(Telemetry.class); } + @Restricted(NoExternalUse.class) // called by jelly + public static boolean isAnyTrialActive() { + return all().stream().anyMatch(Telemetry::isActivePeriod); + } + /** * @since 2.147 * @return whether to collect telemetry diff --git a/core/src/main/resources/hudson/model/UsageStatistics/global.groovy b/core/src/main/resources/hudson/model/UsageStatistics/global.groovy index 5506a37a67d5..7254eb283a60 100644 --- a/core/src/main/resources/hudson/model/UsageStatistics/global.groovy +++ b/core/src/main/resources/hudson/model/UsageStatistics/global.groovy @@ -8,7 +8,7 @@ def f=namespace(lib.FormTagLib) f.section(title: _("Usage Statistics")) { if (UsageStatistics.DISABLED) { - span(class: "jenkins-not-applicable") { + div(class: "jenkins-not-applicable jenkins-description") { raw(_("disabledBySystemProperty")) } } else if (FIPS140.useCompliantAlgorithms()) { diff --git a/core/src/main/resources/hudson/model/UsageStatistics/help-usageStatisticsCollected.jelly b/core/src/main/resources/hudson/model/UsageStatistics/help-usageStatisticsCollected.jelly index a1bef14d4e22..2d01661a175b 100644 --- a/core/src/main/resources/hudson/model/UsageStatistics/help-usageStatisticsCollected.jelly +++ b/core/src/main/resources/hudson/model/UsageStatistics/help-usageStatisticsCollected.jelly @@ -1,14 +1,14 @@ -
+

For any project, it's critical to know how the software is used, but tracking usage data is inherently difficult in open-source projects. Anonymous usage statistics address this need. When enabled, Jenkins periodically sends information to the Jenkins project. The Jenkins project uses this information to set development priorities. -

+

-

General usage statistics

+

General usage statistics

Jenkins reports the following general usage statistics:

    @@ -24,7 +24,7 @@

-

Telemetry collection

+

Telemetry collection

@@ -38,24 +38,34 @@ Each trial has a specific purpose and a defined end date, after which collection stops, independent of the installed versions of Jenkins or plugins. Once a trial is complete, the trial results may be aggregated and shared with the developer community.

-

- The following trials defined on this instance are active now or in the future: -

+ + -
- - -
${collector.displayName}
-
- -

- Start date: ${collector.start}
- End date: ${collector.end} -

-
-
-
-
+ + +

${%There are currently no active trials.}

+
+ +

+ The following trials defined on this instance are active now or in the future: +

+
+ + +
${collector.displayName}
+
+ +

+ Start date: ${collector.start} +
+ End date: ${collector.end} +

+
+
+
+
+
+
diff --git a/core/src/main/resources/jenkins/views/JenkinsHeader/search-box.js b/core/src/main/resources/jenkins/views/JenkinsHeader/search-box.js deleted file mode 100644 index 91e805c4ceaf..000000000000 --- a/core/src/main/resources/jenkins/views/JenkinsHeader/search-box.js +++ /dev/null @@ -1,6 +0,0 @@ -(function () { - var element = document.getElementById("search-box-completion"); - if (element) { - createSearchBox(element.getAttribute("data-search-url")); - } -})(); diff --git a/core/src/main/resources/lib/form/toggleSwitch.jelly b/core/src/main/resources/lib/form/toggleSwitch.jelly index 2a2da3e94eb4..b0c9fcf5f835 100644 --- a/core/src/main/resources/lib/form/toggleSwitch.jelly +++ b/core/src/main/resources/lib/form/toggleSwitch.jelly @@ -76,19 +76,19 @@ THE SOFTWARE. disabled="${readOnlyMode ? 'true' : null}" checked="${value ? 'true' : null}"/> - - ${description} + + ${attrs.description} diff --git a/core/src/main/resources/lib/layout/command-palette.jelly b/core/src/main/resources/lib/layout/command-palette.jelly new file mode 100644 index 000000000000..3d454f88a8c1 --- /dev/null +++ b/core/src/main/resources/lib/layout/command-palette.jelly @@ -0,0 +1,47 @@ + + + + + + The command palette overlay + + +
+ + +
+
+ +
+
+
+
+
+
+ diff --git a/core/src/main/resources/lib/layout/header/searchbox.jelly b/core/src/main/resources/lib/layout/header/searchbox.jelly index 916f5ad49c22..033dc2ab0407 100644 --- a/core/src/main/resources/lib/layout/header/searchbox.jelly +++ b/core/src/main/resources/lib/layout/header/searchbox.jelly @@ -1,25 +1,27 @@ - -