From a956752eb0bd5a30e6f2c59622cbc76fc5dbb7ec Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Mon, 19 Jul 2021 17:03:26 +1000 Subject: [PATCH 1/2] [JENKINS-66168] Test enable/disable from Folder Views --- .../folder/computed/ComputedFolderTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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 f2f05db2..243f36e6 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 @@ -95,6 +95,7 @@ import org.jvnet.hudson.test.TestExtension; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.xml.sax.SAXException; public class ComputedFolderTest { @@ -547,6 +548,28 @@ public void enabledAndDisableFromUi() throws Exception { assertFalse(folder.isDisabled()); } + @Issue("JENKINS-66168") + @Test + public void enabledAndDisableFromUiViews() throws Exception { + LockedDownSampleComputedFolder folder = r.jenkins.createProject(LockedDownSampleComputedFolder.class, "d"); + assertFalse("by default, a folder is disabled", folder.isDisabled()); + folder.getViews().forEach(view -> { + try { + String viewUrl =view.getViewUrl(); + HtmlForm cfg = (HtmlForm) r.createWebClient().goTo(viewUrl).getElementById("disable-project"); + assertNotNull(cfg); + r.submit(cfg); + assertTrue("Can disable from view " + view.getViewName(), folder.isDisabled()); + cfg = (HtmlForm) r.createWebClient().goTo(viewUrl).getElementById("enable-project"); + assertNotNull(cfg); + r.submit(cfg); + assertTrue("Can enable from view " + view.getViewName(), !folder.isDisabled()); + } catch (Exception e) { + Assert.fail(); + } + }); + } + @Test public void failAllDeletedOnes() throws Exception { OneUndeletableChildComputedFolder d = r.jenkins.createProject(OneUndeletableChildComputedFolder.class, "d"); From 8cb7ae283eeb1edcb9e5d584896623afb422f931 Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Mon, 19 Jul 2021 17:18:12 +1000 Subject: [PATCH 2/2] [JENKINS-66168] Fix disable/enable button URLs from views --- .../hudson/plugins/folder/AbstractFolder/view-index-top.jelly | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 280411c9..4639fa2b 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 @@ -44,7 +44,7 @@ THE SOFTWARE.
-
+ ${%disabled(it.pronoun)} @@ -54,7 +54,7 @@ THE SOFTWARE.
- +