Skip to content

Commit

Permalink
feat: support folders and filters in multijob view
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Jun 4, 2018
1 parent f9a05e7 commit edc3ca5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public FormValidation doCheckIncludeRegex(@QueryParameter String value)

@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 Down Expand Up @@ -302,11 +302,6 @@ private BuildState createBuildState(MultiJobProject project) {
: 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>

0 comments on commit edc3ca5

Please sign in to comment.