Skip to content

Commit

Permalink
Merge pull request #185 from Dohbedoh/JENKINS-66168
Browse files Browse the repository at this point in the history
[JENKINS-66168] Fix the Disable/Enable button for non primary views
  • Loading branch information
bitwiseman authored Jul 23, 2021
2 parents 9130027 + 8cb7ae2 commit cd1b9b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ THE SOFTWARE.
</j:when>
<j:when test="${it.disabled}">
<div class="warning">
<form method="post" id='enable-project' action="enable">
<form method="post" id='enable-project' action="${rootURL}/${it.url}enable">
${%disabled(it.pronoun)}<st:nbsp/>
<l:hasPermission permission="${it.CONFIGURE}">
<f:submit value="${%Enable}"/>
Expand All @@ -54,7 +54,7 @@ THE SOFTWARE.
</j:when>
<j:otherwise>
<div align="right">
<form method="post" id="disable-project" action="disable">
<form method="post" id="disable-project" action="${rootURL}/${it.url}disable">
<l:hasPermission permission="${it.CONFIGURE}">
<f:submit value="${%disable(it.pronoun)}"/>
</l:hasPermission>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit cd1b9b7

Please sign in to comment.