From 2e976fc1012da2d496072197d771f557c65cbc64 Mon Sep 17 00:00:00 2001 From: Retspen Date: Wed, 11 Mar 2015 11:39:44 +0200 Subject: [PATCH] Fixed users instances --- instances/views.py | 4 +-- static/css/webvirtcloud.css | 4 +++ templates/base_auth.html | 52 +++++++++++++++++++++++++++ templates/create_inst_block.html | 2 +- templates/create_instance.html | 1 + templates/create_user_inst_block.html | 35 ++++++++++++++++-- templates/instances.html | 37 ++++++++++--------- templates/login.html | 2 +- templates/logout.html | 2 +- templates/storage.html | 11 +++--- users/views.py | 15 ++++++++ 11 files changed, 135 insertions(+), 30 deletions(-) create mode 100644 templates/base_auth.html diff --git a/instances/views.py b/instances/views.py index ed63011..cc47227 100644 --- a/instances/views.py +++ b/instances/views.py @@ -44,8 +44,8 @@ def instances(request): usr_inst.instance.compute.login, usr_inst.instance.compute.password, usr_inst.instance.compute.type) - all_user_vms[usr_inst.instance.compute.id, - usr_inst.instance.compute.name] = conn.get_user_instances(usr_inst.instance.name) + all_user_vms[usr_inst] = conn.get_user_instances(usr_inst.instance.name) + all_user_vms[usr_inst].update({'host_id': usr_inst.instance.compute.id}) else: for compute in computes: if connection_manager.host_is_up(compute.type, compute.hostname): diff --git a/static/css/webvirtcloud.css b/static/css/webvirtcloud.css index e938c8f..61ce901 100644 --- a/static/css/webvirtcloud.css +++ b/static/css/webvirtcloud.css @@ -82,4 +82,8 @@ body { .search { margin: 5px; +} + +.btn-header { + margin-top: 5px; } \ No newline at end of file diff --git a/templates/base_auth.html b/templates/base_auth.html new file mode 100644 index 0000000..89e9488 --- /dev/null +++ b/templates/base_auth.html @@ -0,0 +1,52 @@ +{% load static %} + + + + + + + + + + + + {% block title %}{% endblock %} + + + + + + + + + + + + {% block style %}{% endblock %} + + + + + + + + + + + + + {% block content %}{% endblock %} + + + + + + + + {% block script %}{% endblock %} + + + \ No newline at end of file diff --git a/templates/create_inst_block.html b/templates/create_inst_block.html index f0fa1c0..a063645 100644 --- a/templates/create_inst_block.html +++ b/templates/create_inst_block.html @@ -1,6 +1,6 @@ {% load i18n %} {% if request.user.is_superuser %} - + diff --git a/templates/create_instance.html b/templates/create_instance.html index 4729dc2..472360d 100644 --- a/templates/create_instance.html +++ b/templates/create_instance.html @@ -212,6 +212,7 @@ {% else %}
+
diff --git a/templates/create_user_inst_block.html b/templates/create_user_inst_block.html index e81a484..df5937e 100644 --- a/templates/create_user_inst_block.html +++ b/templates/create_user_inst_block.html @@ -1,5 +1,36 @@ +{% load i18n %} {% if request.user.is_superuser %} - + + + + {% endif %} \ No newline at end of file diff --git a/templates/instances.html b/templates/instances.html index e158ecd..2c4925e 100644 --- a/templates/instances.html +++ b/templates/instances.html @@ -9,6 +9,9 @@
{% include 'create_inst_block.html' %} +

{% trans "Instances" %}

@@ -19,9 +22,6 @@
- {% if request.user.is_superuser %}
@@ -108,30 +108,27 @@
{% else %} - - +
- + - {% for host, vm in all_user_vms.items %} + {% for inst, vm in all_user_vms.items %} - + @@ -139,7 +136,7 @@
Name Status VCPU MemoryActionsActions
{{ vm.name }}{{ vm.name }} {% ifequal vm.status 1 %}

{% trans "Active" %}

{% endifequal %} - {% ifequal info.status 5 %} + {% ifequal vm.status 5 %}

{% trans "Off" %}

{% endifequal %} - {% ifequal info.status 3 %} + {% ifequal vm.status 3 %}

{% trans "Suspend" %}

{% endifequal %}
{{ vm.memory }} {% trans "MB" %}
{% csrf_token %} - + {% ifequal vm.status 5 %}