allow Configurator to define a custom documentation/schema
This commit is contained in:
parent
fd7e3c2ca4
commit
44747668d6
|
|
@ -30,6 +30,7 @@ public class HeteroDescribableConfigurator extends Configurator<Describable> {
|
|||
final List<Descriptor> candidates = Jenkins.getInstance().getDescriptorList(target);
|
||||
return candidates.stream()
|
||||
.map(d -> Configurator.lookup(d.getKlass().toJavaClass()))
|
||||
.filter(c -> c != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,37 +19,7 @@
|
|||
|
||||
<div class='sect3'>
|
||||
<j:forEach items="${it.configurators}" var="c">
|
||||
<h4 id="${c.extensionPoint.simpleName}-${c.name}">${c.name}</h4>
|
||||
<j:if test="${c.extensionPoint != c.target}">
|
||||
Implementation of <a href="https://jenkins.io/doc/developer/extensions/${c.extensionSource}/#${c.extensionPoint.simpleName.toLowerCase()}">${c.extensionPoint.simpleName}</a>
|
||||
</j:if>
|
||||
<div class='paragraph'>${c.displayName}</div>
|
||||
<div class='dlist'><dl>
|
||||
<j:forEach items="${c.attributes}" var="a">
|
||||
<dt class='hdlist1'>${a.name}</dt>
|
||||
|
||||
<dd>
|
||||
<j:out value="${c.getHtmlHelp(a.name)}"/>
|
||||
<!-- FIXME .html is not a standard facet, stapler only looks for groovy/jelly
|
||||
<st:include page="help-${a.name}.html" class="${c.target}" optional="true"/>
|
||||
-->
|
||||
</dd>
|
||||
|
||||
<j:if test="${a.multiple}">
|
||||
list of
|
||||
</j:if>
|
||||
${a.type.simpleName}
|
||||
<j:if test="${not a.possibleValues().isEmpty()}">
|
||||
<ul>
|
||||
<j:forEach items="${a.possibleValues()}" var="v">
|
||||
<li><a href="#${a.type.simpleName}-${v}">${v}</a></li>
|
||||
</j:forEach>
|
||||
</ul>
|
||||
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
</dl>
|
||||
</div>
|
||||
<st:include page="documentation.jelly" it="${c}" optional="true"/>
|
||||
</j:forEach>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,21 +16,7 @@
|
|||
},
|
||||
"definitions": {
|
||||
<j:forEach items="${it.configurators}" var="c" varStatus="cst">
|
||||
"${c.target.name}": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
<j:forEach items="${c.attributes}" var="a" varStatus="ast">
|
||||
"${a.name}": {
|
||||
<j:if test="${a.multiple}">
|
||||
"type": "array",
|
||||
"items": {
|
||||
</j:if>
|
||||
<st:include page="schema.jelly" it="${a}"/>
|
||||
<j:if test="${a.multiple}">}</j:if>
|
||||
} <j:if test="${!ast.last}">,</j:if>
|
||||
</j:forEach>
|
||||
}
|
||||
}<j:if test="${!cst.last}">,</j:if>
|
||||
<st:include page="schema.jelly" it="${c}"/><j:if test="${!cst.last}">,</j:if>
|
||||
</j:forEach>
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<?jelly escape-by-default='true'?>
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
|
||||
|
||||
<div class='section'>
|
||||
<h4 id="${it.extensionPoint.simpleName}-${it.name}">${it.name}</h4>
|
||||
<j:if test="${it.extensionPoint != c.target}">
|
||||
Implementation of <a href="https://jenkins.io/doc/developer/extensions/${it.extensionSource}/#${it.extensionPoint.simpleName.toLowerCase()}">${it.extensionPoint.simpleName}</a>
|
||||
</j:if>
|
||||
<div class='paragraph'>${it.displayName}</div>
|
||||
<div class='dlist'><dl>
|
||||
<j:forEach items="${it.attributes}" var="a">
|
||||
<dt class='hdlist1'>${a.name}</dt>
|
||||
|
||||
<dd>
|
||||
<j:out value="${it.getHtmlHelp(a.name)}"/>
|
||||
<!-- FIXME .html is not a standard facet, stapler only looks for groovy/jelly
|
||||
<st:include page="help-${a.name}.html" class="${it.target}" optional="true"/>
|
||||
-->
|
||||
</dd>
|
||||
|
||||
<j:if test="${a.multiple}">
|
||||
list of
|
||||
</j:if>
|
||||
${a.type.simpleName}
|
||||
<j:if test="${not a.possibleValues().isEmpty()}">
|
||||
<ul>
|
||||
<j:forEach items="${a.possibleValues()}" var="v">
|
||||
<li><a href="#${a.type.simpleName}-${v}">${v}</a></li>
|
||||
</j:forEach>
|
||||
</ul>
|
||||
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
</dl></div>
|
||||
</div>
|
||||
|
||||
</j:jelly>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?jelly escape-by-default='true'?>
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
|
||||
"${it.target.name}": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
<j:forEach items="${it.attributes}" var="a" varStatus="ast">
|
||||
"${a.name}": {
|
||||
<j:if test="${a.multiple}">
|
||||
"type": "array",
|
||||
"items": {
|
||||
</j:if>
|
||||
<st:include page="schema.jelly" it="${a}"/>
|
||||
<j:if test="${a.multiple}">}</j:if>
|
||||
} <j:if test="${!ast.last}">,</j:if>
|
||||
</j:forEach>
|
||||
}
|
||||
}
|
||||
</j:jelly>
|
||||
Loading…
Reference in New Issue