Commit 2d0c29ad authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#160] splitted parts

parent d3eb142c
......@@ -2,140 +2,31 @@
<html ng-app="ravada.app">
%= include 'bootstrap/header'
<body id="page-top" data-spy="scroll" data-target=".navbar-fixed-top" role="document">
<div id="wrapper">
<div id="wrapper">
%= include 'bootstrap/navigation'
<div id="page-wrapper">
<div id="page-wrapper">
<!--BASES AND DOMAINS LIST-->
<div ng-controller="singleMachinePage">
<div class="page-header">
<div class="panel panel-default">
<form action="<%= $action %>" method="post">
<div class="panel-heading">
<h2>Virtual Machine <a href="/machine/view/<%= $domain->id %>.html"><%= $domain->name %></a></h2>
<input type="submit" name="start" value="start" <%= $_start_disabled %>>
<input type="submit" name="shutdown" value="shutdown" <%= $_shutdown_disabled %>>
<%= $message %>
<br/>
<div ng-controller="singleMachinePage">
<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>
% if ($USER->is_admin()) {
<button ng-disabled ="showmachine.is_base == 0 || showmachine.has_clones > 0 || showmachine.is_locked == 1"
ng-click="action('machine','remove_base',showmachine.id)">
<%=l 'Remove base' %>
</button>
<button ng-disabled="showmachine.has_clones > 0 && showmachine.is_locked"
ng-click="action('machine','prepare',showmachine.id)">
<%=l 'Prepare base' %>
</button>
<span ng-show="{{showmachine.has_clones}} > 0">
<h4>Machine has {{showmachine.has_clones}} clones</h4>
</span>
% include 'main/vm_remove'
% }
</div>
<div class="header"> <%=l 'Status'%>:
<span ng-show="{{showmachine.is_paused && showmachine.is_active}}"
class="label label-warning">
<%=l 'Paused' %>
</span>
<span ng-show="{{!showmachine.is_paused && showmachine.is_active}}"
class="label label-success">
<%=l 'Running' %>
</span>
<span ng-show="{{!showmachine.is_active}}" class="label label-danger">
<%=l 'Down'%>
</span>
<hr>
% if ($USER->is_admin()) {
<h2><%=l 'Rename'%></h2>
<input type="text" name="new_name" ng-model="new_name"
ng-change="validate_new_name(showmachine.name)">
<button type="button"
ng-click="rename(showmachine.id, showmachine.name)">
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<div class="form-group has-error">
<label ng-show="new_name_duplicated"
class="control-label" for="new_name">
This name is duplicated
</label>
</div>
% }
</div>
<div ng-show="{{showmachine.is_locked}}">
<%=l 'Machine locked by requested' %>
<a href="/request/{{showmachine.is_locked}}.html"><%=l 'process' %></a>
</div>
% if ($USER->is_admin()) {
<hr>
<div>
<h2><%=l 'Copy'%></h2>
<form method="post" action="/machine/copy">
<input type="hidden" name="id_base" value="{{showmachine.id}}">
<label for="copy_name_{{showmachine.id}}"><%=l 'Name' %>:</label>
<input name="copy_name_{{showmachine.id}}" type="text" size="40"
value="{{showmachine.name}}-copy">
<!-- todo check unique name -->
<br/>
<label for="copy_ram">RAM (Gb):</label>
<input name="copy_ram" type="text" length="5" value="1">
<br/>
<div ng-show="0">
<label for="copy_disk"><del>Disk Size:</del></label>
<input name="copy_disk_todo" type="text"
value="{{showmachine.disk_size}}" disabled>
<br/>
</div>
<div ng-show="{{showmachine.is_base}}">
<label for="copy_rebase">Rebase First</label>
<input name="copy_rebase" type="checkbox"
ng-disabled="machine.has_clones">
Toggle to make base from latest changes.
<div ng-show="{{showmachine.has_clones}}">Remove clones to allow rebase.</div>
</div>
<br>
<input type="submit">
</form>
</div>
<hr>
</div> <!-- del panel heading-->
% if ( $USER->is_admin ) {
%= include 'main/vm_rename'
%= include 'main/vm_copy'
% }
<h2><%=l 'VM Options'%></h2>
<table><tr><td>
<label for="ram">Memory</label>
</td><td>
<input type="text" name="ram" size="5" disabled
value="<%= int($domain->get_info->{memory} / 1024) %>">
<b>MB</b> of <%= int($domain->get_info->{max_mem}/1024) %>
MB available.
</td>
% for my $driver_name (qw(network sound video)) {
% my $driver = $domain->drivers($driver_name);
<tr><td>
<label for="driver_<%= $driver_name %>"><%= $driver_name %></label>
</td>
% if (!$driver) {
<b>I can't find <%= $driver_name %> driver</b>
% next;
% }
<td>
<select name="driver_<%= $driver_name %>">
% for my $option( $driver->get_options ) {
% my $selected ='';
% $selected = 'selected' if $domain->get_driver($driver_name) eq $option->{value};
<option <%= $selected %>
value="<%= $option->{id} %>"><%= $option->{name} %></option>
% }
</select>
</td></tr>
% }
</table>
<input type="submit" value="save">
</div>
</form>
</div>
</div>
</div>
%= include 'main/vm_options'
</div><!-- del panel default-->
</div><!-- del page-header -->
</div><!-- del ng-controller -->
</div>
</div>
</div> <!-- del page-wrapper -->
</div> <!-- del wrapper -->
%= include 'bootstrap/scripts'
%= include 'bootstrap/messages'
</body>
......
<div class="panel panel-primary">
<div class="panel-heading"><b><%=l 'Copy'%></b></div>
<div class="panel-body">
<form method="post" action="/machine/copy">
<input type="hidden" name="id_base" value="{{showmachine.id}}">
<label for="copy_name_{{showmachine.id}}"><%=l 'Name' %>:</label>
<input name="copy_name_{{showmachine.id}}" type="text" size="40"
value="{{showmachine.name}}-copy">
<!-- todo check unique name -->
<br/>
<label for="copy_ram">RAM (Gb):</label>
<input name="copy_ram" type="text" length="5" value="1">
<br/>
<div ng-show="0">
<label for="copy_disk"><del>Disk Size:</del></label>
<input name="copy_disk_todo" type="text"
value="{{showmachine.disk_size}}" disabled>
<br/>
</div>
<div ng-show="{{showmachine.is_base}}">
<label for="copy_rebase">Rebase First</label>
<input name="copy_rebase" type="checkbox"
ng-disabled="machine.has_clones">
Toggle to make base from latest changes.
<div ng-show="{{showmachine.has_clones}}">Remove clones to allow rebase.</div>
</div>
<br>
<input type="submit">
</form>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading"><b><%=l 'VM Drivers'%></b></div>
<div class="panel-body">
% if ($message) {
<div class="panel panel-success">
<div class="panel-heading"><%= $message %></div>
</div>
% }
<form action="<%= $action %>" method="post">
<table>
% if ($USER->is_admin) {
<tr><td>
<label for="ram">Memory</label>
</td><td>
<input type="text" name="ram" size="5" disabled
value="<%= int($domain->get_info->{memory} / 1024) %>">
<b>MB</b> of <%= int($domain->get_info->{max_mem}/1024) %>
MB available.
</td>
</tr>
% }
% for my $driver_name (qw(network sound video)) {
% my $driver = $domain->drivers($driver_name);
<tr><td>
<label for="driver_<%= $driver_name %>"><%= $driver_name %></label>
</td>
% if (!$driver) {
<b>I can't find <%= $driver_name %> driver</b>
% next;
% }
<td>
<select name="driver_<%= $driver_name %>">
% for my $option( $driver->get_options ) {
% my $selected ='';
% $selected = 'selected' if $domain->get_driver($driver_name) eq $option->{value};
<option <%= $selected %>
value="<%= $option->{id} %>"><%= $option->{name} %></option>
% }
</select>
</td></tr>
% }
</table>
<input type="submit" value="save">
</form>
</div>
</div>
<a type="button" class="btn btn-danger"
ng-hide="showmachine.has_clones > 0 "
ng-click="domain_remove=1"
>
<%=l 'Remove' %>
</a>
<div ng-show="domain_remove">
This will remove all the contents of the machine
<i><%= $domain->name %></i>.
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 %>)"
>Yes</a>
</div><!-- del domain remove -->
% my $disable_rename = 0;
% my $message_rename;
% if ( $domain->is_active ) {
% $message_rename = 'This VM is running and can\'t be renamed.';
% $disable_rename = 1;
% }
% if ( $domain->domain->has_managed_save_image ) {
% $message_rename = 'This VM has a saved hybernated state and can\'t be renamed.';
% $disable_rename = 1;
% }
%# if $domain->is_paused || $domain->domain->has_managed_save_image;
<div class="panel panel-primary">
<div class="panel-heading"><b><%=l 'Rename'%></b></div>
<div class="panel-body">
% if ($message_rename) {
<div class="panel panel-warning">
<div class="panel-heading"><%= $message_rename %></div>
</div>
% }
<input type="text" name="new_name" ng-model="new_name"
ng-change="validate_new_name(showmachine.name)"
ng-disabled="<%= $domain->domain->has_managed_save_image %>"
>
<button type="button" ng-disabled="<%= $domain->domain->has_managed_save_image %>"
ng-click="rename(showmachine.id, showmachine.name)">
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<div class="form-group has-error">
<label ng-show="new_name_duplicated"
class="control-label" for="new_name">
This name is duplicated
</label>
</div>
</div>
</div>
<div class="header"> <%=l 'Status'%>:
<span ng-show="{{showmachine.is_paused && showmachine.is_active}}"
class="label label-warning">
<%=l 'Paused' %>
</span>
<span ng-show="{{!showmachine.is_paused && showmachine.is_active}}"
class="label label-success">
<%=l 'Running' %>
</span>
<span ng-show="{{!showmachine.is_active}}" class="label label-danger">
<%=l 'Down'%>
</span>
<hr>
<div ng-show="{{showmachine.is_locked}}">
<%=l 'Machine locked by requested' %>
<a href="/request/{{showmachine.is_locked}}.html"><%=l 'process' %></a>
</div>
</div>
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