Commit 73ef559f authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#160] Hide VM settings after removing it

parent 8e35329b
......@@ -1121,22 +1121,14 @@ sub _do_remove_machine {
,uid => $USER->id
);
return $c->redirect_to('/machines');
$c->render(json => { request => $req->id});
}
sub remove_machine {
my $c = shift;
return login($c) if !_logged_in($c);
return _do_remove_machine($c,@_) if $c->param('sure') && $c->param('sure') =~ /y/i;
return $c->redirect_to('/machines') if $c->param('sure')
|| $c->param('cancel');
my $domain = _search_requested_machine($c);
return $c->render( text => "Domain not found") if !$domain;
$c->stash(domain => $domain );
return _do_remove_machine($c,@_);# if $c->param('sure') && $c->param('sure') =~ /y/i;
return $c->render( template => 'main/remove_machine' );
}
sub remove_base {
......
......@@ -11,7 +11,11 @@
<div class="page-header">
<div class="panel panel-default">
<div class="panel-heading">
<h2>Virtual Machine <a href="/machine/view/<%= $domain->id %>.html"><%= $domain->name %></a></h2>
<h2>Virtual Machine
<a ng-hide="domain_remove_done"
href="/machine/view/<%= $domain->id %>.html"><%= $domain->name %></a>
Settings
</h2>
</div> <!-- del panel heading-->
% if ( $USER->is_admin ) {
%= include 'main/vm_remove'
......
<div class="panel panel-primary">
<div class="panel panel-primary" ng-hide="domain_remove_done">
<div class="panel-heading"><b><%=l 'Copy'%></b></div>
<div class="panel-body">
......
<div class="panel panel-primary">
<div class="panel panel-primary" ng-hide="domain_remove_done">
<div class="panel-heading"><b><%=l 'VM Drivers'%></b></div>
......
......@@ -11,7 +11,7 @@
</div>
</div>
<a type="button" class="btn btn-danger"
ng-hide="showmachine.has_clones > 0 "
ng-hide="showmachine.has_clones > 0 || domain_remove_done"
ng-click="domain_remove=1"
>
<%=l 'Remove' %>
......@@ -19,14 +19,17 @@
<div ng-show="domain_remove">
This will remove all the contents of the machine
<i><%= $domain->name %></i>.
<i><%= $domain->name %></i>. <b>This action can't be undone</b>.
Are you sure ? <br/>
<a type="button" class="btn btn-danger"
ng-click="domain_remove=0"
>No</a>
<a type="button" class="btn btn-warning"
ng-click="remove(<%= $domain->id %>)"
ng-click="action('machine','remove',<%= $domain->id %>);domain_remove=0;domain_remove_done=1"
>Yes</a>
</div><!-- del domain remove -->
<div ng-show="domain_remove_done">
Virtual Machine <b>{{showmachine.name}}</b> removed.
</div>
</div>
</div>
......@@ -9,7 +9,7 @@
% $disable_rename = 1;
% }
%# if $domain->is_paused || $domain->domain->has_managed_save_image;
<div class="panel panel-primary">
<div class="panel panel-primary" ng-hide="domain_remove_done">
<div class="panel-heading"><b><%=l 'Rename'%></b></div>
<div class="panel-body">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment