1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

Move links and rebuild pages

This commit is contained in:
Retspen 2015-03-04 15:43:29 +02:00
parent 8f5ccb3519
commit d3bdec0380
10 changed files with 192 additions and 48 deletions

View file

@ -40,7 +40,7 @@ def computes(request):
return render(request, 'computes.html', locals())
def compute(request, compute_id):
def overview(request, compute_id):
"""
:param request:
:return:
@ -67,4 +67,4 @@ def compute(request, compute_id):
except libvirtError as lib_err:
error_messages.append(lib_err)
return render(request, 'compute.html', locals())
return render(request, 'overview.html', locals())

View file

@ -1,8 +1,9 @@
{% load i18n %}
{% load tags_activebtn %}
<a href="{% url 'storages' compute.id %}" class="btn btn-default {% class_activebtn request "^/storage" %}">{% trans "Storages" %}</a>
<a href="{% url 'networks' compute.id %}" class="btn btn-default {% class_activebtn request "^/network" %}">{% trans "Networks" %}</a>
<a href="{% url 'interfaces' compute.id %}" class="btn btn-default {% class_activebtn request "^/interface" %}">{% trans "Interface" %}</a>
<a href="{% url 'secrets' compute.id %}" class="btn btn-default {% class_activebtn request "^/secret" %}">{% trans "Secrets" %}</a>
<a href="{% url 'overview' compute.id %}" class="btn btn-default {% class_activebtn request "^/compute/overview" %}">{% trans "Overview" %}</a>
<a href="{% url 'storages' compute.id %}" class="btn btn-default {% class_activebtn request "^/compute/stg" %}">{% trans "Storages" %}</a>
<a href="{% url 'networks' compute.id %}" class="btn btn-default {% class_activebtn request "^/compute/net" %}">{% trans "Networks" %}</a>
<a href="{% url 'interfaces' compute.id %}" class="btn btn-default {% class_activebtn request "^/compute/iface" %}">{% trans "Interfaces" %}</a>
<a href="{% url 'secrets' compute.id %}" class="btn btn-default {% class_activebtn request "^/compute/secret" %}">{% trans "Secrets" %}</a>
<hr>

View file

@ -23,7 +23,7 @@
<div class="panel-heading">
{% ifequal compute.status 1 %}
<h3 class="panel-title">
<a href="{% url 'compute' compute.id %}"><strong>{{ compute.name }}</strong></a>
<a href="{% url 'overview' compute.id %}"><strong>{{ compute.name }}</strong></a>
<a data-toggle="modal" href="#editHost{{ compute.id }}" class="pull-right"
title="{% trans "Edit" %}">
<span class="glyphicon glyphicon-cog"></span>

View file

@ -15,16 +15,16 @@
{% include 'errors_block.html' %}
<div class="table-responsive">
{% if request.user.is_superuser %}
<table class="table">
<table class="table table-responsive table-hover">
<thead>
<tr class="active">
<tr>
<th>Name</th>
<th>Host</th>
<th>Status</th>
<th>VCPU</th>
<th>Memory</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
@ -32,24 +32,20 @@
{% for host, inst in all_host_vms.items %}
{% for vm, info in inst.items %}
<tr>
<td>
<span class="glyphicon glyphicon-th" aria-hidden="true"></span> <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a>
</td>
<td>
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> <a href="{% url 'compute' host.0 %}">{{ host.1 }}</a>
<td><a href="{% url 'instance' host.0 vm %}">{{ vm }}</a></td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
<td>{% ifequal info.status 1 %}
{% trans "Active" %}
{% endifequal %}
{% ifequal info.status 5 %}
{% trans "Off" %}
{% endifequal %}
{% ifequal info.status 3 %}
{% trans "Suspend" %}
{% endifequal %}
</td>
<td>{{ info.vcpu }}</td>
<td>{{ info.memory }} {% trans "MB" %}</td>
<td>{% ifequal info.status 1 %}
<span class="label label-success">{% trans "Running" %}</span>
{% endifequal %}
{% ifequal info.status 5 %}
<span class="label label-danger">{% trans "Shutoff" %}</span>
{% endifequal %}
{% ifequal info.status 3 %}
<span class="label label-warning">{% trans "Suspend" %}</span>
{% endifequal %}
</td>
<td><form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ info.name }}"/>
<input type="hidden" name="compute" value="{{ host.0 }}"/>
@ -109,34 +105,33 @@
{% else %}
<table class="table">
<table class="table table-responsive table-hover">
<thead>
<tr class="active">
<tr>
<th>Name</th>
<th>Status</th>
<th>VCPU</th>
<th>Memory</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for host, vm in all_user_vms.items %}
<tr>
<td>
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> <a href="{% url 'instance' host.0 vm.name %}">{{ vm.name }}</a>
<td><a href="{% url 'instance' host.0 vm.name %}">{{ vm.name }}</a></td>
<td>{% ifequal vm.status 1 %}
{% trans "Active" %}
{% endifequal %}
{% ifequal vm.status 5 %}
{% trans "Off" %}
{% endifequal %}
{% ifequal vm.status 3 %}
{% trans "Suspend" %}
{% endifequal %}
</td>
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory }} {% trans "MB" %}</td>
<td>{% ifequal vm.status 1 %}
<span class="label label-success">{% trans "Running" %}</span>
{% endifequal %}
{% ifequal vm.status 5 %}
<span class="label label-danger">{% trans "Shutoff" %}</span>
{% endifequal %}
{% ifequal vm.status 3 %}
<span class="label label-warning">{% trans "Suspend" %}</span>
{% endifequal %}
</td>
<td><form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ vm.name }}"/>
<input type="hidden" name="compute" value="{{ host.0 }}"/>
@ -189,12 +184,13 @@
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
{% endif %}
</div>
</div>

View file

@ -19,6 +19,28 @@
<div class="row">
{% if not ifaces_all %}
<div class="well">
<h4>{% trans "You do not have any storage pools" %}</h4>
</div>
{% else %}
{% for iface in ifaces_all %}
<div class="col-xs-12 col-sm-4">
<div class="panel {% ifequal iface.state 1 %}panel-success{% else %}panel-danger{% endifequal %} panel-data">
<div class="panel-heading">
<h3 class="panel-title"><a href="{% url 'interface' compute.id iface.name %}">{{ iface.name }}</a>
</h3>
</div>
<div class="panel-body">
<p>{% trans "Type" %}: {{ iface.type }}</p>
<p>{% trans "MAC" %}: {{ iface.mac }}</p>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Network" %} - {{ compute.name }}{% endblock %}
{% block title %}{% trans "Networks" %} - {{ compute.name }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
@ -19,6 +19,27 @@
<div class="row">
{% if not networks %}
<div class="well">
<h4>{% trans "You do not have any virtual networks" %}</h4>
</div>
{% else %}
{% for pool in networks %}
<div class="col-xs-6 col-sm-4">
<div class="panel {% if pool.status %}panel-success{% else %}panel-danger{% endif %} panel-data">
<div class="panel-heading">
<h3 class="panel-title"><a href="{% url 'network' compute.id pool.name %}">{{ pool.name }}</a></h3>
</div>
<div class="panel-body">
<p>{% trans "Device" %}: {{ pool.device }}</p>
<p>{% trans "Forward" %}: {{ pool.forward|upper }}</p>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Compute" %} - {{ compute.name }}{% endblock %}
{% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
@ -9,8 +9,6 @@
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
{% include 'create_comp_block.html' %}
<h1 class="page-header">{{ compute.name }}</h1>
{% include 'errors_block.html' %}

View file

@ -19,6 +19,87 @@
<div class="row">
{% if not secrets_all %}
<div class="well" role="main">
<h4>{% trans "You do not have any Secrets" %}</h4>
</div>
{% else %}
<table class="table table-responsive">
<thead>
<tr class="active">
<th>{% trans "UUID" %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Usage" %}</th>
<th style="width:90px;">{% trans "Action" %}</th>
</tr>
</thead>
<tbody>
{% for secret in secrets_all %}
<tr>
<td>{{ secret.uuid }}</td>
<td>{% ifequal secret.usageType 0 %}
{% trans "volume" %}
{% endifequal %}
{% ifequal secret.usageType 1 %}
{% trans "iscsi" %}
{% endifequal %}
{% ifequal secret.usageType 2 %}
{% trans "ceph" %}
{% endifequal %}
</td>
<td>{{ secret.usage }}</td>
<td>
<form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="uuid" value="{{ secret.uuid }}"/>
<a data-toggle="modal" href="#editSecret{{ secret.uuid }}"
class="btn btn-sm btn-primary" title="{% trans "Edit" %}">
<span class="glyphicon glyphicon-pencil"></span>
</a>
<button type="submit" class="btn btn-sm btn-danger" name="delete"
title="{% trans "Delete" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
<span class="glyphicon glyphicon-trash"></span>
</button>
</form>
<!-- Modal -->
<div class="modal fade" id="editSecret{{ secret.uuid }}" tabindex="-1" role="dialog"
aria-labelledby="editSecret" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title">{% trans "Set secret value" %}</h4>
</div>
<div class="tab-content">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Value" %}</label>
<div class="col-sm-6">
<input type="hidden" name="uuid" value="{{ secret.uuid }}">
<input type="text" name="value" class="form-control"
value="{{ secret.value }}" maxlength="45" required
pattern="[a-zA-Z0-9]$+">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary"
name="set_value">{% trans "Set" %}</button>
</div>
</form>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>

View file

@ -19,9 +19,34 @@
<div class="row">
{% if not storages %}
<div class="well">
<h4>{% trans "You do not have any storage pools" %}</h4>
</div>
{% else %}
{% for pool in storages %}
<div class="col-xs-6 col-sm-4">
<div class="panel {% if pool.status %}panel-success{% else %}panel-danger{% endif %} panel-data">
<div class="panel-heading">
<h3 class="panel-title"><a href="{% url 'storage' compute.id pool.name %}">{{ pool.name }}</a></h3>
</div>
<div class="panel-body">
<p>{% trans "Type" %}: {{ pool.type|upper }}</p>
<p>{% trans "Size" %}: {{ pool.size|filesizeformat }}</p>
<p>{% trans "Volumes" %}: {{ pool.volumes }}</p>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -13,7 +13,7 @@ urlpatterns = patterns('',
url(r'^instance/(\d+)/([\w\-\.]+)/$', 'instances.views.instance', name='instance'),
url(r'^computes/$', 'computes.views.computes', name='computes'),
url(r'^compute/(\d+)/$', 'computes.views.compute', name='compute'),
url(r'^compute/overview/(\d+)/$', 'computes.views.overview', name='overview'),
url(r'^compute/stgs/(\d+)/$', 'storages.views.storages', name='storages'),
url(r'^compute/stg/(\d+)/([\w\-\.]+)/$', 'storages.views.storage', name='storage'),