1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

unused/old bootstrap file deleted. instances.html make-up..

This commit is contained in:
catborise 2018-07-18 15:01:09 +03:00
parent bee2e4222b
commit d44c65a3f4

View file

@ -3,293 +3,325 @@
{% load staticfiles %} {% load staticfiles %}
{% block title %}{% trans "Instances" %}{% endblock %} {% block title %}{% trans "Instances" %}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" /> <link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}"/>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
{% if request.user.is_superuser %} {% if request.user.is_superuser %}
{% include 'create_inst_block.html' %} {% include 'create_inst_block.html' %}
{% endif %} {% endif %}
{% if all_host_vms or all_user_vms %} {% if all_host_vms or all_user_vms %}
<div class="pull-right search"> <div class="pull-right search">
<input id="filter" class="form-control" type="text" placeholder="Search"> <input id="filter" class="form-control" type="text" placeholder="Search">
</div> </div>
{% endif %} {% endif %}
<h1 class="page-header">{% trans "Instances" %}</h1> <h1 class="page-header">{% trans "Instances" %}</h1>
</div> </div>
</div>
<!-- /.row -->
{% include 'errors_block.html' %}
<div class="row">
<div class="col-lg-12">
<div class="table-responsive">
{% if request.user.is_superuser %}
{% if not all_host_vms %}
<div class="col-lg-12">
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-exclamation-triangle"></i>
<strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instace" %}
</div> </div>
<!-- /.row --> </div>
{% else %}
{% include 'errors_block.html' %} <table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
<thead>
<div class="row"> <tr>
<div class="col-lg-12"> <th>#</th>
<div class="table-responsive"> <th>Name<br>Description</th>
{% if request.user.is_superuser %} <th>User</th>
{% if not all_host_vms %} <th>Status</th>
<div class="col-lg-12"> <th>VCPU</th>
<div class="alert alert-warning alert-dismissable"> <th>Memory</th>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <th data-sortable="false" style="width:205px;">Actions & Mem Usage</th>
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instace" %} </tr>
</div> </thead>
</div> <tbody class="searchable">
{% else %} {% for host, inst in all_host_vms.items %}
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable> <tr class="success" style="font-size:16px">
<thead > <td>{{ forloop.counter }}</td>
<tr> <td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
<th>#</th> <td></td>
<th>Name<br>Description</th> <td>{% ifequal host.2 1 %}<span class="label label-success">{% trans "Active" %}
<th>User</th>
<th>Status</th>
<th>VCPU</th>
<th>Memory</th>
<th data-sortable="false" style="width:205px;">Actions & Mem Usage</th>
</tr>
</thead>
<tbody class="searchable">
{% for host, inst in all_host_vms.items %}
<!-- copied /-->
<tr class="success" style="font-size:16px">
<td>{{ forloop.counter }}</td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
<td></td>
<td>{% ifequal host.2 1 %}<span class="label label-success">{% trans "Active" %}
</span>{% endifequal %} </span>{% endifequal %}
{% ifequal host.2 2 %}<span class="label label-danger">{% trans "Not Active" %} {% ifequal host.2 2 %}<span class="label label-danger">{% trans "Not Active" %}
</span>{% endifequal %} </span>{% endifequal %}
{% ifequal host.2 3 %}<span class="label label-danger">{% trans "Connection Failed" %} {% ifequal host.2 3 %}<span class="label label-danger">{% trans "Connection Failed" %}
</span>{% endifequal %} </span>{% endifequal %}
</td> </td>
<td style="text-align:center;">{{ host.3 }}</td> <td style="text-align:center;">{{ host.3 }}</td>
<td style="text-align:right;">{{ host.4|filesizeformat }}</td> <td style="text-align:right;">{{ host.4|filesizeformat }}</td>
<td style="text-align:left;"> <td style="text-align:left;">
<div class="progress-bar-success" role="progressbar" style="width: {{ host.5 }}%" aria-valuenow="{{ host.5 }}" aria-valuemin="0" aria-valuemax="100">{{ host.5 }}%</div> <div class="progress-bar-success" role="progressbar" style="width: {{ host.5 }}%"
</td> aria-valuenow="{{ host.5 }}" aria-valuemin="0" aria-valuemax="100">{{ host.5 }}%
</tr> </div>
<!-- copied /--> </td>
{% for vm, info in inst.items %} </tr>
<tr> <td></td>
<td></td> <td>{{ forloop.counter }} &emsp; <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br>
<td>{{ forloop.counter }} &emsp; <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br><small><em>{{ info.title }}</em></small></td> <small><em>{{ info.title }}</em></small>
<td><small><em>{% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td> </td>
<td>{% ifequal info.status 1 %} <td>
<span class="text-success">{% trans "Active" %}</span> <small><em>
{% endifequal %} {% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}
{% ifequal info.status 5 %} {% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }})
<span class="text-danger">{% trans "Off" %}</span> {% endif %}{% endif %}</em></small>
{% endifequal %} </td>
{% ifequal info.status 3 %} <td>{% ifequal info.status 1 %}
<span class="text-warning">{% trans "Suspend" %}</span> <span class="text-success">{% trans "Active" %}</span>
{% endifequal %} {% endifequal %}
</td> {% ifequal info.status 5 %}
<td style="text-align:center;">{{ info.vcpu }}</td> <span class="text-danger">{% trans "Off" %}</span>
<td style="text-align:right;">{{ info.memory |filesizeformat }}</td> {% endifequal %}
<td><form action="" method="post" role="form">{% csrf_token %} {% ifequal info.status 3 %}
<input type="hidden" name="name" value="{{ vm }}"/> <span class="text-warning">{% trans "Suspend" %}</span>
<input type="hidden" name="compute_id" value="{{ host.0 }}"/> {% endifequal %}
{% ifequal info.status 5 %} </td>
{% if info.is_template %} <td style="text-align:center;">{{ info.vcpu }}</td>
<button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ host.0 }}, '{{ vm }}');"> <td style="text-align:right;">{{ info.memory |filesizeformat }}</td>
<span class="glyphicon glyphicon-duplicate"></span> <td>
</button> <form action="" method="post" role="form">{% csrf_token %}
{% else %} <input type="hidden" name="name" value="{{ vm }}"/>
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}"> <input type="hidden" name="compute_id" value="{{ host.0 }}"/>
<span class="glyphicon glyphicon-play"></span> {% ifequal info.status 5 %}
</button> {% if info.is_template %}
{% endif %} <button class="btn btn-sm btn-default" type="button" name="clone"
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> title="{% trans "Clone" %}"
<span class="glyphicon glyphicon-pause"></span> onclick="goto_instance_clone({{ host.0 }}, '{{ vm }}');">
</button> <span class="glyphicon glyphicon-duplicate"></span>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> </button>
<span class="glyphicon glyphicon-off"></span> {% else %}
</button> <button class="btn btn-sm btn-default" type="submit" name="poweron"
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 3 %}
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endif %} {% endif %}
{% else %} <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
{% if not all_user_vms %} <span class="glyphicon glyphicon-pause"></span>
<div class="col-lg-12"> </button>
<div class="alert alert-warning alert-dismissable"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <span class="glyphicon glyphicon-off"></span>
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instace" %} </button>
</div> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
</div> <span class="glyphicon glyphicon-refresh"></span>
{% else %} </button>
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
<thead> <span class="glyphicon glyphicon-eye-open"></span>
<tr> </button>
<th>Name</th> {% endifequal %}
<th>Status</th> {% ifequal info.status 3 %}
<th>VCPU</th> <button class="btn btn-sm btn-default" type="submit" name="resume"
<th>Memory</th> title="{% trans "Resume" %}">
<th data-sortable="false" style="width: 165px;">Actions</th> <span class="glyphicon glyphicon-play"></span>
</tr> </button>
</thead> <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<tbody class="searchable"> <span class="glyphicon glyphicon-pause"></span>
{% for inst, vm in all_user_vms.items %} </button>
<tr> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
<td><a href="{% url 'instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td> <span class="glyphicon glyphicon-off"></span>
<td>{% ifequal vm.status 1 %} </button>
<span class="text-success">{% trans "Active" %}</span> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
{% endifequal %} <span class="glyphicon glyphicon-refresh"></span>
{% ifequal vm.status 5 %} </button>
<span class="text-danger">{% trans "Off" %}</span> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
{% endifequal %} <span class="glyphicon glyphicon-eye-open"></span>
{% ifequal vm.status 3 %} </button>
<span class="text-warning">{% trans "Suspend" %}</span> {% endifequal %}
{% endifequal %} {% ifequal info.status 1 %}
</td> <button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<td>{{ vm.vcpu }}</td> <span class="glyphicon glyphicon-play"></span>
<td>{{ vm.memory }} {% trans "MB" %}</td> </button>
<td><form action="" method="post" role="form">{% csrf_token %} <button class="btn btn-sm btn-default" type="submit" name="suspend"
<input type="hidden" name="name" value="{{ vm.name }}"/> title="{% trans "Suspend" %}">
<input type="hidden" name="compute_id" value="{{ vm.compute_id }}"/> <span class="glyphicon glyphicon-pause"></span>
{% ifequal vm.status 5 %} </button>
{% if inst.instance.is_template %} <button class="btn btn-sm btn-default" type="submit" name="poweroff"
<button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ vm.compute_id }}, '{{ vm.name }}');"> title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-duplicate"></span> <span class="glyphicon glyphicon-off"></span>
</button> </button>
{% else %} <button class="btn btn-sm btn-default" type="submit" name="powercycle"
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}"> title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
{% endif %} <a href="#" class="btn btn-sm btn-default"
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-off"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </a>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> {% endifequal %}
<span class="glyphicon glyphicon-refresh"></span> </form>
</button> </td>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> </tr>
<span class="glyphicon glyphicon-eye-open"></span> {% endfor %}
</button> {% endfor %}
{% endifequal %} </tbody>
{% ifequal vm.status 3 %} </table>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}"> {% endif %}
<span class="glyphicon glyphicon-play"></span> {% else %}
</button> {% if not all_user_vms %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <div class="col-lg-12">
<span class="glyphicon glyphicon-off"></span> <div class="alert alert-warning alert-dismissable">
</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <i class="fa fa-exclamation-triangle"></i>
<span class="glyphicon glyphicon-refresh"></span> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instance" %}
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal vm.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ vm.compute_id }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endif %}
</div>
</div> </div>
</div> </div>
{% else %}
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>VCPU</th>
<th>Memory</th>
<th data-sortable="false" style="width: 165px;">Actions</th>
</tr>
</thead>
<tbody class="searchable">
{% for inst, vm in all_user_vms.items %}
<tr>
<td><a href="{% url 'instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br>
<small><em>{{ vm.title }}</em></small>
</td>
<td>{% ifequal vm.status 1 %}
<span class="text-success">{% trans "Active" %}</span>
{% endifequal %}
{% ifequal vm.status 5 %}
<span class="text-danger">{% trans "Off" %}</span>
{% endifequal %}
{% ifequal vm.status 3 %}
<span class="text-warning">{% trans "Suspend" %}</span>
{% endifequal %}
</td>
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory }} {% trans "MB" %}</td>
<td>
<form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ vm.name }}"/>
<input type="hidden" name="compute_id" value="{{ vm.compute_id }}"/>
{% ifequal vm.status 5 %}
{% if inst.instance.is_template %}
<button class="btn btn-sm btn-default" type="button" name="clone"
title="{% trans "Clone" %}"
onclick="goto_instance_clone({{ vm.compute_id }}, '{{ vm.name }}');">
<span class="glyphicon glyphicon-duplicate"></span>
</button>
{% else %}
<button class="btn btn-sm btn-default" type="submit" name="poweron"
title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
{% endif %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default disabled"
title="{% trans "Power Cycle" %}">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<button class="btn btn-sm btn-default disabled"
title="{% trans "VNC Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal vm.status 3 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default disabled"
title="{% trans "Power Cycle" %}">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<button class="btn btn-sm btn-default disabled"
title="{% trans "VNC Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal vm.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="poweroff"
title="{% trans "Power Off" %}">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="powercycle"
title="{% trans "Power Cycle" %}"
onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<a href="#" class="btn btn-sm btn-default"
onclick='open_console("{{ vm.compute_id }}-{{ vm.uuid }}")'
title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{% static "js/sortable.min.js" %}"></script> <script src="{% static "js/sortable.min.js" %}"></script>
<script>
function open_console(uuid) {
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");
}
</script>
<script>
function filter_table() {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
Cookies.set("instances_filter", $(this).val(), { expires: 1 });
}
$(document).ready(function () {
instances_filter_cookie = Cookies.get("instances_filter");
if (instances_filter_cookie) {
$('#filter').val(instances_filter_cookie);
$('#filter').each(filter_table);
}
(function ($) {
$('#filter').keyup(filter_table)
}(jQuery));
});
</script>
<script>
function goto_instance_clone(compute, instance) {
window.location = "/instance/" + compute + "/" + instance + "/#clone";
}
</script>
{% if request.user.is_superuser %}
<script> <script>
function goto_compute() { function open_console(uuid) {
var compute = $("#compute_select").val(); window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");
window.location = "/compute/" + compute + "/create/";
} }
</script> </script>
{% endif %} <script>
function filter_table() {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
Cookies.set("instances_filter", $(this).val(), {expires: 1});
}
$(document).ready(function () {
instances_filter_cookie = Cookies.get("instances_filter");
if (instances_filter_cookie) {
$('#filter').val(instances_filter_cookie);
$('#filter').each(filter_table);
}
(function ($) {
$('#filter').keyup(filter_table)
}(jQuery));
});
</script>
<script>
function goto_instance_clone(compute, instance) {
window.location = "/instance/" + compute + "/" + instance + "/#clone";
}
</script>
{% if request.user.is_superuser %}
<script>
function goto_compute() {
var compute = $("#compute_select").val();
window.location = "/compute/" + compute + "/create/";
}
</script>
{% endif %}
{% endblock %} {% endblock %}