Jenkins 插件:Select 由模型填充
Jenkins Plugin: Select filled by model
我正在尝试使用这样的东西:
public ListBoxModel doFillGoalTypeItems() {
ListBoxModel items = new ListBoxModel();
for (BuildGoal goal : getBuildGoals()) {
items.add(goal.getDisplayName(), goal.getId());
}
return items;
}
<f:entry field="goalType" title="Choose Goal Type">
<f:select />
</f:entry
该示例在配置部分中完美运行,但在 RootAction 中使用时未填充 select。我得到的只是以下错误:
POST http://localhost:8080/jenkins/my-plugin/null 404 (Not Found)
No matching rule was found on <com.my.plugin.MyRootAction@1aa70942> for "/null"
我已经在描述符内部或外部尝试了 doFillXyzItems 方法,但似乎没有任何帮助。
有什么想法吗?
我自己试过了,得出的结论是描述符架构不适用于 rootActions。
您可以查看我废弃的项目(groovy 和 groovy 表格)以获取一些灵感(以及其他 rootActions)
在 classes 你做这样的事情
@Extension
public class DslLink extends ManagementLink implements Describable<DslLink> {
private Factory factory = new Factory();
private String dslInterface
然后在果冻里/groovy forms
<j:forEach var="cat" items="${it.factory.categoriesAsList}" >
<tr>
<td><f:readOnlyTextbox value="${cat.name}"/></td>
<td><f:readOnlyTextbox value="${cat.description}"/></td>
<td></td>
<td></td>
我认为 jelly 的语法略有不同
作为一个单独的资源,file-scm plugin 早于数据绑定 constructor/descriptor 架构,因此以与 rootActions 相同的方式填充果冻视图。
你最好也问一下 jenkins developer forum 上的人
我在 jenkins developer forum 中找到了答案。需要在选择之前设置描述符变量。所以,需要做这样的事情:
<j:set var="descriptor" value="${it.descriptor}"/>
在那之后,AJAX 调用工作并且选择将按预期填充。
我正在尝试使用这样的东西:
public ListBoxModel doFillGoalTypeItems() {
ListBoxModel items = new ListBoxModel();
for (BuildGoal goal : getBuildGoals()) {
items.add(goal.getDisplayName(), goal.getId());
}
return items;
}
<f:entry field="goalType" title="Choose Goal Type">
<f:select />
</f:entry
该示例在配置部分中完美运行,但在 RootAction 中使用时未填充 select。我得到的只是以下错误:
POST http://localhost:8080/jenkins/my-plugin/null 404 (Not Found)
No matching rule was found on <com.my.plugin.MyRootAction@1aa70942> for "/null"
我已经在描述符内部或外部尝试了 doFillXyzItems 方法,但似乎没有任何帮助。
有什么想法吗?
我自己试过了,得出的结论是描述符架构不适用于 rootActions。
您可以查看我废弃的项目(groovy 和 groovy 表格)以获取一些灵感(以及其他 rootActions)
在 classes 你做这样的事情
@Extension
public class DslLink extends ManagementLink implements Describable<DslLink> {
private Factory factory = new Factory();
private String dslInterface
然后在果冻里/groovy forms
<j:forEach var="cat" items="${it.factory.categoriesAsList}" >
<tr>
<td><f:readOnlyTextbox value="${cat.name}"/></td>
<td><f:readOnlyTextbox value="${cat.description}"/></td>
<td></td>
<td></td>
我认为 jelly 的语法略有不同
作为一个单独的资源,file-scm plugin 早于数据绑定 constructor/descriptor 架构,因此以与 rootActions 相同的方式填充果冻视图。
你最好也问一下 jenkins developer forum 上的人
我在 jenkins developer forum 中找到了答案。需要在选择之前设置描述符变量。所以,需要做这样的事情:
<j:set var="descriptor" value="${it.descriptor}"/>
在那之后,AJAX 调用工作并且选择将按预期填充。