提交 c46c66a0 编写于 作者: K Kohsuke Kawaguchi

fixed up the form submission mechanism

上级 8df8647e
...@@ -158,12 +158,9 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im ...@@ -158,12 +158,9 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
return sorter; return sorter;
} }
public void setSorter(MatrixConfigurationSorter sorter){ public void setSorter(MatrixConfigurationSorter sorter) throws IOException {
this.sorter = sorter; this.sorter = sorter;
} save();
public List<MatrixConfigurationSorter> getAllSorters(){
return MatrixConfigurationSorter.all();
} }
public AxisList getAxes() { public AxisList getAxes() {
...@@ -590,23 +587,9 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im ...@@ -590,23 +587,9 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
this.axes = new AxisList(newAxes.toList()); this.axes = new AxisList(newAxes.toList());
// set sorter if any sorter is chosen // set sorter if any sorter is chosen
String sorterClassName = req.getParameter("sorter"); MatrixConfigurationSorter s = req.bindJSON(MatrixConfigurationSorter.class,json.optJSONObject("sorter"));
for(MatrixConfigurationSorter s: MatrixConfigurationSorter.all()){ s.validate(this);
if(sorterClassName.equals("None")){ setSorter(s);
sorter = null;
break;
}
if(s.getClass().getName().equals(sorterClassName)){
if(s.isSortingPossible(axes)){
sorter = s;
}
else{
sorter = null;
throw new FormException(s.getErrorFormMessage(),"sorter.getDisplayName");
}
break;
}
}
runSequentially = json.has("runSequentially"); runSequentially = json.has("runSequentially");
...@@ -672,6 +655,10 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im ...@@ -672,6 +655,10 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
} }
return r; return r;
} }
public List<MatrixConfigurationSorterDescriptor> getSorterDescriptors() {
return MatrixConfigurationSorterDescriptor.all();
}
} }
private static final Logger LOGGER = Logger.getLogger(MatrixProject.class.getName()); private static final Logger LOGGER = Logger.getLogger(MatrixProject.class.getName());
......
...@@ -59,15 +59,8 @@ THE SOFTWARE. ...@@ -59,15 +59,8 @@ THE SOFTWARE.
addCaption="${%Add axis}"/> addCaption="${%Add axis}"/>
</f:block> </f:block>
<j:if test="${(it.allSorters.size() > 0)}"> <j:if test="${(descriptor.sorterDescriptors().size() > 0)}">
<f:entry title="Sort axis"> <f:dropdownDescriptorSelector title="${%Execution order of builds}" field="sorter" />
<select name="sorter">
<f:option selected="${it.sorter==null}" value="${none}">None</f:option>
<j:forEach var="inst" items="${it.allSorters}">
<f:option selected="${inst.class.isInstance(it.sorter)}" value="${inst.class.name}">${inst.displayName}</f:option>
</j:forEach>
</select>
</f:entry>
</j:if> </j:if>
<f:optionalBlock field="runSequentially" title="${%Run each configuration sequentially}"/> <f:optionalBlock field="runSequentially" title="${%Run each configuration sequentially}"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册