Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support folders and filters in multijob view #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
/**
* Checks if the include regular expression is valid.
*/
public FormValidation doCheckIncludeRegex(@QueryParameter String value)

Check warning on line 65 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / JavaDoc

JavaDoc @param

NORMAL: no @param for value

Check warning on line 65 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / JavaDoc

JavaDoc @return

NORMAL: no @return

Check warning on line 65 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / JavaDoc

JavaDoc @throws

NORMAL: no @throws for java.io.IOException

Check warning on line 65 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / JavaDoc

JavaDoc @throws

NORMAL: no @throws for javax.servlet.ServletException

Check warning on line 65 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / JavaDoc

JavaDoc @throws

NORMAL: no @throws for java.lang.InterruptedException
throws IOException, ServletException, InterruptedException {
String v = Util.fixEmpty(value);
if (v != null) {
Expand All @@ -78,7 +78,7 @@

@Override
public List<TopLevelItem> getItems() {
Collection<TopLevelItem> items = Hudson.getInstance().getItems();
Collection<? extends TopLevelItem> items = super.getItems();
List<TopLevelItem> out = new ArrayList<TopLevelItem>();
for (TopLevelItem item : items) {
if (item instanceof MultiJobProject) {
Expand All @@ -105,7 +105,7 @@
private void addMultiProject(MultiJobProject parent,
MultiJobProject project, BuildState buildState, int nestLevel,
String phaseName, List<TopLevelItem> out) {
//TODO: Nested MultiJob

Check warning on line 108 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: Nested MultiJob
out.add(new ProjectWrapper(parent, project, buildState, nestLevel, project.getLastBuild()));
List<Builder> builders = project.getBuilders();
for (Builder builder : builders) {
Expand Down Expand Up @@ -149,7 +149,7 @@
currentPhaseName, isConditional);
out.add(phaseWrapper);
for (PhaseJobsConfig projectConfig : subProjects) {
Item tli = Jenkins.getInstance().getItem(projectConfig.getJobName(), project.getParent(), AbstractProject.class);

Check warning on line 152 in src/main/java/com/tikal/jenkins/plugins/multijob/views/MultiJobView.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.views.MultiJobView.addProjectFromBuilder(MultiJobProject, BuildState, List, BuildStep, int, boolean) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
if (tli instanceof MultiJobProject) {
MultiJobProject subProject = (MultiJobProject) tli;
BuildState jobBuildState = createBuildState(buildState,
Expand Down Expand Up @@ -302,11 +302,6 @@
: lastFailedBuild.getNumber());
}

@Override
protected void submit(StaplerRequest req) throws ServletException,
FormException, IOException {
}

protected void initColumns() {
try {
Field field = ListView.class.getDeclaredField("columns");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,69 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"
xmlns:i="jelly:fmt">
<f:section title="${%Job Filters}">
<!-- set @jobBaseUrl="" so that links to jobs will be under this view. -->
<t:buildListTable builds="${it.builds}" jobBaseUrl="" />
<!-- <t:buildListTable builds="${it.builds}" jobBaseUrl="" /> -->
<f:entry title="${%Status Filter}" help="/help/view-config/statusFilter.html">
<select name="statusFilter" class="setting-input">
<f:option value="" selected="${it.statusFilter==null}">${%All selected jobs}</f:option>
<f:option value="1" selected="${it.statusFilter==true}">${%Enabled jobs only}</f:option>
<f:option value="2" selected="${it.statusFilter==false}">${%Disabled jobs only}</f:option>
</select>
</f:entry>

<f:entry title="${%Recurse in subfolders}" field="recurse">
<f:checkbox id="recurse"/>
</f:entry>

<f:entry title="${%Jobs}">
<div class="listview-jobs">
<j:forEach var="job" items="${h.getAllTopLevelItems(it.ownerItemGroup)}">
<j:set var="spanClass" value=""/>
<j:set var="spanStyle" value=""/>
<j:if test="${job.parent!=it.ownerItemGroup}">
<j:set var="spanClass" value="nested"/>
<j:set var="spanStyle" value="${it.recurse?'':'display:none'}"/>
</j:if>
<span class="${spanClass}" style="${spanStyle}">
<f:checkbox name="${job.getRelativeNameFromGroup(it.ownerItemGroup)}" checked="${it.jobNamesContains(job)}" title="${h.getRelativeDisplayNameFrom(job,it.ownerItemGroup)}" tooltip="${job.fullName}" json="true"/>
<br/>
</span>
</j:forEach>
</div>
</f:entry>

<f:optionalBlock name="useincluderegex" title="${%Use a regular expression to include jobs into the view}"
checked="${it.includeRegex != null}" help="/help/view-config/includeregex.html">
<f:entry title="${%Regular expression}">
<f:textbox name="includeRegex" field="includeRegex" />
</f:entry>
</f:optionalBlock>

<j:if test="${it.hasJobFilterExtensions()}">
<f:block>
<f:repeatableHeteroProperty field="jobFilters" hasHeader="true" addCaption="${%Add Job Filter}" />
</f:block>
</j:if>

</f:section>

<f:section title="${%Columns}">
<f:block>
<f:repeatableHeteroProperty field="columns" hasHeader="true" addCaption="${%Add column}"/>
</f:block>
</f:section>

<script>
(function() {
Behaviour.specify("#recurse", 'ListView', 0, function(e) {
var nestedElements = $$('SPAN.nested')
e.onclick = function() {
nestedElements.each(function(el) {
e.checked ? el.show() : el.hide();
});
}
});
}());
</script>
</j:jelly>
Loading