mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 12:32:15 +00:00
refactored Matrix generation code into a tag.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3546 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
5e1fd57e63
commit
d7b53f2f1c
3 files changed
+76
-78
No files matched your search
@@ -34,6 +34,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
import java.lang.management.ManagementFactory;
|
||||
@@ -514,4 +516,8 @@ public class Functions {
|
||||
sb.append('\n');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static <T> Collection<T> emptyList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,87 +1,18 @@
|
||||
<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" xmlns:p="/lib/hudson/project">
|
||||
<d:taglib uri="local">
|
||||
<!-- display link to a MatrixConfiguration (@item) -->
|
||||
<d:tag name="itemLink">
|
||||
<a href="${item.shortUrl}">
|
||||
<img src="${rootURL}/images/16x16/${item.buildStatusUrl}" title="${item.iconColor.description}"/>
|
||||
${attrs.title}
|
||||
</a>
|
||||
</d:tag>
|
||||
</d:taglib>
|
||||
<l:layout title="${it.name}" xmlns:local="local">
|
||||
<l:layout title="${it.name}">
|
||||
<st:include page="sidepanel.jelly" />
|
||||
<l:main-panel>
|
||||
<h1>Project ${it.name}</h1>
|
||||
<t:editableDescription adminOnly="true"/>
|
||||
|
||||
<j:set var="o" value="${it.layouter}"/>
|
||||
<j:choose>
|
||||
<!-- Optimized case when there's only dimention to the axis (or zero dimension) -->
|
||||
<j:when test="${empty(o.x) and empty(o.y)}">
|
||||
<h2>Configurations</h2>
|
||||
<ul>
|
||||
<j:forEach var="c" items="${it.activeConfigurations}">
|
||||
<li>
|
||||
<j:choose>
|
||||
<j:when test="${empty(o.z)}">
|
||||
<local:itemLink item="${c}" /> <!-- zero dimension -->
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<local:itemLink item="${c}" title="${c.combination.toString(o.z)}"/> <!-- one dimension. use the value of the Z-axis -->
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</li>
|
||||
</j:forEach>
|
||||
</ul>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<h2>Configuration Matrix</h2>
|
||||
<table border="1" class="middle-align">
|
||||
<!-- X-axis -->
|
||||
<j:forEach var="x" items="${o.x}">
|
||||
<tr>
|
||||
<!-- space for Y-axis -->
|
||||
<j:if test="${!empty(o.y)}">
|
||||
<td colspan="${size(o.y)}" />
|
||||
</j:if>
|
||||
<j:forEach var="v" items="${x.values}" varStatus="loop">
|
||||
<td colspan="${o.width(loop.index)}">${v}</td>
|
||||
</j:forEach>
|
||||
</tr>
|
||||
</j:forEach>
|
||||
|
||||
<!-- Y-axis -->
|
||||
<j:forEach var="r" items="${o.rows}">
|
||||
<tr>
|
||||
<j:forEach var="y" items="${o.y}" varStatus="loop">
|
||||
<j:if test="${r.drawYHeader(loop.index)!=null}">
|
||||
<td rowspan="${o.height(loop.index)}">${r.drawYHeader(loop.index)}</td>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<j:forEach var="c" items="${r}">
|
||||
<td>
|
||||
<j:choose>
|
||||
<j:when test="${empty(o.z)}">
|
||||
<local:itemLink item="${c.get(0)}"/>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<ul>
|
||||
<j:forEach var="p" items="${c}">
|
||||
<li><local:itemLink item="${p}"/></li>
|
||||
</j:forEach>
|
||||
</ul>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</td>
|
||||
</j:forEach>
|
||||
</tr>
|
||||
</j:forEach>
|
||||
|
||||
</table>
|
||||
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
<p:matrix>
|
||||
<a href="${p.shortUrl}">
|
||||
<img src="${rootURL}/images/16x16/${p.buildStatusUrl}" title="${p.iconColor.description}"/>
|
||||
<j:if test="${empty(o.x) and empty(o.y)}">
|
||||
${p.combination.toString(o.z)}
|
||||
</j:if>
|
||||
</a>
|
||||
</p:matrix>
|
||||
|
||||
<p:projectActionFloatingBox/>
|
||||
</l:main-panel>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<!--
|
||||
Generate configuration matrix and invoke body with 'p' as the instance of T
|
||||
(of Layouter<T>)
|
||||
|
||||
Used by Matrix* classes
|
||||
-->
|
||||
<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" xmlns:p="/lib/hudson/project">
|
||||
<j:set var="o" value="${it.layouter}"/>
|
||||
<j:choose>
|
||||
<!-- Optimized case when there's only dimention to the axis (or zero dimension) -->
|
||||
<j:when test="${empty(o.x) and empty(o.y)}">
|
||||
<h2>Configurations</h2>
|
||||
<j:forEach var="p" items="${o.rows[0][0]}">
|
||||
<d:invokeBody />
|
||||
<st:nbsp />
|
||||
</j:forEach>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<h2>Configuration Matrix</h2>
|
||||
<table border="1" class="middle-align">
|
||||
<!-- X-axis -->
|
||||
<j:forEach var="x" items="${o.x}">
|
||||
<tr>
|
||||
<!-- space for Y-axis -->
|
||||
<j:if test="${!empty(o.y)}">
|
||||
<td colspan="${size(o.y)}" />
|
||||
</j:if>
|
||||
<j:forEach var="v" items="${x.values}" varStatus="loop">
|
||||
<td colspan="${o.width(loop.index)}">${v}</td>
|
||||
</j:forEach>
|
||||
</tr>
|
||||
</j:forEach>
|
||||
|
||||
<!-- Y-axis -->
|
||||
<j:forEach var="r" items="${o.rows}">
|
||||
<tr>
|
||||
<j:forEach var="y" items="${o.y}" varStatus="loop">
|
||||
<j:if test="${r.drawYHeader(loop.index)!=null}">
|
||||
<td rowspan="${o.height(loop.index)}">${r.drawYHeader(loop.index)}</td>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<j:forEach var="c" items="${r}">
|
||||
<td>
|
||||
<j:choose>
|
||||
<j:forEach var="p" items="${c}">
|
||||
<div>
|
||||
<d:invokeBody />
|
||||
</div>
|
||||
</j:forEach>
|
||||
</j:choose>
|
||||
</td>
|
||||
</j:forEach>
|
||||
</tr>
|
||||
</j:forEach>
|
||||
|
||||
</table>
|
||||
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
</j:jelly>
|
||||
Reference in new issue
Block a user