Skip to content

Commit

Permalink
[JENKINS-37174] Eliminate some of the duplicate item crunching
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergondza committed May 26, 2017
1 parent 9d1739e commit a0e46f0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
Expand Up @@ -180,8 +180,7 @@ public Item doCreateItem(StaplerRequest req, StaplerResponse rsp)

@Override
public Collection<TopLevelItem> getItems() {
SortedSet<String> names = new TreeSet<String>();
List<TopLevelItem> items = new ArrayList<TopLevelItem>(names.size());
List<TopLevelItem> items = new ArrayList<TopLevelItem>();

for (SectionedViewSection section : sections) {
items.addAll(section.getItems(getOwnerItemGroup()));
Expand Down
Expand Up @@ -25,10 +25,11 @@ THE SOFTWARE.
<j:if test="${section.name.length() > 0}">
<h2>${section.name}</h2>
</j:if>
<j:if test="${empty(section.getItems(it.ownerItemGroup))}">
<j:set var="sectionItems" value="${section.getItems(it.ownerItemGroup)}"/>
<j:if test="${empty(sectionItems)}">
<p>No jobs in this section.</p>
</j:if>
<j:forEach var="job" items="${section.getItems(it.ownerItemGroup)}">
<j:forEach var="job" items="${sectionItems}">
<div style="margin: 0px 0px 5px 10px;">
<div style="border-left: 1px #bbb solid; border-top: 1px #bbb solid; border-right: 1px #bbb solid; background-color: #eee; margin: 0; padding: 3px;"><b>${job.displayName}</b> (<a href="${job.shortUrl}">view</a>)</div>
<div style="border: 1px #bbb solid;">
Expand All @@ -41,4 +42,4 @@ THE SOFTWARE.
</div>
</div>
</j:forEach>
</j:jelly>
</j:jelly>
Expand Up @@ -25,7 +25,8 @@ THE SOFTWARE.
<j:if test="${section.name.length() > 0}">
<h2>${section.name}</h2>
</j:if>
<j:if test="${empty(section.getItems(it.ownerItemGroup))}">
<j:set var="sectionItems" value="${section.getItems(it.ownerItemGroup)}"/>
<j:if test="${empty(sectionItems)}">
<p>No jobs in this section.</p>
</j:if>

Expand All @@ -40,11 +41,10 @@ THE SOFTWARE.
<st:nbsp/>
</th>
</tr>
<j:set var="itemGroup" value="${it.ownerItemGroup}"/>
<j:forEach var="job" items="${section.getItems(itemGroup)}">
<j:forEach var="job" items="${sectionItems}">
<j:set var="relativeLinkToJob" value="${h.getRelativeLinkTo(job)}"/>
<t:projectViewRow jobBaseUrl="${relativeLinkToJob.substring(0, relativeLinkToJob.length() - job.shortUrl.length())}"/>
</j:forEach>
</table>
</div>
</j:jelly>
</j:jelly>
Expand Up @@ -25,10 +25,11 @@ THE SOFTWARE.
<j:if test="${section.name.length() > 0}">
<h2>${section.name}</h2>
</j:if>
<j:if test="${empty(section.getItems(it.ownerItemGroup))}">
<j:set var="sectionItems" value="${section.getItems(it.ownerItemGroup)}"/>
<j:if test="${empty(sectionItems)}">
<p>No jobs in this section.</p>
</j:if>
<j:forEach var="job" items="${section.getItems(it.ownerItemGroup)}">
<j:forEach var="job" items="${sectionItems}">
<div style="float: left; margin: 0px 0px 5px 10px;">
<j:set var="jobName" value="${job.displayName}"/>
<h3><a href="${job.shortUrl}">${jobName.length() > 33 ? jobName.substring(0, 15) + "..." + jobName.substring(jobName.length() - 15) : jobName}</a></h3>
Expand All @@ -37,4 +38,4 @@ THE SOFTWARE.
</j:forEach>
</div>
</j:forEach>
</j:jelly>
</j:jelly>

0 comments on commit a0e46f0

Please sign in to comment.