Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-67313] do not show a link in views for multibranch or org folder jobs.
[JENKINS-72931] To not show a link in the sidepanel for matrix
subprojects (axis)
  • Loading branch information
mawinter69 authored Mar 30, 2024
1 parent 8511c59 commit e9fb2e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

import hudson.Extension;
import hudson.model.Descriptor;
import hudson.model.Job;
import hudson.model.TopLevelItem;
import hudson.views.ListViewColumn;
import hudson.views.ListViewColumnDescriptor;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;

public class ScheduleBuildButtonColumn extends ListViewColumn {

public boolean isBuildable(TopLevelItem item) {
return item instanceof Job;
}

public static final class DescriptorImpl extends ListViewColumnDescriptor {
@Override
public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hudson.Extension;
import hudson.model.Action;
import hudson.model.Job;
import hudson.model.TopLevelItem;
import java.util.Collection;
import java.util.Collections;
import jenkins.model.TransientActionFactory;
Expand All @@ -17,6 +18,10 @@ public Class<Job> type() {

@Override
public Collection<? extends Action> createFor(Job target) {
return Collections.singleton(new ScheduleBuildAction(target));
if (target instanceof TopLevelItem) {
return Collections.singleton(new ScheduleBuildAction(target));
} else {
return Collections.emptyList();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<td class="jenkins-table__cell--tight">
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}">
<j:if test="${it.isBuildable(job) and job.buildable and job.hasPermission(job.BUILD)}">
<div class="jenkins-table__cell__button-wrapper">
<j:set var="href" value="${jobBaseUrl}${job.shortUrl}schedule"/>
<a href="${href}" tooltip="${%ScheduleBuildColumn.Title}" class="jenkins-table__button">
Expand Down

0 comments on commit e9fb2e7

Please sign in to comment.