mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Little fix user page
This commit is contained in:
parent
983dbaf91a
commit
5ba82e29aa
7 changed files with 313 additions and 286 deletions
|
@ -5,4 +5,17 @@ from logs.models import Logs
|
||||||
|
|
||||||
|
|
||||||
def showlogs(request):
|
def showlogs(request):
|
||||||
|
"""
|
||||||
|
:param request:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
if not request.user.is_authenticated():
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return render(request, 'showlogs.html', locals())
|
return render(request, 'showlogs.html', locals())
|
|
@ -97,7 +97,7 @@
|
||||||
{% trans "Power Off" %}
|
{% trans "Power Off" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if status %}
|
{% if request.user.is_superuser %}
|
||||||
<li role="presentation">
|
<li role="presentation">
|
||||||
<a href="#suspend" aria-controls="suspend" role="tab" data-toggle="tab">
|
<a href="#suspend" aria-controls="suspend" role="tab" data-toggle="tab">
|
||||||
{% trans "Suspend" %}
|
{% trans "Suspend" %}
|
||||||
|
@ -105,13 +105,15 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
{% ifequal status 3 %}
|
{% if request.user.is_superuser %}
|
||||||
<li role="presentation" class="active">
|
{% ifequal status 3 %}
|
||||||
<a href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
<li role="presentation" class="active">
|
||||||
{% trans "Resume" %}
|
<a href="#resume" aria-controls="resume" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "Resume" %}
|
||||||
</li>
|
</a>
|
||||||
{% endifequal %}
|
</li>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endif %}
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 5 %}
|
||||||
<li role="presentation" class="active">
|
<li role="presentation" class="active">
|
||||||
<a href="#boot" aria-controls="boot" role="tab" data-toggle="tab">
|
<a href="#boot" aria-controls="boot" role="tab" data-toggle="tab">
|
||||||
|
@ -137,23 +139,27 @@
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="suspend">
|
{% if request.user.is_superuser %}
|
||||||
<p>{% trans "This action suspends the instance." %}</p>
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="suspend">
|
||||||
<form action="" method="post" role="form">{% csrf_token %}
|
<p>{% trans "This action suspends the instance." %}</p>
|
||||||
<input type="submit" name="suspend" class="btn btn-lg btn-success pull-right" value="{% trans "Suspend" %}">
|
<form action="" method="post" role="form">{% csrf_token %}
|
||||||
<div class="clearfix"></div>
|
<input type="submit" name="suspend" class="btn btn-lg btn-success pull-right" value="{% trans "Suspend" %}">
|
||||||
</form>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</form>
|
||||||
{% endifequal %}
|
</div>
|
||||||
{% ifequal status 3 %}
|
{% endif %}
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
|
||||||
<p>{% trans "This action restore the instance after suspend." %}</p>
|
|
||||||
<form action="" method="post" role="form">{% csrf_token %}
|
|
||||||
<input type="submit" name="resume" class="btn btn-lg btn-success pull-right" value="{% trans "Resume" %}">
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
{% ifequal status 3 %}
|
||||||
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="resume">
|
||||||
|
<p>{% trans "This action restore the instance after suspend." %}</p>
|
||||||
|
<form action="" method="post" role="form">{% csrf_token %}
|
||||||
|
<input type="submit" name="resume" class="btn btn-lg btn-success pull-right" value="{% trans "Resume" %}">
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endif %}
|
||||||
{% ifequal status 5 %}
|
{% ifequal status 5 %}
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="boot">
|
||||||
<p>{% trans "Click on Boot button to start this instance." %}</p>
|
<p>{% trans "Click on Boot button to start this instance." %}</p>
|
||||||
|
@ -375,31 +381,33 @@
|
||||||
{% trans "Media" %}
|
{% trans "Media" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation">
|
{% if request.user.is_superuser %}
|
||||||
<a href="#autostart" aria-controls="autostart" role="tab" data-toggle="tab">
|
<li role="presentation">
|
||||||
{% trans "Autostart" %}
|
<a href="#autostart" aria-controls="autostart" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "Autostart" %}
|
||||||
</li>
|
</a>
|
||||||
<li role="presentation">
|
</li>
|
||||||
<a href="#vncsettings" aria-controls="vncsettings" role="tab" data-toggle="tab">
|
<li role="presentation">
|
||||||
{% trans "VNC" %}
|
<a href="#vncsettings" aria-controls="vncsettings" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "VNC" %}
|
||||||
</li>
|
</a>
|
||||||
<li role="presentation">
|
</li>
|
||||||
<a href="#clone" aria-controls="clone" role="tab" data-toggle="tab">
|
<li role="presentation">
|
||||||
{% trans "Clone" %}
|
<a href="#clone" aria-controls="clone" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "Clone" %}
|
||||||
</li>
|
</a>
|
||||||
<li role="presentation">
|
</li>
|
||||||
<a href="#migrate" aria-controls="migrate" role="tab" data-toggle="tab">
|
<li role="presentation">
|
||||||
{% trans "Migrate" %}
|
<a href="#migrate" aria-controls="migrate" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "Migrate" %}
|
||||||
</li>
|
</a>
|
||||||
<li role="presentation">
|
</li>
|
||||||
<a href="#xmledit" aria-controls="xmledit" role="tab" data-toggle="tab">
|
<li role="presentation">
|
||||||
{% trans "XML" %}
|
<a href="#xmledit" aria-controls="xmledit" role="tab" data-toggle="tab">
|
||||||
</a>
|
{% trans "XML" %}
|
||||||
</li>
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<!-- Tab panes -->
|
<!-- Tab panes -->
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
@ -441,222 +449,224 @@
|
||||||
</form>
|
</form>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="autostart">
|
{% if request.user.is_superuser %}
|
||||||
<p>{% trans "Autostart your instance when host server is power on" %}</p>
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="autostart">
|
||||||
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
<p>{% trans "Autostart your instance when host server is power on" %}</p>
|
||||||
{% ifequal autostart 0 %}
|
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
||||||
<input type="submit" class="btn btn-lg btn-success pull-right" name="set_autostart" value="{% trans "Enable" %}">
|
{% ifequal autostart 0 %}
|
||||||
{% else %}
|
<input type="submit" class="btn btn-lg btn-success pull-right" name="set_autostart" value="{% trans "Enable" %}">
|
||||||
<input type="submit" class="btn btn-lg btn-success pull-right" name="unset_autostart" value="{% trans "Disable" %}">
|
{% else %}
|
||||||
{% endifequal %}
|
<input type="submit" class="btn btn-lg btn-success pull-right" name="unset_autostart" value="{% trans "Disable" %}">
|
||||||
</form>
|
{% endifequal %}
|
||||||
<div class="clearfix"></div>
|
</form>
|
||||||
</div>
|
<div class="clearfix"></div>
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="vncsettings">
|
</div>
|
||||||
<p>{% trans "To set console's type, shutdown the instance." %}</p>
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="vncsettings">
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
<p>{% trans "To set console's type, shutdown the instance." %}</p>
|
||||||
<div class="form-group" id="console_type_selection">
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
<label for="console_select_type" class="col-sm-2 control-label">{% trans "Type" %}</label>
|
<div class="form-group" id="console_type_selection">
|
||||||
<div class="col-sm-6">
|
<label for="console_select_type" class="col-sm-2 control-label">{% trans "Type" %}</label>
|
||||||
<select id="console_select_type" class="form-control" name="console_type">
|
<div class="col-sm-6">
|
||||||
<option value="" style="font-weight: bold">{% trans "please choose" %}</option>
|
<select id="console_select_type" class="form-control" name="console_type">
|
||||||
{% for ctype in console_types %}
|
<option value="" style="font-weight: bold">{% trans "please choose" %}</option>
|
||||||
<option value="{{ ctype }}">{{ ctype }}</option>
|
{% for ctype in console_types %}
|
||||||
{% endfor %}
|
<option value="{{ ctype }}">{{ ctype }}</option>
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
{% ifequal status 5 %}
|
|
||||||
<button type="submit" class="btn btn-success " name="set_console_type">{% trans "Set" %}</button>
|
|
||||||
{% else %}
|
|
||||||
<button class="btn btn-success disabled" name="set_console_type">{% trans "Set" %}</button>
|
|
||||||
{% endifequal %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<p>{% trans "To create console password, shutdown the instance." %}</p>
|
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="auto_pass" value="true" id="console_passwd_gen">{% trans "Generate" %}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="clear_pass" value="true" id="console_passwd_clear">{% trans "Clear" %}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="console_passwd_manual">
|
|
||||||
<label for="inputPassword1" class="col-sm-2 control-label">{% trans "Password" %}</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input id="console_show_pass" type="password" class="form-control" name="console_passwd"
|
|
||||||
{% if console_passwd %}
|
|
||||||
value="{{ console_passwd }}"
|
|
||||||
{% else %}
|
|
||||||
placeholder="{% trans "Password" %}"
|
|
||||||
{% endif %} maxlength="14">
|
|
||||||
</div>
|
|
||||||
{% if console_passwd %}
|
|
||||||
<a href="#" name="console_show" class="btn btn-primary btn-md" onclick="show_console()">{% trans "Show" %}</a>
|
|
||||||
{% endif %}
|
|
||||||
<div class="col-sm-3">
|
|
||||||
{% ifequal status 5 %}
|
|
||||||
<button type="submit" class="btn btn-success" name="set_console_passwd">{% trans "Set" %}</button>
|
|
||||||
{% else %}
|
|
||||||
<button class="btn btn-success disabled" name="set_console_passwd">{% trans "Set" %}</button>
|
|
||||||
{% endifequal %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<p>{% trans "To set console's keymap, shutdown the instance." %}</p>
|
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="clear_keymap" value="true" id="console_keymap_clear">{% trans "Clear" %}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="console_keymap_selection">
|
|
||||||
<label for="console_select_keymap" class="col-sm-2 control-label">{% trans "Keymap" %}</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<select id="console_select_keymap" class="form-control" name="console_keymap">
|
|
||||||
<option value="" style="font-weight: bold">{% trans "please choose" %}</option>
|
|
||||||
{% for keymap in keymaps %}
|
|
||||||
<option value="{{ keymap }}">{{ keymap }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
{% ifequal status 5 %}
|
|
||||||
<button type="submit" class="btn btn-success" name="set_console_keymap">{% trans "Set" %}</button>
|
|
||||||
{% else %}
|
|
||||||
<button class="btn btn-success disabled" name="set_console_keymap">{% trans "Set" %}</button>
|
|
||||||
{% endifequal %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="clone">
|
|
||||||
<p style="font-weight:bold;">{% trans "Create a clone" %}</p>
|
|
||||||
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label" style="font-weight:normal;">{% trans "Clone Name" %}</label>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<input type="text" class="form-control" name="name" value="{{ vname }}-clone"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p style="font-weight:bold;">{% trans "Network devices" %}</p>
|
|
||||||
{% for network in networks %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label" style="font-weight:normal;">eth{{ forloop.counter0 }} ({{ network.nic }})</label>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<input type="text" class="form-control" name="net-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<button type="button" class="btn btn-sm btn-success pull-left" name="random-mac-{{ forloop.counter0 }}"
|
|
||||||
onclick="random_mac({{ forloop.counter0 }})" style="margin-top: 2px;">{% trans "Random" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
<p style="font-weight:bold;">{% trans "Storage devices" %}</p>
|
|
||||||
{% for disk in clone_disks %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label" style="font-weight:normal;">{{ disk.dev }} ({{ disk.storage }})</label>
|
|
||||||
<div class="col-sm-3">
|
|
||||||
<input type="text" class="form-control" name="disk-{{ disk.dev }}" value="{{ disk.image }}"/>
|
|
||||||
</div>
|
|
||||||
{% ifequal disk.format 'qcow2' %}
|
|
||||||
<label class="col-sm-2 control-label" style="font-weight:normal;margin-left:-35px;">Metadata</label>
|
|
||||||
<div class="col-sm-1">
|
|
||||||
<input type="checkbox" name="meta-{{ disk.dev }}" value="true" style="margin-top: 10px;">
|
|
||||||
</div>
|
|
||||||
{% endifequal %}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% ifequal status 5 %}
|
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="clone">{% trans "Clone" %}</button>
|
|
||||||
{% else %}
|
|
||||||
<button class="btn btn-lg btn-success pull-right disabled" name="clone">{% trans "Clone" %}</button>
|
|
||||||
{% endifequal %}
|
|
||||||
</form>
|
|
||||||
<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 class="form-horizontal" method="post" role="form">{% csrf_token %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">{% trans "Original host" %}</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<p style="margin: 10px -10px 0 0;">{{ compute.name }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">{% trans "Host migration" %}</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<select name="compute_id" class="form-control">
|
|
||||||
{% if computes_count != 1 %}
|
|
||||||
{% for comp in computes %}
|
|
||||||
{% if comp.id != compute.id %}
|
|
||||||
<option value="{{ comp.id }}">{{ comp.name }}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
</select>
|
||||||
</select>
|
</div>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
{% ifequal status 5 %}
|
||||||
|
<button type="submit" class="btn btn-success " name="set_console_type">{% trans "Set" %}</button>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-success disabled" name="set_console_type">{% trans "Set" %}</button>
|
||||||
|
{% endifequal %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
<div class="form-group">
|
<p>{% trans "To create console password, shutdown the instance." %}</p>
|
||||||
<label class="col-sm-3 control-label">{% trans "Live migration" %}</label>
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
<div class="col-sm-6">
|
<div class="form-group">
|
||||||
<input type="checkbox" name="live_migrate" value="true" id="vm_live_migrate">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="auto_pass" value="true" id="console_passwd_gen">{% trans "Generate" %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="clear_pass" value="true" id="console_passwd_clear">{% trans "Clear" %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group" id="console_passwd_manual">
|
||||||
<div class="form-group">
|
<label for="inputPassword1" class="col-sm-2 control-label">{% trans "Password" %}</label>
|
||||||
<label class="col-sm-3 control-label">{% trans "Unsafe migration" %}</label>
|
<div class="col-sm-6">
|
||||||
<div class="col-sm-6">
|
<input id="console_show_pass" type="password" class="form-control" name="console_passwd"
|
||||||
<input type="checkbox" name="unsafe_migrate" value="true" id="vm_unsafe_migrate">
|
{% if console_passwd %}
|
||||||
|
value="{{ console_passwd }}"
|
||||||
|
{% else %}
|
||||||
|
placeholder="{% trans "Password" %}"
|
||||||
|
{% endif %} maxlength="14">
|
||||||
|
</div>
|
||||||
|
{% if console_passwd %}
|
||||||
|
<a href="#" name="console_show" class="btn btn-primary btn-md" onclick="show_console()">{% trans "Show" %}</a>
|
||||||
|
{% endif %}
|
||||||
|
<div class="col-sm-3">
|
||||||
|
{% ifequal status 5 %}
|
||||||
|
<button type="submit" class="btn btn-success" name="set_console_passwd">{% trans "Set" %}</button>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-success disabled" name="set_console_passwd">{% trans "Set" %}</button>
|
||||||
|
{% endifequal %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
<div class="form-group">
|
<p>{% trans "To set console's keymap, shutdown the instance." %}</p>
|
||||||
<label class="col-sm-3 control-label">{% trans "Delete original" %}</label>
|
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
<div class="col-sm-6">
|
<div class="form-group">
|
||||||
<input type="checkbox" name="xml_delete" value="true" id="xml_delete">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="clear_keymap" value="true" id="console_keymap_clear">{% trans "Clear" %}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group" id="console_keymap_selection">
|
||||||
{% if computes_count != 1 %}
|
<label for="console_select_keymap" class="col-sm-2 control-label">{% trans "Keymap" %}</label>
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="migrate">{% trans "Migrate" %}</button>
|
<div class="col-sm-6">
|
||||||
{% else %}
|
<select id="console_select_keymap" class="form-control" name="console_keymap">
|
||||||
<button class="btn btn-lg btn-success pull-right disabled">{% trans "Migrate" %}</button>
|
<option value="" style="font-weight: bold">{% trans "please choose" %}</option>
|
||||||
{% endif %}
|
{% for keymap in keymaps %}
|
||||||
</form>
|
<option value="{{ keymap }}">{{ keymap }}</option>
|
||||||
<div class="clearfix"></div></p>
|
{% endfor %}
|
||||||
</div>
|
</select>
|
||||||
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="xmledit">
|
</div>
|
||||||
<p>{% trans "If you need to edit xml please Power Off the instance" %}</p>
|
<div class="col-sm-3">
|
||||||
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
|
{% ifequal status 5 %}
|
||||||
<div class="col-sm-12" id="xmlheight">
|
<button type="submit" class="btn btn-success" name="set_console_keymap">{% trans "Set" %}</button>
|
||||||
<textarea id="editor">{{ inst_xml }}</textarea>
|
{% else %}
|
||||||
</div>
|
<button class="btn btn-success disabled" name="set_console_keymap">{% trans "Set" %}</button>
|
||||||
{% ifequal status 5 %}
|
{% endifequal %}
|
||||||
<input type="hidden" name="inst_xml">
|
</div>
|
||||||
<button type="submit" class="btn btn-lg btn-success pull-right" name="change_xml">
|
</div>
|
||||||
{% trans "Change" %}
|
</form>
|
||||||
</button>
|
<div class="clearfix"></div>
|
||||||
{% else %}
|
</div>
|
||||||
<button class="btn btn-lg btn-success pull-right disabled">
|
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="clone">
|
||||||
{% trans "Change" %}
|
<p style="font-weight:bold;">{% trans "Create a clone" %}</p>
|
||||||
</button>
|
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
|
||||||
{% endifequal %}
|
<div class="form-group">
|
||||||
</form>
|
<label class="col-sm-3 control-label" style="font-weight:normal;">{% trans "Clone Name" %}</label>
|
||||||
<div class="clearfix"></div>
|
<div class="col-sm-3">
|
||||||
</div>
|
<input type="text" class="form-control" name="name" value="{{ vname }}-clone"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="font-weight:bold;">{% trans "Network devices" %}</p>
|
||||||
|
{% for network in networks %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label" style="font-weight:normal;">eth{{ forloop.counter0 }} ({{ network.nic }})</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="text" class="form-control" name="net-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button type="button" class="btn btn-sm btn-success pull-left" name="random-mac-{{ forloop.counter0 }}"
|
||||||
|
onclick="random_mac({{ forloop.counter0 }})" style="margin-top: 2px;">{% trans "Random" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<p style="font-weight:bold;">{% trans "Storage devices" %}</p>
|
||||||
|
{% for disk in clone_disks %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label" style="font-weight:normal;">{{ disk.dev }} ({{ disk.storage }})</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="text" class="form-control" name="disk-{{ disk.dev }}" value="{{ disk.image }}"/>
|
||||||
|
</div>
|
||||||
|
{% ifequal disk.format 'qcow2' %}
|
||||||
|
<label class="col-sm-2 control-label" style="font-weight:normal;margin-left:-35px;">Metadata</label>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<input type="checkbox" name="meta-{{ disk.dev }}" value="true" style="margin-top: 10px;">
|
||||||
|
</div>
|
||||||
|
{% endifequal %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% ifequal status 5 %}
|
||||||
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="clone">{% trans "Clone" %}</button>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-lg btn-success pull-right disabled" name="clone">{% trans "Clone" %}</button>
|
||||||
|
{% endifequal %}
|
||||||
|
</form>
|
||||||
|
<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 class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Original host" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<p style="margin: 10px -10px 0 0;">{{ compute.name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Host migration" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select name="compute_id" class="form-control">
|
||||||
|
{% 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">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Live migration" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="checkbox" name="live_migrate" value="true" id="vm_live_migrate">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Unsafe migration" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="checkbox" name="unsafe_migrate" value="true" id="vm_unsafe_migrate">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Delete original" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="checkbox" name="xml_delete" value="true" id="xml_delete">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if computes_count != 1 %}
|
||||||
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="migrate">{% trans "Migrate" %}</button>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-lg btn-success pull-right disabled">{% trans "Migrate" %}</button>
|
||||||
|
{% endif %}
|
||||||
|
</form>
|
||||||
|
<div class="clearfix"></div></p>
|
||||||
|
</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 class="form-horizontal" method="post" role="form">{% csrf_token %}
|
||||||
|
<div class="col-sm-12" id="xmlheight">
|
||||||
|
<textarea id="editor">{{ inst_xml }}</textarea>
|
||||||
|
</div>
|
||||||
|
{% ifequal status 5 %}
|
||||||
|
<input type="hidden" name="inst_xml">
|
||||||
|
<button type="submit" class="btn btn-lg btn-success pull-right" name="change_xml">
|
||||||
|
{% trans "Change" %}
|
||||||
|
</button>
|
||||||
|
{% else %}
|
||||||
|
<button class="btn btn-lg btn-success pull-right disabled">
|
||||||
|
{% trans "Change" %}
|
||||||
|
</button>
|
||||||
|
{% endifequal %}
|
||||||
|
</form>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,10 +28,9 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Instance" %}</th>
|
||||||
<th>{% trans "User blocked" %}</th>
|
<th>{% trans "Resize" %}</th>
|
||||||
<th>{% trans "Can change" %}</th>
|
<th>{% trans "Delete" %}</th>
|
||||||
<th>{% trans "Can delete" %}</th>
|
|
||||||
<th colspan="2">{% trans "Action" %}</th>
|
<th colspan="2">{% trans "Action" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -39,8 +38,7 @@
|
||||||
{% for inst in user_insts %}
|
{% for inst in user_insts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ forloop.counter }}</td>
|
<td>{{ forloop.counter }}</td>
|
||||||
<td>{{ inst.instance.name }}</td>
|
<td><a href="{% url 'instance' inst.instance.compute.id inst.instance.name %}">{{ inst.instance.name }}</a></td>
|
||||||
<td>{{ inst.is_block }}</td>
|
|
||||||
<td>{{ inst.is_change }}</td>
|
<td>{{ inst.is_change }}</td>
|
||||||
<td>{{ inst.is_delete }}</td>
|
<td>{{ inst.is_delete }}</td>
|
||||||
<td style="width:5px;">
|
<td style="width:5px;">
|
||||||
|
@ -58,38 +56,29 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
|
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
|
||||||
|
<input type="hidden" name="user_inst" value="{{ inst.id }}">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Is blocked" %}</label>
|
<label class="col-sm-4 control-label">{% trans "Resize" %}</label>
|
||||||
<div class="col-sm-6">
|
|
||||||
<input type="hidden" name="user_inst" value="{{ inst.id }}">
|
|
||||||
<select type="text" class="form-control" name="inst_block">
|
|
||||||
<option value="">False</option>
|
|
||||||
<option value="1">True</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-4 control-label">{% trans "Can change" %}</label>
|
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select type="text" class="form-control" name="inst_change">
|
<select type="text" class="form-control" name="inst_change">
|
||||||
<option value="">False</option>
|
<option value="">False</option>
|
||||||
<option value="1">True</option>
|
<option value="1" {% if inst.is_change %}selected{% endif %}>True</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Can delete" %}</label>
|
<label class="col-sm-4 control-label">{% trans "Delete" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select type="text" class="form-control" name="inst_delete">
|
<select type="text" class="form-control" name="inst_delete">
|
||||||
<option value="">False</option>
|
<option value="">False</option>
|
||||||
<option value="1">True</option>
|
<option value="1" {% if inst.is_delete %}selected{% endif %}>True</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
|
||||||
<button type="submit" class="btn btn-primary" name="edit">{% trans "Edit" %}</button>
|
<button type="submit" class="btn btn-primary" name="permission">{% trans "Edit" %}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div> <!-- /.modal-content -->
|
</div> <!-- /.modal-content -->
|
||||||
|
|
18
users/migrations/0003_remove_userinstance_is_block.py
Normal file
18
users/migrations/0003_remove_userinstance_is_block.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0002_userinstance_is_block'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userinstance',
|
||||||
|
name='is_block',
|
||||||
|
),
|
||||||
|
]
|
|
@ -8,7 +8,6 @@ class UserInstance(models.Model):
|
||||||
instance = models.ForeignKey(Instance)
|
instance = models.ForeignKey(Instance)
|
||||||
is_change = models.BooleanField(default=False)
|
is_change = models.BooleanField(default=False)
|
||||||
is_delete = models.BooleanField(default=False)
|
is_delete = models.BooleanField(default=False)
|
||||||
is_block = models.BooleanField(default=False)
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.instance.name
|
return self.instance.name
|
|
@ -90,13 +90,11 @@ def user(request, user_id):
|
||||||
del_user_inst = UserInstance.objects.get(id=user_inst)
|
del_user_inst = UserInstance.objects.get(id=user_inst)
|
||||||
del_user_inst.delete()
|
del_user_inst.delete()
|
||||||
return HttpResponseRedirect(request.get_full_path())
|
return HttpResponseRedirect(request.get_full_path())
|
||||||
if 'edit' in request.POST:
|
if 'permission' in request.POST:
|
||||||
user_inst = request.POST.get('user_inst', '')
|
user_inst = request.POST.get('user_inst', '')
|
||||||
inst_block = request.POST.get('inst_block', '')
|
|
||||||
inst_change = request.POST.get('inst_change', '')
|
inst_change = request.POST.get('inst_change', '')
|
||||||
inst_delete = request.POST.get('inst_delete', '')
|
inst_delete = request.POST.get('inst_delete', '')
|
||||||
edit_user_inst = UserInstance.objects.get(id=user_inst)
|
edit_user_inst = UserInstance.objects.get(id=user_inst)
|
||||||
edit_user_inst.is_block = bool(inst_block)
|
|
||||||
edit_user_inst.is_change = bool(inst_change)
|
edit_user_inst.is_change = bool(inst_change)
|
||||||
edit_user_inst.is_delete = bool(inst_delete)
|
edit_user_inst.is_delete = bool(inst_delete)
|
||||||
edit_user_inst.save()
|
edit_user_inst.save()
|
||||||
|
|
|
@ -22,7 +22,7 @@ urlpatterns = patterns('',
|
||||||
url(r'^compute/net/(\d+)/([\w\-\.]+)/$', 'networks.views.network', name='network'),
|
url(r'^compute/net/(\d+)/([\w\-\.]+)/$', 'networks.views.network', name='network'),
|
||||||
|
|
||||||
url(r'^compute/ifaces/(\d+)/$', 'interfaces.views.interfaces', name='interfaces'),
|
url(r'^compute/ifaces/(\d+)/$', 'interfaces.views.interfaces', name='interfaces'),
|
||||||
url(r'^compute/iface/(\d+)/([\w\.]+)$', 'interfaces.views.interface', name='interface'),
|
url(r'^compute/iface/(\d+)/([\w\.\:]+)$', 'interfaces.views.interface', name='interface'),
|
||||||
|
|
||||||
url(r'^compute/secret/(\d+)/$', 'secrets.views.secrets', name='secrets'),
|
url(r'^compute/secret/(\d+)/$', 'secrets.views.secrets', name='secrets'),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue