From ce29cc9ca14e499e1e7a77692f00d5b310a151a2 Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Wed, 16 Oct 2024 12:59:34 +1000 Subject: [PATCH 1/5] [JENKINS-73930] Put back the disabled warning --- .../AbstractFolder/view-index-top.jelly | 3 +++ .../folder/computed/ComputedFolderTest.java | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly index ea9408ac..736c1c6d 100644 --- a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly +++ b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly @@ -53,6 +53,9 @@ THE SOFTWARE. + +
${%disabled(it.pronoun)}
+
diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java index 19cf5afe..04c2d049 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java @@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -40,7 +41,6 @@ import com.cloudbees.hudson.plugins.folder.Folder; import com.cloudbees.hudson.plugins.folder.views.AbstractFolderViewHolder; import org.htmlunit.html.DomElement; -import org.htmlunit.html.HtmlForm; import org.htmlunit.html.HtmlPage; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; @@ -625,6 +625,29 @@ public void failAllDeletedOnes() throws Exception { d.assertItemNames(2, "A"); } + @Issue("JENKINS-73930") + @Test + public void disabledWarningFromUiViews() throws Exception { + LockedDownSampleComputedFolder folder = r.jenkins.createProject(LockedDownSampleComputedFolder.class, "d"); + assertFalse("by default, a folder is disabled", folder.isDisabled()); + folder.getViews().forEach(view -> { + try { + assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } catch (Exception e) { + Assert.fail(); + } + }); + folder.setDisabled(true); + folder.save(); + folder.getViews().forEach(view -> { + try { + assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } catch (Exception e) { + Assert.fail(); + } + }); + } + /** * Waits until Hudson finishes building everything, including those in the queue, or fail the test * if the specified timeout milliseconds is From d3d9a2789d1549a6e93e8c8bc1bb5d2926ef819e Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Tue, 3 Dec 2024 18:24:36 -0500 Subject: [PATCH 2/5] Defend against null `AbstractFolder.primaryView` --- .../hudson/plugins/folder/AbstractFolder/sidepanel.jelly | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/sidepanel.jelly b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/sidepanel.jelly index 482ea4b5..914d78d7 100644 --- a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/sidepanel.jelly +++ b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/sidepanel.jelly @@ -23,8 +23,11 @@ THE SOFTWARE. --> - - + + + + + + - From fcc2359a069a0161e3ddcf30849340378fcb8eac Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Mon, 9 Dec 2024 17:15:12 +1000 Subject: [PATCH 3/5] [JENKINS-73930] Use for loop --- .../folder/computed/ComputedFolderTest.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java index 04c2d049..80ddcb6b 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java @@ -630,22 +630,14 @@ public void failAllDeletedOnes() throws Exception { public void disabledWarningFromUiViews() throws Exception { LockedDownSampleComputedFolder folder = r.jenkins.createProject(LockedDownSampleComputedFolder.class, "d"); assertFalse("by default, a folder is disabled", folder.isDisabled()); - folder.getViews().forEach(view -> { - try { - assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); - } catch (Exception e) { - Assert.fail(); - } - }); + for(View view : folder.getViews()){ + assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } folder.setDisabled(true); folder.save(); - folder.getViews().forEach(view -> { - try { - assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); - } catch (Exception e) { - Assert.fail(); - } - }); + for(View view : folder.getViews()){ + assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } } /** From c9fe2ab306a977d2946c6d44724fc062fd5391b7 Mon Sep 17 00:00:00 2001 From: Tim Jacomb Date: Wed, 11 Dec 2024 15:55:59 +0000 Subject: [PATCH 4/5] Add icons for search --- .../cloudbees/hudson/plugins/folder/AbstractFolder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java b/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java index a2ddd4fd..35ecee28 100644 --- a/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java +++ b/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java @@ -101,6 +101,7 @@ import jenkins.model.ProjectNamingStrategy; import jenkins.model.TransientActionFactory; import net.sf.json.JSONObject; +import org.jenkins.ui.icon.IconSpec; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.Beta; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -134,7 +135,7 @@ */ @SuppressWarnings({"unchecked", "rawtypes"}) // mistakes in various places @SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE") // https://github.com/spotbugs/spotbugs/issues/1539 -public abstract class AbstractFolder extends AbstractItem implements TopLevelItem, ItemGroup, ModifiableViewGroup, StaplerFallback, ModelObjectWithChildren, StaplerOverridable { +public abstract class AbstractFolder extends AbstractItem implements TopLevelItem, ItemGroup, ModifiableViewGroup, StaplerFallback, ModelObjectWithChildren, StaplerOverridable, IconSpec { /** * Our logger. @@ -305,6 +306,11 @@ protected AbstractFolderViewHolder newFolderViewHolder() { return new DefaultFolderViewHolder(views, null, newDefaultViewsTabBar()); } + @Override + public String getIconClassName() { + return icon.getIconClassName(); + } + protected FolderIcon newDefaultFolderIcon() { return new StockFolderIcon(); } From 69044ecbd271dcf46ba61a40171edc1a7565e45e Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Thu, 12 Dec 2024 14:49:06 -0700 Subject: [PATCH 5/5] [JENKINS-74990] Prevent stack overflow / Revert "Add icons for search" https://issues.jenkins.io/browse/JENKINS-74990 notes that when a folder definition includes the XML: ``` ``` then the 6.971.v9a_984fd08864 release of the plugin reports a stack overflow. Revert the change so that there is enough time for diagnosis without the pressure of users reporting and diagnosing bugs. This reverts commit c9fe2ab306a977d2946c6d44724fc062fd5391b7. --- .../cloudbees/hudson/plugins/folder/AbstractFolder.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java b/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java index 35ecee28..a2ddd4fd 100644 --- a/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java +++ b/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java @@ -101,7 +101,6 @@ import jenkins.model.ProjectNamingStrategy; import jenkins.model.TransientActionFactory; import net.sf.json.JSONObject; -import org.jenkins.ui.icon.IconSpec; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.Beta; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -135,7 +134,7 @@ */ @SuppressWarnings({"unchecked", "rawtypes"}) // mistakes in various places @SuppressFBWarnings("DMI_RANDOM_USED_ONLY_ONCE") // https://github.com/spotbugs/spotbugs/issues/1539 -public abstract class AbstractFolder extends AbstractItem implements TopLevelItem, ItemGroup, ModifiableViewGroup, StaplerFallback, ModelObjectWithChildren, StaplerOverridable, IconSpec { +public abstract class AbstractFolder extends AbstractItem implements TopLevelItem, ItemGroup, ModifiableViewGroup, StaplerFallback, ModelObjectWithChildren, StaplerOverridable { /** * Our logger. @@ -306,11 +305,6 @@ protected AbstractFolderViewHolder newFolderViewHolder() { return new DefaultFolderViewHolder(views, null, newDefaultViewsTabBar()); } - @Override - public String getIconClassName() { - return icon.getIconClassName(); - } - protected FolderIcon newDefaultFolderIcon() { return new StockFolderIcon(); }