提交 dfc7cc08 编写于 作者: V vjuranek

Merge pull request #343 from vjuranek/delete_whole_matrix

Waiting for review for more then 15 days, so mering myself.
......@@ -52,6 +52,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.TreeSet;
import javax.servlet.ServletException;
/**
* Build of {@link MatrixProject}.
*
......@@ -85,6 +87,36 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
return this;
}
/**
* Deletes the build and all matrix configurations in this build when the button is pressed.
*/
public void doDoDeleteAll( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
requirePOST();
checkPermission(DELETE);
// We should not simply delete the build if it has been explicitly
// marked to be preserved, or if the build should not be deleted
// due to dependencies!
String why = getWhyKeepLog();
if (why!=null) {
sendError(hudson.model.Messages.Run_UnableToDelete(toString(),why),req,rsp);
return;
}
List<MatrixRun> runs = getRuns();
for(MatrixRun run : runs){
why = run.getWhyKeepLog();
if (why!=null) {
sendError(hudson.model.Messages.Run_UnableToDelete(toString(),why),req,rsp);
return;
}
run.delete();
}
delete();
rsp.sendRedirect2(req.getContextPath()+'/' + getParent().getUrl());
}
/**
* Used by view to render a ball for {@link MatrixRun}.
*/
......
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, id:cactusman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!-- Confirm deletion of the build/run -->
<?jelly escape-by-default='true'?>
<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">
<l:layout title="${it.fullDisplayName}" norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<j:set var="msg" value="${it.whyKeepLog}"/>
<j:if test="${msg!=null}">
<b>${%Warning}</b>: ${%cannotMsg(msg)}
</j:if>
<j:if test="${msg==null}">
<form method="post" action="doDeleteAll">
${%Are you sure about deleting the build and all configurations in this build?}
<f:submit value="${%Yes}" />
</form>
</j:if>
</l:main-panel>
</l:layout>
</j:jelly>
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Ullrich Hafner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Displays the button to delete the build.
-->
<?jelly escape-by-default='true'?>
<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">
<j:if test="${!it.keepLog and !it.building}">
<form method="get" action="confirmDelete" style="margin-top:1em">
<f:submit value="${%Delete this build}" />
</form>
<form method="get" action="confirmDeleteAll" style="margin-top:1em">
<f:submit value="${%Delete this build and all configurations in this build}" />
</form>
</j:if>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册