1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 12:04:15 +00:00
webvirtcloud/instances/templates/instances.html

134 lines
6.4 KiB
HTML
Raw Normal View History

2015-02-27 12:25:41 +00:00
{% extends "base.html" %}
2015-02-27 08:53:51 +00:00
{% load i18n %}
2015-04-06 07:51:50 +00:00
{% load staticfiles %}
{% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %}
2015-03-10 14:46:52 +00:00
{% block style %}
2018-07-19 06:39:41 +00:00
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
2015-03-10 14:46:52 +00:00
{% endblock %}
2015-02-27 12:25:41 +00:00
{% block content %}
<!-- Page Heading -->
2019-07-31 08:03:48 +00:00
<div class="row">
<div class="col-lg-12">
{% if request.user.is_superuser %}
2020-05-19 16:53:54 +00:00
<a href="{% url 'create_instance_select_type' compute.id %}" type="button" class="btn btn-success btn-header float-right">
<span class="fa fa-plus" aria-hidden="true"></span>
</a>
2019-07-31 08:03:48 +00:00
{% endif %}
{% if all_host_vms or all_user_vms %}
2020-05-19 16:53:54 +00:00
<div class="float-right search">
2019-07-31 08:03:48 +00:00
<input id="filter" class="form-control" type="text" placeholder="Search">
2018-07-18 12:46:11 +00:00
</div>
2019-07-31 08:03:48 +00:00
{% endif %}
2020-05-19 16:53:54 +00:00
<h2 class="page-header">{{ compute.name }}</h2>
2019-07-31 08:03:48 +00:00
</div>
</div>
<div class="row">
2020-05-19 16:53:54 +00:00
<div class="col-lg-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb bg-light shadow-sm">
<li class="breadcrumb-item active">
<a href="{% url 'overview' compute.id %}"><i class="fa fa-dashboard"></i> {% trans "Overview" %}</a>
</li>
<li class="breadcrumb-item">
<span class="font-weight-bold"><i class="fa fa-server"></i> {% trans "Instances" %}</span>
</li>
<li class="breadcrumb-item">
<a href="{% url 'storages' compute.id %}"><i class="fa fa-hdd-o"></i> {% trans "Storages" %}</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'networks' compute.id %}"><i class="fa fa-sitemap"></i> {% trans "Networks" %}</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'interfaces' compute.id %}"><i class="fa fa-wifi"></i> {% trans "Interfaces" %}</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
</li>
<li class="breadcrumb-item">
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
</li>
</ol>
</nav>
2019-07-31 08:03:48 +00:00
</div>
</div>
<!-- /.row -->
{% include 'errors_block.html' %}
<div class="row">
{% if not all_host_vms %}
<div class="col-lg-12">
2020-05-19 16:53:54 +00:00
<div class="alert alert-warning alert-dismissable fade">
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning" %}:</strong> {% trans "Hypervisor doesn't have any Instances" %}
2019-07-31 08:03:48 +00:00
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
</div>
</div>
2019-07-31 08:03:48 +00:00
{% else %}
<div class="col-lg-12">
2020-05-19 16:53:54 +00:00
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
2019-07-31 08:03:48 +00:00
<thead>
<tr>
<th>{% trans 'Name' %}<br>{% trans 'Description' %}</th>
2020-05-19 16:53:54 +00:00
<th class="d-none d-md-table-cell">{% trans 'User' %}</th>
2019-07-31 08:03:48 +00:00
<th>{% trans 'Status' %}</th>
<th>{% trans 'VCPU' %}</th>
<th>{% trans 'Memory' %}</th>
2020-05-19 16:53:54 +00:00
<th style="width:200px;" data-sortable="false">{% trans 'Actions' %}</th>
2019-07-31 08:03:48 +00:00
</tr>
</thead>
<tbody class="searchable">
2020-05-19 16:53:54 +00:00
{% for host, insts in all_host_vms.items %}
{% for inst, vm in insts.items %}
<tr>
<td><a class="text-secondary" href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ vm.title }}</em></small></td>
<td class="d-none d-md-table-cell"><small><em>{% if vm.userinstances.count > 0 %}{{ vm.userinstances.first_user.user.username }}{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}{% endif %}</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|filesizeformat }}</td>
<td class="text-nowrap">
{% include 'instance_actions.html' %}
</td>
</tr>
{% endfor %}
2019-07-31 08:03:48 +00:00
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
2015-02-27 12:25:41 +00:00
{% endblock %}
2015-03-06 13:06:29 +00:00
{% block script %}
2018-07-19 06:39:41 +00:00
<script src="{% static "js/sortable.min.js" %}"></script>
<script>
function open_console(uuid) {
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=685");
2018-07-19 06:39:41 +00:00
}
</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);
}
2018-07-19 06:39:41 +00:00
(function ($) {
$('#filter').keyup(filter_table)
}(jQuery));
});
</script>
<script>
function goto_instance_clone(compute, instance) {
2018-10-01 08:44:29 +00:00
window.location = "/instances/" + compute + "/" + instance + "/#clone";
2018-07-19 06:39:41 +00:00
}
</script>
{% endblock %}