mirror of
https://github.com/retspen/webvirtcloud
synced 2026-07-04 18:45:41 +00:00
Instances overhaul
This commit is contained in:
parent
f23e6b000f
commit
47009d47ca
69 changed files with 5011 additions and 4127 deletions
114
instances/templates/instances/access_tab.html
Normal file
114
instances/templates/instances/access_tab.html
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
{% load i18n %}
|
||||
<div role="tabpanel" class="tab-pane" id="access" aria-label="Instance access options">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#vnconsole" aria-controls="vnconsole" role="tab" data-toggle="tab">
|
||||
{% trans "Console" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if app_settings.SHOW_ACCESS_ROOT_PASSWORD == 'True' %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#rootpasswd" aria-controls="rootpasswd" role="tab" data-toggle="tab">
|
||||
{% trans "Root Password" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if app_settings.SHOW_ACCESS_SSH_KEYS == 'True' %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#sshkeys" aria-controls="sshkeys" role="tab" data-toggle="tab">
|
||||
{% trans "SSH Keys" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if instance.status == 1 %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#vdiconsole" aria-controls="vdiconsole" role="tab" data-toggle="tab">
|
||||
{% trans "VDI" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="vnconsole">
|
||||
<p>{% trans "This action opens a new window with a VNC connection to the console of the instance." %}</p>
|
||||
{% if instance.status == 1 %}
|
||||
<!-- Split button -->
|
||||
<div class="btn-group float-right">
|
||||
<button type="button" id="consoleBtnGroup" class="btn btn-lg btn-success" onclick="open_console('lite')">{% trans 'Console' %}</button>
|
||||
<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">{% trans 'Toggle Dropdown' %}</span>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ instance.console_port }}" onclick="open_console('lite')">{% trans "Console" %} - {% trans "Lite" %}</a>
|
||||
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ instance.console_port }}" onclick="open_console('full')">{% trans "Console" %} - {% trans "Full" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Console" %}</button>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% if app_settings.SHOW_ACCESS_SSH_KEYS == 'True' %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="rootpasswd">
|
||||
<p>{% trans "You need shut down your instance and enter a new root password." %}</p>
|
||||
<form action="{% url 'instances:rootpasswd' instance.id %}" class="form-inline" method="post" role="form" aria-label="Add root password to instance form">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control-lg" name="passwd" placeholder="{% trans "Enter Password" %}" maxlength="24">
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.status == 5 %}
|
||||
<input type="submit" class="btn btn-lg btn-success float-right" name="rootpasswd" value="{% trans "Reset Root Password" %}">
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Reset Root Password" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if app_settings.SHOW_ACCESS_SSH_KEYS == 'True' %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="sshkeys">
|
||||
<p>{% trans "You need shut down your instance and choose your public key." %}</p>
|
||||
<form action="{% url 'instances:add_public_key' instance.id %}" class="form-inline" method="post" role="form" aria-label="Add public key to instance form">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<select name="sshkeyid" class="form-control-lg keyselect">
|
||||
{% if publickeys %}
|
||||
{% for key in publickeys %}
|
||||
<option value="{{ key.id }}">{{ key.keyname }}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option value="None">{% trans "None" %}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.status == 5 %}
|
||||
<input type="submit" class="btn btn-lg btn-success float-right" name="addpublickey" value="{% trans "Add Public Key" %}">
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Add Public Key" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if instance.status == 1 %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="vdiconsole">
|
||||
<p>{% trans "This action opens a remote viewer with a connection to the console of the instance." %}</p>
|
||||
<div class="input-group">
|
||||
<input type="text" class="input-lg disabled form-control" disabled id="vdi_url_input"/>
|
||||
<span class="input-group-append">
|
||||
<a href="#" class="btn btn-success" id="vdi_url" >{% trans "VDI" %}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
49
instances/templates/instances/destroy_instance_form.html
Normal file
49
instances/templates/instances/destroy_instance_form.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}
|
||||
{% trans "Confirm Destroy" %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block page_header %}
|
||||
{% trans "Destroy instance" %} {{ instance }}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block content %}
|
||||
{% if request.user.is_superuser or userinstance.is_delete %}
|
||||
{% if instance.status == 3 %}
|
||||
<div class="alert alert-danger">
|
||||
{% trans "Instance is suspended, cannot destroy!" %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
{% trans "This action is irreversible!" %}
|
||||
</div>
|
||||
<form action="{% url 'instances:destroy' instance.id %}" class="form" method="post" role="form" id="delete_form">
|
||||
{% csrf_token %}
|
||||
<div class="ml-3 form-row">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="delete_disk" value="true" checked id="delete_disk">
|
||||
<label class="custom-control-label font-weight-bold" for="delete_disk">{% trans "Remove Instance's data" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.nvram %}
|
||||
<div class="ml-3 form-row">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="delete_nvram" value="true" id="delete_nvram" checked>
|
||||
<label class="custom-control-label font-weight-bold" for="delete_nvram">
|
||||
{% trans "Remove Instance's NVRAM" %}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="delete">
|
||||
{% trans "Destroy" %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
{% trans "You cannot destroy instance!" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
28
instances/templates/instances/destroy_tab.html
Normal file
28
instances/templates/instances/destroy_tab.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% load i18n %}
|
||||
<div role="tabpanel" class="tab-pane" id="undefine">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance destroy menu">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="#destroy" aria-controls="destroy" role="tab" data-toggle="tab">
|
||||
{% trans "Destroy Instance" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="destroy">
|
||||
{% if request.user.is_superuser or userinstance.is_delete %}
|
||||
{% if instance.status == 3 %}
|
||||
<a class="btn btn-lg btn-success disabled float-right">{% trans "Destroy" %}</a>
|
||||
{% else %}
|
||||
<a href="{% url 'instances:destroy' instance.id %}" class="btn btn-lg btn-success float-right">{% trans "Destroy" %}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success disabled float-right" name="delete">{% trans "Destroy" %}</button>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
131
instances/templates/instances/power_tab.html
Normal file
131
instances/templates/instances/power_tab.html
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
{% load i18n %}
|
||||
<div role="tabpanel" class="tab-pane active" id="power">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance power actions">
|
||||
{% if instance.status == 1 %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#poweroff" aria-controls="poweroff" role="tab" data-toggle="tab">
|
||||
{% trans "Power Off" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#powercycle" aria-controls="powercycle" role="tab" data-toggle="tab">
|
||||
{% trans "Power Cycle" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#powerforce" aria-controls="powerforce" role="tab" data-toggle="tab">
|
||||
{% trans "Force Off" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#suspend" aria-controls="suspend" role="tab" data-toggle="tab">
|
||||
{% trans "Suspend" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if instance.status == 3 %}
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
||||
{% trans "Resume" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#powerforce" aria-controls="powerforce" role="tab" data-toggle="tab">
|
||||
{% trans "Force Off" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if instance.status == 5 %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#boot" aria-controls="boot" role="tab" data-toggle="tab">
|
||||
{% trans "Power On" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
{% if instance.status == 1 %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="poweroff">
|
||||
<p>{% trans "This action sends an ACPI shutdown signal to the instance." %}</p>
|
||||
<form action="{% url 'instances:poweroff' instance.id %}" method="post" role="form" aria-label0="Power off instance form">
|
||||
{% csrf_token %}
|
||||
<input type="submit" name="poweroff" class="btn btn-lg btn-success float-right" value="{% trans "Power Off" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="powercycle">
|
||||
<p>{% trans "This action forcibly powers off and start the instance and may cause data corruption." %}</p>
|
||||
<form action="{% url 'instances:powercycle' instance.id %}" method="post" role="form" aria-label="Power cycle instance form">{% csrf_token %}
|
||||
<input type="submit" name="powercycle" class="btn btn-lg btn-success float-right" value="{% trans "Power Cycle" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="powerforce">
|
||||
<p>{% trans "This action forcibly powers off the instance and may cause data corruption." %}</p>
|
||||
<form action="{% url 'instances:force_off' instance.id %}" method="post" role="form" aria-label="Force to shotdown instance form">
|
||||
{% csrf_token %}
|
||||
<input type="submit" name="powerforce" class="btn btn-lg btn-success float-right" value="{% trans "Force Off" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
{% if request.user.is_superuser %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="suspend">
|
||||
<p>{% trans "This action suspends the instance." %}</p>
|
||||
<form action="{% url 'instances:suspend' instance.id %}" method="post" role="form" aria-label="Suspend instance form">{% csrf_token %}
|
||||
<input type="submit" name="suspend" class="btn btn-lg btn-success float-right" value="{% trans "Suspend" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if instance.status == 3 %}
|
||||
{% if request.user.is_superuser %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
||||
<p>{% trans "This action restore the instance after suspend." %}</p>
|
||||
<form action="{% url 'instances:resume' instance.id %}" method="post" role="form" aria-label="Resume instance from suspension form">{% csrf_token %}
|
||||
<input type="submit" name="resume" class="btn btn-lg btn-success float-right" value="{% trans "Resume" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="powerforce">
|
||||
<p>{% trans "This action forcibly powers off the instance and may cause data corruption." %}</p>
|
||||
<form action="{% url 'instances:force_off' instance.id %}" method="post" role="form" aria-label="Force to shutdown form">{% csrf_token %}
|
||||
<input type="submit" name="powerforce" class="btn btn-lg btn-success float-right" value="{% trans "Force Off" %}">
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
||||
<p>{% trans "Administrator blocked your instance." %}</p>
|
||||
<form action="{% url 'instances:resume' instance.id %}" method="post" role="form" aria-label="Resume instance form">{% csrf_token %}
|
||||
<button class="btn btn-lg btn-success disabled float-right">{% trans "Resume" %}</button>
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if instance.status == 5 %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot">
|
||||
<p>{% trans "Click on Power On button to start this instance." %}</p>
|
||||
<form action="{% url 'instances:poweron' instance.id %}" method="post" role="form" aria-label="Start instance form">
|
||||
{% csrf_token %}
|
||||
{% if instance.is_template %}
|
||||
<p>{% trans "Template instance cannot be started." %}</p>
|
||||
<input type="submit" name="poweron" class="btn btn-lg btn-success float-right disabled" value="{% trans "Power On" %}">
|
||||
{% else %}
|
||||
<input type="submit" name="poweron" class="btn btn-lg btn-success float-right" value="{% trans "Power On" %}">
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
164
instances/templates/instances/resize_tab.html
Normal file
164
instances/templates/instances/resize_tab.html
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
{% load i18n %}
|
||||
<div role="tabpanel" class="tab-pane" id="resize">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance resize options">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#resizevm_cpu" aria-controls="resizevm_cpu" role="tab" data-toggle="tab">
|
||||
{% trans "CPU" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#resizevm_mem" aria-controls="resizevm_mem" role="tab" data-toggle="tab">
|
||||
{% trans "Memory" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#resizevm_disk" aria-controls="resizevm_disk" role="tab" data-toggle="tab">
|
||||
{% trans "Disk" %}
|
||||
</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resizevm_cpu">
|
||||
{% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %}
|
||||
{% if instance.status == 5 or not instance.vcpus %}
|
||||
<form action="{% url 'instances:resizevm_cpu' instance.id %}" method="post" role="form" aria-label="Resize instance cpu form">{% csrf_token %}
|
||||
<p class="font-weight-bold">{% trans "Logical host CPUs" %} : {{ vcpu_host }}</p>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label"> {% trans "Current Allocation" %}</label>
|
||||
<div class="col-sm-4">
|
||||
<select name="cur_vcpu" class="custom-select">
|
||||
{% for cpu in instance.vcpu_range %}
|
||||
{% if instance.cur_vcpu %}
|
||||
<option value="{{ cpu }}" {% if cpu == instance.cur_vcpu %}selected{% endif %}>{{ cpu }}</option>
|
||||
{% else %}
|
||||
<option value="{{ cpu }}" {% if cpu == instance.vcpu %}selected{% endif %}>{{ cpu }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">{% trans "Maximum Allocation" %}</label>
|
||||
<div class="col-sm-4">
|
||||
<select name="vcpu" class="custom-select">
|
||||
{% for cpu in instance.vcpu_range %}
|
||||
<option value="{{ cpu }}" {% if cpu == instance.vcpu %}selected{% endif %}>{{ cpu }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="resizevm_cpu">{% trans "Resize" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Resize" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
{% else %}
|
||||
<p class="font-weight-bold">{% trans "Logical Instance Active/Maximum CPUs" %} : {{ instance.cur_vcpu }} / {{ instance.vcpu }} </p>
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6">
|
||||
{% for id, vcpu in instance.vcpus.items %}
|
||||
<form action="{% url 'instances:set_vcpu' instance.id %}" method="post" role="form" aria-label="Resize instance cpu form">{% csrf_token %}
|
||||
<div class="col-sm-3">
|
||||
<input name="id" value="{{ id }}" hidden/>
|
||||
{% if vcpu.enabled == 'yes' and vcpu.hotpluggable == "yes" %}
|
||||
<button type="submit" class="btn btn-block btn-success" value="False" name="set_vcpu" title="{% trans "Disable" %}">{{ id }}</button>
|
||||
{% elif vcpu.enabled == 'yes' and vcpu.hotpluggable == "no" %}
|
||||
<button type="button" class="btn btn btn-block btn-info" title="{% trans "Constant" %}">{{ id }}</button>
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn btn-block btn-secondary" value="True" name="set_vcpu" title="{% trans "Enable" %}">{{ id }}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-sm-3"></div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% trans "You don't have permission for resizing instance" %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Resize" %}</button>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="resizevm_mem">
|
||||
{% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %}
|
||||
<form action="{% url 'instances:resize_memory' instance.id %}" method="post" role="form" aria-label="Resize instance memory form">
|
||||
{% csrf_token %}
|
||||
<p class="font-weight-bold">{% trans "Total host memory" %}: {{ memory_host|filesizeformat }}</p>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">{% trans "Current Allocation" %} ({% trans "MB" %})</label>
|
||||
<div class="col-sm-4 js-custom__container">
|
||||
<select name="cur_memory" class="custom-select js-custom__toggle">
|
||||
{% for mem in memory_range %}
|
||||
<option value="{{ mem }}" {% if mem == instance.cur_memory %}selected{% endif %}>{{ mem }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="text" name="cur_memory_custom" class="custom-select js-custom__toggle" style="display: none" />
|
||||
<small><input type="checkbox" class="js-custom__checkbox" /> {% trans "Custom value" %}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">
|
||||
{% trans "Maximum Allocation" %} ({% trans "MB" %})
|
||||
</label>
|
||||
<div class="col-sm-4 js-custom__container">
|
||||
<select name="memory" class="form-control js-custom__toggle">
|
||||
{% for mem in memory_range %}
|
||||
<option value="{{ mem }}"
|
||||
{% if mem == instance.memory %}selected{% endif %}>{{ mem }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="text" name="memory_custom" class="form-control js-custom__toggle" style="display: none" />
|
||||
<small><input type="checkbox" class="js-custom__checkbox" /> {% trans "Custom value" %}</small>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="resizevm_mem">{% trans "Resize" %}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
{% trans "You don't have permission for resizing instance" %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Resize" %}</button>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="resizevm_disk">
|
||||
{% if request.user.is_superuser or request.user.is_staff or userinstance.is_change %}
|
||||
<form action="{% url 'instances:resize_disk' instance.id %}" method="post" role="form" aria-label="Resize instance disk form">
|
||||
{% csrf_token %}
|
||||
<p class="font-weight-bold">{% trans "Disk allocation (GB)" %}:</p>
|
||||
{% for disk in instance.disks %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">{% trans "Current Allocation" %} ({{ disk.dev }})</label>
|
||||
{% if disk.storage is None %}
|
||||
<div class="col-sm-4 js-custom__container">
|
||||
<div class="alert alert-danger">
|
||||
{% trans "Error getting disk info" %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-sm-4 js-custom__container">
|
||||
<input type="number" name="disk_size_{{ disk.dev }}" class="form-control" value="{% widthratio disk.size 1073741824 1 %}" />
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="resizevm_disk">{% trans "Resize" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Resize" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% else %}
|
||||
{% trans "You don't have permission for resizing instance" %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Resize" %}</button>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
904
instances/templates/instances/settings_tab.html
Normal file
904
instances/templates/instances/settings_tab.html
Normal file
|
|
@ -0,0 +1,904 @@
|
|||
{% load i18n %}
|
||||
{% load bootstrap4 %}
|
||||
{% load icons %}
|
||||
<div role="tabpanel" class="tab-pane" id="settings">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance settings">
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item ">
|
||||
<a class="nav-link text-secondary active" href="#boot_opt" aria-controls="boot" role="tab" data-toggle="tab">
|
||||
{% trans "Boot" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#disks" aria-controls="disks" role="tab" data-toggle="tab">
|
||||
{% trans "Disk" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser or request.user.is_staff or userinstance.is_vnc %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#vncsettings" aria-controls="vncsettings" role="tab" data-toggle="tab">
|
||||
{% trans "Console" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#network" aria-controls="network" role="tab" data-toggle="tab">
|
||||
{% trans "Network" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.instances.clone_instances %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#clone" aria-controls="clone" role="tab" data-toggle="tab">
|
||||
{% trans "Clone" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#migrate" aria-controls="migrate" role="tab" data-toggle="tab">
|
||||
{% trans "Migrate" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#xmledit" aria-controls="xmledit" role="tab" data-toggle="tab">
|
||||
{% trans "XML" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if perms.instances.clone_instances %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#options" aria-controls="options" role="tab" data-toggle="tab">
|
||||
{% trans "Options" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#users" aria-controls="users" role="tab" data-toggle="tab">
|
||||
{% trans "Users" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
{% if request.user.is_superuser %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot_opt">
|
||||
<p class="font-weight-bold">{% trans 'Autostart' %}</p>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<p>{% trans "Autostart your instance when host server is power on " %}
|
||||
{% if instance.autostart == 0 %}
|
||||
<a class="btn btn-success" href="{% url 'instances:set_autostart' instance.id %}">{% trans "Enable" %}</a>
|
||||
{% else %}
|
||||
<a class="btn btn-danger" href="{% url 'instances:unset_autostart' instance.id %}">{% trans "Disable" %}</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="font-weight-bold">{% trans 'Boot Order' %}</p>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12 text-center">
|
||||
{% if instance.status == 5 %}
|
||||
<p>{% trans "Enable Boot Menu for your instance when it starts up " %}
|
||||
{% if instance.bootmenu == 0 %}
|
||||
<form action="{% url 'instances:set_bootmenu' instance.id %}" method="post" role="form" aria-label="Enable/disable instance boot order form">{% csrf_token %}
|
||||
<input type="submit" class="btn btn-success" name="set_bootmenu" title="{% trans 'Show boot menu' %}" value="{% trans "Enable" %}">
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="{% url 'instances:unset_bootmenu' instance.id %}" method="post" role="form" aria-label="Enable/disable instance boot order form">{% csrf_token %}
|
||||
<input type="submit" class="btn btn-danger" name="unset_bootmenu" title="{% trans 'Hide boot menu' %}" value="{% trans "Disable" %}">
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if instance.bootmenu == 0 %}
|
||||
<p>**** {% trans "Please shutdown instance to modify boot menu" %} ****</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if instance.bootmenu == 1 %}
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="col-sm-6 bg-light rounded shadow-sm">
|
||||
{% for idx, val in instance.boot_order.items %}
|
||||
<label>{{ idx|add:1 }}:{{ val.target }}, </label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<form action="{% url 'instances:set_bootorder' instance.id %}" method="post" role="form" aria-label="Boot order edit form">{% csrf_token %}
|
||||
<input id="bootorder" name="bootorder" hidden>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div id="b_order" class="multipleselect border-0">
|
||||
{% for disk in instance.disks %}
|
||||
<label><input type="checkbox" name="disk:{{ disk.dev }}" value="disk:{{ disk.dev }}" onclick="set_orderlist($('#bootorder'))" />{{ disk.dev }} - {{ disk.image }}</label>
|
||||
{% endfor %}
|
||||
{% for cd in instance.media %}
|
||||
<label><input type="checkbox" name="cdrom:{{ cd.dev }}" value="cdrom:{{ cd.dev }}" onclick="set_orderlist($('#bootorder'))"/>{{ cd.dev }} - {{ cd.image }}</label>
|
||||
{% endfor %}
|
||||
{% for net in instance.networks %}
|
||||
<label><input type="checkbox" name="network:{{ net.mac }}" value="network:{{ net.mac }}" onclick="set_orderlist($('#bootorder'))"/>NIC - {{ net.mac|slice:"9:" }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
<div class="row mt-4">
|
||||
<a href="#" id="boot_order_up" class="btn btn-light shadow-sm"><span class="fa fa-arrow-up" title="{% trans 'up: move selected devices' %}"></span></a>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<a href="#" id="boot_order_down" class="btn btn-light shadow-sm"><span class="fa fa-arrow-down" title="{% trans 'down: move selected devices' %}"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="col-sm-6">
|
||||
<input type="submit" class="btn btn-success btn-block" name="set_bootorder" value="{% trans "Apply" %}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="disks">
|
||||
<form action="{% url 'instances:add_cdrom' instance.id %}" method="post" role="form" aria-label="Add CD-ROM form">{% csrf_token %}
|
||||
<p class="font-weight-bold">
|
||||
{% trans "Instance Media" %}
|
||||
<button class="btn btn-success float-right"
|
||||
type="submit" type="button"
|
||||
title="{% trans 'Add CD-ROM' %}"
|
||||
{% if instance.status != 5 %} disabled {% endif %}>
|
||||
<span class="fa fa-plus"></span>
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
{% for cd in instance.media %}
|
||||
<div class="row mt-2">
|
||||
<a class="col-sm-3 col-form-label"
|
||||
name="details"
|
||||
title="{% trans "Details" %}"
|
||||
tabindex="0"
|
||||
data-trigger="focus"
|
||||
data-toggle="popover"
|
||||
data-html="true"
|
||||
data-content="<strong>{% trans 'Bus' %}:</strong> {{ cd.bus }} <br/>
|
||||
<strong>{% trans 'Device' %}:</strong> {{ cd.dev }}">
|
||||
{% trans "CD-ROM" %} {{ forloop.counter }}
|
||||
</a>
|
||||
<div class="col-sm-9">
|
||||
{% if not cd.image %}
|
||||
<form action="{% url 'instances:mount_iso' instance.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="input-group">
|
||||
<select name="media" class="form-control">
|
||||
{% if instance.media_iso %}
|
||||
{% for iso in instance.media_iso %}
|
||||
<option value="{{ iso }}">{{ iso }}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option value="none">{% trans "None" %}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
{% if instance.media_iso and allow_admin_or_not_template %}
|
||||
<button type="submit" class="btn btn-sm btn-success float-left" name="mount_iso" value="{{ cd.dev }}">{% trans "Mount" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-sm btn-success float-left disabled">{% trans "Mount" %}</button>
|
||||
{% endif %}
|
||||
{% if instance.status == 5 and allow_admin_or_not_template %}
|
||||
<a href="{% url 'instances:detach_cdrom' instance.id cd.dev %}" class="btn btn-sm btn-danger float-right" title="{% trans "Detach CD-ROM (remove device)" %}">
|
||||
{% icon 'remove' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="{% url 'instances:unmount_iso' instance.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" value="{{ cd.image }}" disabled/>
|
||||
<div class="input-group-append">
|
||||
<input type="hidden" name="path" value="{{ cd.path }}">
|
||||
{% if allow_admin_or_not_template %}
|
||||
<button type="submit" class="btn btn-sm btn-success float-left" value="{{ cd.dev }}" name="umount_iso">{% trans "Unmount" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-sm btn-success float-left disabled" value="{{ cd.dev }}" name="umount_iso">{% trans "Unmount" %}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="offset-3 col-sm-6">
|
||||
<div class="bg-light rounded shadow-sm">{% trans 'There is not any CD-ROM device.' %}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="clearfix"></div>
|
||||
<p class="font-weight-bold">
|
||||
{% trans "Instance Volume" %}
|
||||
{% include 'add_instance_volume.html' %}
|
||||
</p>
|
||||
|
||||
<div class="col-12 col-sm-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{% trans "Device" %}</th>
|
||||
<th scope="col">{% trans "Used" %}</th>
|
||||
<th scope="col">{% trans "Capacity" %}</th>
|
||||
<th scope="col">{% trans "Storage" %}</th>
|
||||
<th scope="col">{% trans "Source" %}</th>
|
||||
<th scope="col">{% trans "Action" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for disk in instance.disks %}
|
||||
<tr>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-sm btn-secondary"
|
||||
name="details{{ forloop.counter0 }}"
|
||||
title="{% trans "Details" %}"
|
||||
tabindex="0"
|
||||
data-trigger="focus"
|
||||
data-toggle="popover"
|
||||
data-html="true"
|
||||
data-content="<strong>Bus:</strong> {{ disk.bus }} <br/>
|
||||
<strong>Format:</strong> {{ disk.format }} <br/>
|
||||
<strong>Cache:</strong> {{ disk.cache }} <br/>
|
||||
<strong>Serial:</strong> {{ disk.serial }} <br/>
|
||||
<strong>Readonly:</strong> {{ disk.readonly }} <br/>
|
||||
<strong>Shareable:</strong> {{ disk.shareable }}</br>
|
||||
<strong>IO Mode:</strong> {{ disk.io }} <br/>
|
||||
<strong>Discard:</strong> {{ disk.discard }} <br/>
|
||||
<strong>Detect Zeroes:</strong> {{ disk.detect_zeroes }}">
|
||||
<i class="fa fa-info"></i>
|
||||
</button>
|
||||
{{ disk.dev }}
|
||||
</td>
|
||||
{% if disk.storage is None %}
|
||||
<td colspan="4">
|
||||
<div class="alert alert-danger">
|
||||
{% trans "Error getting disk info" %}
|
||||
</div>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>{{ disk.used | filesizeformat}}</td>
|
||||
<td>{{ disk.size | filesizeformat }}</td>
|
||||
<td>{{ disk.storage }}</td>
|
||||
<td>{{ disk.path }}</td>
|
||||
{% endif %}
|
||||
<td class="text-nowrap">
|
||||
<form class="d-inline" action="{% url 'instances:edit_volume' instance.id %}" method="post" role="form" aria-label="Edit instance volume form">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="path" value="{{ disk.path }}">
|
||||
<input type="hidden" name="dev" value="{{ disk.dev }}">
|
||||
<input type="hidden" name="storage" value="{{ disk.storage }}">
|
||||
<input type="hidden" name="name" value="{{ disk.image }}">
|
||||
{% include 'edit_instance_volume.html' with id=forloop.counter0 %}
|
||||
</form>
|
||||
<form class="d-inline" action="{% url 'instances:detach_vol' instance.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="path" value="{{ disk.path }}">
|
||||
<input type="hidden" name="dev" value="{{ disk.dev }}">
|
||||
<input type="hidden" name="storage" value="{{ disk.storage }}">
|
||||
<input type="hidden" name="name" value="{{ disk.image }}">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-sm btn-secondary" value="{{ disk.dev }}" title="{% trans "Detach" %}" onclick="return confirm('{% trans "Are you sure to detach volume?" %}')">
|
||||
{% icon 'eject' %}
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="btn btn-sm btn-secondary disabled" value="{{ disk.dev }}" title="{% trans "Detach" %}" onclick="return confirm('{% trans "Are you sure? This may lead data corruption!" %}')">
|
||||
{% icon 'eject' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<form class="d-inline" action="{% url 'instances:delete_vol' instance.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="path" value="{{ disk.path }}">
|
||||
<input type="hidden" name="dev" value="{{ disk.dev }}">
|
||||
<input type="hidden" name="storage" value="{{ disk.storage }}">
|
||||
<input type="hidden" name="name" value="{{ disk.image }}">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure to delete volume?" %}')">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure? This may lead data corruption!" %}')">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="network">
|
||||
<p>
|
||||
{% trans "Add a network device" %}
|
||||
{% include 'add_instance_network_block.html' %}
|
||||
</p>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-lg-12 mt-3">
|
||||
<h5 class="font-weight-bold">{% trans "Network Devices" %}</h5>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{% trans 'Name' %}</th>
|
||||
<th scope="col" class="d-none d-table-cell d-sm-table-cell" colspan="6">{% trans 'Info' %}</th>
|
||||
<th scope="colgroup" class="d-none" colspan="2">{% trans 'Info' %}</th>
|
||||
<th scope="colgroup" colspan="2">{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for network in instance.networks %}
|
||||
<tr>
|
||||
<td rowspan="2">eth{{ forloop.counter0 }}({{ network.target|default:"no target" }})
|
||||
<form action="{% url 'instances:set_link_state' instance.id %}" method="post" aria-label="set instance link state form">
|
||||
{% csrf_token %}
|
||||
<input name="mac" value="{{ network.mac }}" hidden/>
|
||||
<input name="set_link_state" value="{{ network.state }}" hidden/>
|
||||
<input type="checkbox" {% if network.state == 'up' %} checked{% endif %} onclick='submit();' />
|
||||
<strong>{% trans 'active' %}</strong>
|
||||
</form>
|
||||
</td>
|
||||
<th class="d-none d-table-cell d-sm-table-cell">{% trans 'MAC' %}</th>
|
||||
<td>{{ network.mac }}</td>
|
||||
<th scope="row" class="d-none d-table-cell d-sm-table-cell">{% trans 'Filter' %}</th>
|
||||
<td class="d-none d-table-cell">{{ network.filterref|default:"None" }}</td>
|
||||
<th scope="row" class="d-none d-table-cell d-sm-table-cell">{% trans 'Source' %}</th>
|
||||
<td>{{ network.nic }}</td>
|
||||
<td>
|
||||
<form action="{% url 'instances:change_network' instance.id %}" method="post" name="edit_network{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<button data-target="#editInstanceNetwork{{ forloop.counter0 }}" type="button" class="btn btn-sm btn-primary"
|
||||
title="{% trans "Edit NIC" %}" data-toggle="modal">
|
||||
<span class="fa fa-edit" aria-hidden="true"></span>
|
||||
</button>
|
||||
|
||||
<div class="modal fade" id="editInstanceNetwork{{ forloop.counter0 }}" role="dialog" aria-labelledby="editInstanceNetworkLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{% trans "Edit Instance Network" %}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="container">
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label">{% trans "MAC" %}</label>
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="{{ network.mac }}" readonly/>
|
||||
<input class="form-control" type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label">{% trans "Net Source" %}</label>
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="{{ network.nic }}" readonly/>
|
||||
<select class="form-control" name="net-source-{{ forloop.counter0 }}">
|
||||
{% for c_net in networks_host %}
|
||||
<option value="net:{{ c_net }}" {% if c_net == network.nic %} selected {% endif %}>{% trans 'Network' %} {{ c_net }}</option>
|
||||
{% endfor %}
|
||||
{% for c_iface in interfaces_host %}
|
||||
<option value="iface:{{ c_iface }}" {% if c_iface == network.nic %} selected {% endif %}>{% trans 'Interface' %} {{ c_iface }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label">{% trans "NWFilter" %}</label>
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="{{ network.filterref }}" readonly/>
|
||||
<select class="form-control" name="net-nwfilter-{{ forloop.counter0 }}">
|
||||
<option value="">{% trans "None" %}</option>
|
||||
{% for c_filters in nwfilters_host %}
|
||||
<option value="{{ c_filters }}" {% if c_filters == network.filterref %} selected {% endif %}>{{ c_filters }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label">{% trans "Model" %} </label>
|
||||
<div class="input-group">
|
||||
<input class="form-control" type="text" value="{{ network.model }}" readonly/>
|
||||
<select class="form-control" name="net-model-{{ forloop.counter0 }}">
|
||||
{% for model in net_models_host %}
|
||||
<option value="{{ model }}" {% if model == network.model %} selected {% endif %}>{{ model }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" data-dismiss="modal">{% trans 'Close' %}</button>
|
||||
<button class="btn btn-success" name="change_network" title="{% trans "Apply network changes" %}">{% trans "Apply" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td align="right">
|
||||
<form action="{% url 'instances:delete_network' instance.id %}" method="post" name="delete_network" role="form">{% csrf_token %}
|
||||
<button class="btn btn-sm btn-danger" value="{{ network.mac }}" name="delete_network" title="{% trans "Delete Device" %}"
|
||||
onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans 'IPv4' %}</th>
|
||||
<td>
|
||||
{% for ipv4 in network.ipv4|default:"unknown" %}{{ ipv4 }}{% endfor %}
|
||||
</td>
|
||||
<th scope="row">{% trans 'IPv6' %}</th>
|
||||
<td>
|
||||
{% for ipv6 in network.ipv6|default:"unknown" %}{{ ipv6 }}{% endfor %}
|
||||
</td>
|
||||
<th scope="row">{% trans 'Model' %}</th>
|
||||
<td>{{ network.model }}</td>
|
||||
<th>{% trans 'QoS' %}</th>
|
||||
<td class="d-flex justify-content-end">
|
||||
<form action="{% url 'instances:set_qos' instance.id %}" method="post" name="add_qos{{ forloop.counter0 }}" role="form" aria-label="Add network qos form">
|
||||
{% csrf_token %}
|
||||
<input type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}" hidden/>
|
||||
{% include 'add_network_qos.html' with id=forloop.counter0 %}
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="bg-primary" colspan="9"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if instance.qos %}
|
||||
<div class="row mt-3">
|
||||
<div class="col-sm-10">
|
||||
<p><strong>{% trans "QoS Configuration" %}</strong></p>
|
||||
</div>
|
||||
<div class="col-12 col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr class="d-flex">
|
||||
<th scope="col" class="col-2">{% trans "MAC" %}/{% trans "Direction" %}</th>
|
||||
<th scope="col" class="col-2">{% trans "Average" %}</th>
|
||||
<th scope="col" class="col-3">{% trans "Peak" %}</th>
|
||||
<th scope="col" class="col-3">{% trans "Burst" %}</th>
|
||||
<th scope="col" class="col-2">{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for q, attrs in instance.qos.items %}
|
||||
{% for att in attrs %}
|
||||
<tr class="d-flex">
|
||||
<form action="{% url 'instances:set_qos' instance.id %}" method="post" role="form" aria-label="Instance QoS configuration form">
|
||||
{% csrf_token %}
|
||||
<td class="col-2"><label class="col-form-label">{{ q }} {{ att.direction | capfirst }}</label></td>
|
||||
<td class="col-2"><input id="qos_average" class="form-control" name="qos_average"
|
||||
value="{{ att.average|default:'' }}"/>
|
||||
</td>
|
||||
<td class="col-3"><input id="qos_peak" class="form-control" name="qos_peak"
|
||||
value="{{ att.peak|default:'' }}"/>
|
||||
</td>
|
||||
<td class="col-3"><input id="qos_burst" class="form-control" name="qos_burst"
|
||||
value="{{ att.burst|default:'' }}"/>
|
||||
</td>
|
||||
<td class="col-sm-2">
|
||||
<input name="qos_direction" value="{{ att.direction }}" hidden/>
|
||||
<input name="net-mac" value="{{ q }}" hidden/>
|
||||
<button type="submit" class="btn btn-sm btn-primary"
|
||||
name="set_qos" data-toggle="modal"
|
||||
title="{% trans "Edit QoS" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
<i class="fa fa-save"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form action="{% url 'instances:unset_qos' instance.id %}" method="post" role="form" aria-label="Instance QoS configuration form">
|
||||
{% csrf_token %}
|
||||
<input name="qos_direction" value="{{ att.direction }}" hidden/>
|
||||
<input name="net-mac" value="{{ q }}" hidden/>
|
||||
<button type="submit" class="btn btn-sm btn-danger"
|
||||
name="unset_qos"
|
||||
title="{% trans "Delete QoS" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="migrate">
|
||||
<p>{% trans "For migration both host servers must have equal settings and OS type" %}</p>
|
||||
<form action="{% url 'instances:migrate' instance.id %}" class="ml-3 form" method="post" role="form" aria-label="Migrate instance form">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Original host" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<label class="form-control" readonly="readonly">{{ compute.name }}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Host migration" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select name="compute_id" class="custom-select">
|
||||
{% if computes_count != 1 %}
|
||||
{% for comp in computes %}
|
||||
{% if comp.id != compute.id %}
|
||||
<option value="{{ comp.id }}">{{ comp.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="live_migrate" value="true" id="vm_live_migrate" {% if instance.status != 5 %}checked{% else %}disabled{% endif %}>
|
||||
<label class="custom-control-label" for="vm_live_migrate">{% trans "Live migration" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="unsafe_migrate" value="true" id="vm_unsafe_migrate">
|
||||
<label class="custom-control-label" for="vm_unsafe_migrate">{% trans "Unsafe migration" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="xml_delete" value="true" id="xml_delete" checked>
|
||||
<label class="custom-control-label" for="xml_delete">{% trans "Delete original" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="offline_migrate" value="true" id="offline_migrate" {% if instance.status == 5 %}checked{% else %}disabled{% endif %}>
|
||||
<label class="custom-control-label" for="offline_migrate">{% trans "Offline migration" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="postcopy" value="true" id="postcopy" {% if instance.status != 1 %}disabled{% endif %}>
|
||||
<label class="custom-control-label" for="postcopy">{% trans "Post copy" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="autoconverge" value="true" id="autoconverge" {% if instance.status != 1 %}disabled{% endif %}>
|
||||
<label class="custom-control-label" for="autoconverge" title="{% trans 'Forces CPU convergence during live migration' %}">{% trans "Auto converge" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6 offset-3">
|
||||
<div class="custom-control custom-switch">
|
||||
<input class="custom-control-input" type="checkbox" name="compress" value="true" id="compress" {% if instance.status != 1 %}disabled{% endif %}>
|
||||
<label class="custom-control-label" for="compress" title="{% trans 'Compress instance memory for fast migration' %}">{% trans "Compressed" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if computes_count != 1 %}
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="migrate" onclick="showPleaseWaitDialog();">{% trans "Migrate" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Migrate" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="xmledit">
|
||||
<p>{% trans "If you need to edit XML please Power Off the instance" %}</p>
|
||||
<form action="{% url 'instances:change_xml' instance.id %}" method="post" role="form" aria-label="Edit instance XML form">
|
||||
{% csrf_token %}
|
||||
<div class="col-sm-12" id="xmlheight">
|
||||
<textarea id="editor">{{ instance.inst_xml }}</textarea>
|
||||
</div>
|
||||
{% if instance.status == 5 %}
|
||||
<input type="hidden" name="inst_xml">
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="change_xml">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">
|
||||
{% trans "Change" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="users">
|
||||
<div>
|
||||
<p class="font-weight-bold">
|
||||
{% trans "Instance owners" %}
|
||||
{% include 'add_instance_owner_block.html' %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped sortable-theme-bootstrap mt-3" data-sortable>
|
||||
<tbody class="searchable">
|
||||
{% for userinstance in userinstances %}
|
||||
<tr>
|
||||
<td><a href="{% url 'account' userinstance.user.id %}">{{ userinstance.user }}</a></td>
|
||||
<td style="width:30px;">
|
||||
<a href="{% url 'user_instance_delete' userinstance.id %}?next={% url 'instances:instance' instance.id %}#users">
|
||||
{% icon 'trash' %}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser or request.user.is_staff or userinstance.is_vnc %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="vncsettings">
|
||||
<form method="post" action="{% url 'instances:update_console' instance.id %}">
|
||||
{% csrf_token %}
|
||||
{% if instance.status != 5 %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "To change console settings, shutdown the instance." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% bootstrap_form console_form layout='horizontal' %}
|
||||
<div class="float-right">
|
||||
{% if instance.status != 5 %}
|
||||
<button class="btn btn-success" name="set_console_type" disabled>{% trans "Update" %}</button>
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn-success ">{% trans "Update" %}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if perms.instances.clone_instances %}
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="clone">
|
||||
<p class="font-weight-bold">{% trans "Create a clone" %}</p>
|
||||
<form class="form" action="{% url 'instances:clone' instance.id %}" method="post" role="form" aria-label="Create clone form">{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label font-weight-normal">{% trans "Clone Name" %}</label>
|
||||
{% if request.user.is_superuser %}
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input id="clone_name" type="text" class="form-control" name="name" value="{{ instance.name }}-clone"/>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-success" name="guess-clone-name"
|
||||
onclick="guess_clone_name()">{% trans "Guess" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% elif app_settings.CLONE_INSTANCE_AUTO_NAME == 'True'%}
|
||||
<div class="col-sm-4">
|
||||
<input id="clone_instance_auto_name" type="text" class="form-control" name="auto_name" value="Automatic" disabled/>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-sm-4">
|
||||
<select id="select_clone_name" class="form-control" name="name" size="1">
|
||||
{% for name in clone_free_names %}
|
||||
<option value="{{ name }}">{{ name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if request.user.is_superuser %}
|
||||
<label>{% trans "Network devices" %}:</label>
|
||||
{% for network in instance.networks %}
|
||||
<p>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label offset-1">eth{{ forloop.counter0 }} ({{ network.nic }})</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="clone-net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-success" name="random-mac-{{ forloop.counter0 }}"
|
||||
onclick="random_mac('clone-net-mac-{{ forloop.counter0 }}')">{% trans "Random" %}</button>
|
||||
<button type="button" class="btn btn-success" name="guess-mac-{{ forloop.counter0 }}"
|
||||
onclick="guess_mac_address('#clone_name', {{ forloop.counter0 }})">{% trans "Guess" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for network in instance.networks %}
|
||||
<input type="hidden" class="form-control" name="clone-net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<label>{% trans "Storage devices" %}:</label>
|
||||
{% for disk in instance.disks %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label offset-1">{{ disk.dev }} ({{ disk.storage }})</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<input id="disk_name-{{ disk.dev }}" type="text" class="form-control" name="disk-{{ disk.dev }}" value="{{ disk.image }}"/>
|
||||
{% if disk.format == 'qcow2' %}
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text" >{% trans 'Metadata' %}</span>
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="meta-{{ disk.dev }}" value="true">
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for disk in instance.disks %}
|
||||
<input id="disk_name-{{ disk.dev }}" type="hidden" class="form-control" name="disk-{{ disk.dev }}" value="{{ disk.image }}"/>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Title" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="clone-title" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Description" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<textarea name="clone-description" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-lg btn-success float-right" name="clone" onclick="showPleaseWaitDialog();">{% trans "Clone" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled" name="clone">{% trans "Clone" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="options">
|
||||
<p>{% trans "To set instance template name description, shutdown the instance." %}</p>
|
||||
<form action="{% url 'instances:change_options' instance.id %}" method="post" role="form" aria-label="Set instance template name description form">{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Title" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="title" class="form-control" value="{{ instance.title }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Description" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<textarea name="description" class="form-control">{{ instance.description }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">{% trans "Is template" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox"
|
||||
name="is_template"
|
||||
value="True"
|
||||
id="is_template"
|
||||
{% if instance.is_template %}checked{% endif %}
|
||||
{% if not request.user.is_superuser and not request.user.is_staff %}disabled{% endif %}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="offset-3 col-sm-6">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-block btn-success" name="change_options">{% trans "Change" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-block btn-success disabled" name="change_options">{% trans "Change" %}</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="font-weight-bold">{% trans "To set instance video model, shutdown the instance." %}</p>
|
||||
<form action="{% url 'instances:set_video_model' instance.id %}" method="post" role="form" aria-label="Set instance video model form">{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label for="video_model_select" class="col-sm-3 col-form-label">{% trans "Primary Video Model" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<select id="video_model_select" class="custom-select" name="video_model">
|
||||
<option class="font-weight-bold" value="">{% trans "please choose" %}</option>
|
||||
{% for vmodel in instance.video_models %}
|
||||
<option value="{{ vmodel }}"{% if vmodel == instance.video_model %} selected{% endif %}>{{ vmodel }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-success" name="set_video_model">{% trans "Set" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-success disabled" name="set_video_model">{% trans "Set" %}</button>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="font-weight-bold">{% trans "To set instance vCPUs hotpluggable" %}</p>
|
||||
<form action="{% url 'instances:set_vcpu_hotplug' instance.id %}" method="post" role="form" aria-label="Set instance vCPUs hotpluggable form">{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label for="vcpu_hotplug" class="col-sm-3 col-form-label">{% trans "vCPU Hot Plug" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<select id="vcpu_hotplug" class="form-control" name="vcpu_hotplug">
|
||||
<option value="True" {% if instance.vcpus %} selected {% endif %}>{% trans 'Enabled' %}</option>
|
||||
<option value="False" {% if not instance.vcpus %} selected {% endif %}>{% trans 'Disabled' %}</option>
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-success" name="set_vcpu_hotplug">{% trans "Set" %}</button>
|
||||
{% else %}
|
||||
<button class="btn btn-success" name="set_vcpu_hotplug" disabled>{% trans "Set" %}</button>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p class="font-weight-bold">{% trans "To Enable/Disable Qemu Guest Agent. Status" %}:
|
||||
{% if instance.status == 1 %}
|
||||
{% if instance.guest_agent_ready %}
|
||||
<label class="badge badge-success">{% trans 'Connected' %}</label>
|
||||
{% else %}
|
||||
<label class="badge badge-danger">{% trans 'Disconnected' %}</label>
|
||||
{% endif %}</p>
|
||||
{% else %}
|
||||
<label class="badge badge-default">{% trans 'Unknown' %}</label>
|
||||
{% endif %}
|
||||
<form action="{% url 'instances:set_guest_agent' instance.id %}" method="post" role="form" aria-label="Enable/Disable Qemu Guest Agent form">{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<label for="guest_agent" class="col-sm-3 col-form-label">{% trans "Qemu Guest Agent" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group">
|
||||
<select id="guest_agent" class="custom-select" name="guest_agent">
|
||||
<option value="True" {% if instance.guest_agent %} selected {% endif %}>{% trans 'Enabled' %}</option>
|
||||
<option value="False" {% if not instance.guest_agent %} selected {% endif %}>{% trans 'Disabled' %}</option>
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-success" name="set_guest_agent">{% trans "Set" %}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
91
instances/templates/instances/snapshots_tab.html
Normal file
91
instances/templates/instances/snapshots_tab.html
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
{% load i18n %}
|
||||
{% load icons %}
|
||||
<div role="tabpanel" class="tab-pane" id="snapshots">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance snapshot menu">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#takesnapshot" aria-controls="takesnapshot" role="tab" data-toggle="tab">
|
||||
{% trans "Take Snapshot" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#managesnapshot" aria-controls="managesnapshot" role="tab" data-toggle="tab">
|
||||
{% trans "Manage Snapshots" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="takesnapshot">
|
||||
{% if instance.status == 5 %}
|
||||
<p>{% trans "This may take more than an hour, depending on how much content is on your droplet and how large the disk is." %}</p>
|
||||
<form action="{% url 'instances:snapshot' instance.id %}" class="form-inline" method="post" role="form" aria-label="Create snapshot form">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-12">
|
||||
<input type="text" class="form-control form-control-lg" name="name" placeholder="{% trans "Enter Snapshot Name" %}" maxlength="14">
|
||||
</div>
|
||||
</div>
|
||||
{% if instance.status == 5 %}
|
||||
<input type="submit" class="btn btn-lg btn-success float-right" name="snapshot" value="{% trans "Take Snapshot" %}">
|
||||
{% else %}
|
||||
<button class="btn btn-lg btn-success float-right disabled">{% trans "Take Snapshot" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
<div class="clearfix"></div>
|
||||
{% else %}
|
||||
<p>{% trans "To take a snapshot please Power Off the instance." %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="managesnapshot">
|
||||
{% if instance.snapshots %}
|
||||
<p>{% trans "Choose a snapshot for restore/delete" %}</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th scope="col">{% trans "Name" %}</th>
|
||||
<th scope="col">{% trans "Date" %}</th>
|
||||
<th scope="colgroup" colspan="2">{% trans "Action" %}</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for snap in instance.snapshots %}
|
||||
<tr>
|
||||
<td><strong>{{ snap.name }}</strong></td>
|
||||
<td>{{ snap.date|date:"M d H:i:s" }}</td>
|
||||
<td style="width:30px;">
|
||||
<form action="{% url 'instances:revert_snapshot' instance.id %}" method="post" role="form" aria-label="Restore snapshot form">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="name" value="{{ snap.name }}">
|
||||
{% if instance.status == 5 %}
|
||||
<button type="submit" class="btn btn-sm btn-secondary" name="revert_snapshot" title="{% trans 'Revert to this Snapshot' %}" onclick="return confirm('Are you sure?')">
|
||||
<span class="fa fa-download"></span>
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-sm btn-secondary disabled"
|
||||
title="{% trans "To restore snapshots you need Power Off the instance." %}">
|
||||
<span class="fa fa-download"></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</td>
|
||||
<td style="width:30px;">
|
||||
<form action="{% url 'instances:delete_snapshot' instance.id %}" method="post" role="form" aria-label="Delete snapshot form">{% csrf_token %}
|
||||
<input type="hidden" name="name" value="{{ snap.name }}">
|
||||
<button type="submit" class="btn btn-sm btn-danger" title="{% trans 'Delete Snapshot' %}" onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
{% icon 'trash' %}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>{% trans "You do not have any snapshots" %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
116
instances/templates/instances/stats_tab.html
Normal file
116
instances/templates/instances/stats_tab.html
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
{% load i18n %}
|
||||
<div role="tabpanel" class="tab-pane" id="graphics">
|
||||
<div role="tabpanel">
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist" aria-label="Instance graphs and logs menu">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary active" href="#graphs" id="graphtab" aria-controls="graphs" role="tab" data-toggle="tab" aria-controls="graphs" aria-selected="true">
|
||||
{% trans "Real Time" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-secondary" href="#logs" id="logtab" aria-controls="logs" role="tab" data-toggle="tab" aria-controls="logs" onclick='update_logs_table("{{ instance.name }}");'>
|
||||
{% trans "Logs" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="graphs">
|
||||
<div class="mb-1 card border-success">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-long-arrow-right"></i>
|
||||
{% trans "CPU Usage" %}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flot-chart">
|
||||
<div class="flot-chart-content" id="flot-moving-line-chart">
|
||||
<canvas id="cpuChart" width="735" height="160"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-1 card border-danger">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-long-arrow-right"></i>
|
||||
{% trans "Memory Usage" %}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flot-chart">
|
||||
<div class="flot-chart-content" id="flot-moving-line-chart">
|
||||
<canvas id="memChart" width="735" height="160"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% for net in instance.networks %}
|
||||
<div class="mb-1 card border-info">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-long-arrow-right"></i>
|
||||
{% trans "Bandwidth Device" %}: eth{{ forloop.counter0 }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flot-chart">
|
||||
<div class="flot-chart-content" id="flot-moving-line-chart">
|
||||
<canvas id="netEth{{ forloop.counter0 }}Chart" width="735" height="160"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% for disk in instance.disks %}
|
||||
<div class="mb-1 card border-warning">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-long-arrow-right"></i>
|
||||
{% trans "Disk I/O device" %}: {{ disk.dev }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flot-chart">
|
||||
<div class="flot-chart-content" id="flot-moving-line-chart">
|
||||
<canvas id="blk{{ disk.dev }}Chart" width="735" height="160"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="logs">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped sortable-theme-bootstrap" id="logs_table" data-sortable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{% trans "Date" %}</th>
|
||||
<th scope="col">{% trans "User" %}</th>
|
||||
<th scope="col">{% trans "Message" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="searchable">
|
||||
<tr>
|
||||
<td colspan="3"><i>{% trans 'None' %}...</i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function update_logs_table(vname) {
|
||||
// TODO
|
||||
logurl = "{% url 'vm_logs' 1 %}".replace(1, vname);
|
||||
$.getJSON(logurl, function(data) {
|
||||
var logs = "";
|
||||
$.each(data, function(id) {
|
||||
row = data[id];
|
||||
// console.log(row);
|
||||
logs += '<tr><td style="width:150px">'+row['date']+'</td>';
|
||||
logs += '<td>'+row['user']+'</td>';
|
||||
logs += '<td>'+row['message']+'</td></tr>';
|
||||
});
|
||||
$("#logs_table > tbody").html(logs);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue