Skip to content

Commit

Permalink
Merge branch 'add-icons-to-command-palette' into add-groups-to-comman…
Browse files Browse the repository at this point in the history
…d-palette
  • Loading branch information
janfaracik committed Dec 13, 2024
2 parents 26f17a2 + 674d508 commit 5657369
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>6.2.0</version>
<version>6.2.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/java/hudson/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import jenkins.util.SystemProperties;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.Beta;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerProxy;
import org.kohsuke.stapler.StaplerRequest2;
Expand Down Expand Up @@ -685,9 +686,9 @@ public void doSubmitDescription(StaplerRequest2 req, StaplerResponse2 rsp) throw
}

/**
* To be called from {@link Jenkins#reload} only.
* Called from {@link Jenkins#reload}.
*/
@Restricted(NoExternalUse.class)
@Restricted(Beta.class)
public static void reload() throws IOException {
UserIdMapper.getInstance().reload();
AllUsers.reload();
Expand Down
11 changes: 6 additions & 5 deletions core/src/main/java/hudson/search/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,19 @@ public static class Item {

private final String type;

private final String iconXml;
private final String icon;

private final String group;

public Item(String name) {
this(name, null, null, null, null);
}

public Item(String name, String url, String iconXml, String type, String group) {
public Item(String name, String url, String icon, String type, String group) {
this.name = name;
this.url = url;
this.iconXml = iconXml;
this.icon = icon;
this.name = name;
this.type = type;
this.group = group;
}
Expand All @@ -299,8 +300,8 @@ public String getUrl() {
}

@Exported
public String getIconXml() {
return iconXml;
public String getIcon() {
return icon;
}

@Exported
Expand Down
14 changes: 11 additions & 3 deletions core/src/main/java/jenkins/model/Jenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -3318,11 +3318,19 @@ public void load() throws IOException {
if (cfg.exists()) {
// reset some data that may not exist in the disk file
// so that we can take a proper compensation action later.
String originalPrimaryView = primaryView;
List<View> originalViews = new ArrayList<>(views);
primaryView = null;
views.clear();

// load from disk
cfg.unmarshal(Jenkins.this);
try {
// load from disk
cfg.unmarshal(Jenkins.this);
} catch (IOException | RuntimeException x) {
primaryView = originalPrimaryView;
views.clear();
views.addAll(originalViews);
throw x;
}
}
// initialize views by inserting the default view if necessary
// this is both for clean Jenkins and for backward compatibility.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@

package jenkins.model.experimentalflags;

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import hudson.Extension;
import jenkins.util.SystemProperties;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

Expand All @@ -46,4 +48,10 @@ public String getDisplayName() {
public String getShortDescription() {
return "Remove YUI from all Jenkins UI pages. This will break anything that depends on YUI";
}

@NonNull
@Override
public Boolean getDefaultValue() {
return SystemProperties.getBoolean(RemoveYuiUserExperimentalFlag.class.getName() + ".defaultValue", true);
}
}
3 changes: 1 addition & 2 deletions core/src/main/java/org/jenkins/ui/icon/IconSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
/**
* Icon Specification.
* <br>
* Plugin extension points that implement/extend Action/ManagementLink should
* also implement this interface.
* If your class provides an icon spec you should implement this interface.
*
* @author <a href="mailto:[email protected]">[email protected]</a>
* @since 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<st:include it="${it.primaryView}" page="sidepanel.jelly" xmlns:st="jelly:stapler" />
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler">
<j:set var="primaryView" value="${it.primaryView}"/>
<j:if test="${primaryView != null}">
<st:include it="${primaryView}" page="sidepanel.jelly"/>
</j:if>
</j:jelly>
2 changes: 1 addition & 1 deletion core/src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</skin>
<custom>
<matomo>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.20.2</version>
<version>10.21.0</version>
</dependency>
</dependencies>
<executions>
Expand Down
2 changes: 1 addition & 1 deletion src/main/js/components/command-palette/datasources.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const JenkinsSearchSource = {
rsp.json().then((data) => {
return data["suggestions"].slice().map((e) =>
LinkResult({
icon: e.iconXml,
icon: e.icon,
type: e.type,
label: e.name,
url: correctAddress(e.url),
Expand Down
2 changes: 1 addition & 1 deletion src/main/js/components/command-palette/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { xmlEscape } from "@/util/security";
* @param {Object} params
* @param {string} params.icon
* @param {string} params.label
* @param {string} params.type
* @param {'symbol' | 'image'} params.type
* @param {string} params.url
* @param {string | null} params.group
* @param {boolean | undefined} params.isExternal
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>6.969.v7d22c6eb_fde1</version>
<version>6.973.vc9b_85a_61e4fc</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
16 changes: 16 additions & 0 deletions test/src/test/java/jenkins/model/JenkinsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand All @@ -46,6 +48,7 @@
import hudson.XmlFile;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.model.AllView;
import hudson.model.Computer;
import hudson.model.Failure;
import hudson.model.FreeStyleProject;
Expand Down Expand Up @@ -101,6 +104,7 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.reactor.ReactorException;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.JenkinsRule.WebClient;
Expand Down Expand Up @@ -755,4 +759,16 @@ public String getUrlName() {
return null;
}
}

@Test
public void reloadViews() throws Exception {
assertThat(j.jenkins.getPrimaryView(), isA(AllView.class));
assertThat(j.jenkins.getViews(), contains(isA(AllView.class)));
Files.writeString(j.jenkins.getConfigFile().getFile().toPath(), "<broken");
assertThrows(ReactorException.class, j.jenkins::reload);
j.createWebClient().goTo("manage/");
assertThat(j.jenkins.getPrimaryView(), isA(AllView.class));
assertThat(j.jenkins.getViews(), contains(isA(AllView.class)));
}

}
2 changes: 1 addition & 1 deletion war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ THE SOFTWARE.
<host>localhost</host>
<!-- HTTP listener port -->
<port>8080</port>
<mina-sshd-api.version>2.14.0-133.vcc091215a_358</mina-sshd-api.version>
<mina-sshd-api.version>2.14.0-136.v4d2b_0853615e</mina-sshd-api.version>
<!-- Minimum Remoting version, which is tested for API compatibility, duplicated so that renovate only updates the latest remoting version property -->
<remoting.minimum.supported.version>3107.v665000b_51092</remoting.minimum.supported.version>

Expand Down
10 changes: 0 additions & 10 deletions war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,6 @@ var resURL = "not-defined-yet"; // eslint-disable-line no-unused-vars
}
})();

(function initializeYUIDebugLogReader() {
Behaviour.addLoadEvent(function () {
var logReaderElement = document.getElementById("yui-logreader");
if (logReaderElement !== null) {
var logReader = new YAHOO.widget.LogReader("yui-logreader");
logReader.collapse();
}
});
})();

// Form check code
//========================================================
var FormChecker = {
Expand Down

0 comments on commit 5657369

Please sign in to comment.