forked from lix-project/hydra
Make jobset deletion consistent with project deletion
This commit is contained in:
parent
d596b58991
commit
56a62c3d88
|
@ -131,6 +131,11 @@ sub submit : Chained('jobset') PathPart Args(0) {
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
requireProjectOwner($c, $c->stash->{project});
|
||||||
requirePost($c);
|
requirePost($c);
|
||||||
|
|
||||||
|
if (($c->request->params->{submit} // "") eq "delete") {
|
||||||
|
$c->stash->{jobset}->delete;
|
||||||
|
return $c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"), [$c->stash->{project}->name]));
|
||||||
|
}
|
||||||
|
|
||||||
txn_do($c->model('DB')->schema, sub {
|
txn_do($c->model('DB')->schema, sub {
|
||||||
updateJobset($c, $c->stash->{jobset});
|
updateJobset($c, $c->stash->{jobset});
|
||||||
});
|
});
|
||||||
|
@ -140,21 +145,6 @@ sub submit : Chained('jobset') PathPart Args(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub delete : Chained('jobset') PathPart Args(0) {
|
|
||||||
my ($self, $c) = @_;
|
|
||||||
|
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
|
||||||
requirePost($c);
|
|
||||||
|
|
||||||
txn_do($c->model('DB')->schema, sub {
|
|
||||||
$c->stash->{jobset}->delete;
|
|
||||||
});
|
|
||||||
|
|
||||||
$c->res->redirect($c->uri_for($c->controller('Project')->action_for("view"),
|
|
||||||
[$c->stash->{project}->name]));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub nixExprPathFromParams {
|
sub nixExprPathFromParams {
|
||||||
my ($c) = @_;
|
my ($c) = @_;
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ sub submit : Chained('project') PathPart Args(0) {
|
||||||
requireProjectOwner($c, $c->stash->{project});
|
requireProjectOwner($c, $c->stash->{project});
|
||||||
requirePost($c);
|
requirePost($c);
|
||||||
|
|
||||||
if (($c->request->params->{submit} || "") eq "delete") {
|
if (($c->request->params->{submit} // "") eq "delete") {
|
||||||
$c->stash->{project}->delete;
|
$c->stash->{project}->delete;
|
||||||
$c->res->redirect($c->uri_for("/"));
|
return $c->res->redirect($c->uri_for("/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
txn_do($c->model('DB')->schema, sub {
|
txn_do($c->model('DB')->schema, sub {
|
||||||
|
|
|
@ -109,6 +109,18 @@
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button>
|
<button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i> [%IF create %]Create[% ELSE %]Apply changes[% END %]</button>
|
||||||
|
|
||||||
|
[% IF !create %]
|
||||||
|
<button id="delete-jobset" type="submit" class="btn btn-danger" name="submit" value="delete">
|
||||||
|
<i class="icon-trash icon-white"></i>
|
||||||
|
Delete this jobset
|
||||||
|
</button>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#delete-jobset").click(function() {
|
||||||
|
return confirm("Are you sure you want to delete this jobset?");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
[% END %]
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -82,18 +82,6 @@
|
||||||
[% IF c.user_exists %]
|
[% IF c.user_exists %]
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'edit') title="Edit" %]
|
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'edit') title="Edit" %]
|
||||||
|
|
||||||
<form id="delete-jobset" method="post" action="[% c.uri_for('/jobset' project.name jobset.name 'delete') %]" class="hidden"></form>
|
|
||||||
<script>
|
|
||||||
function confirmDeleteJobset() {
|
|
||||||
bootbox.confirm(
|
|
||||||
'Are you sure you want to delete this jobset?',
|
|
||||||
function(del) { if (del) $('#delete-jobset').submit(); });
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
[% INCLUDE menuItem title="Delete" uri = "javascript:confirmDeleteJobset()" %]
|
|
||||||
|
|
||||||
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone" %]
|
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone" %]
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in a new issue