mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
Add logs and block for templates
This commit is contained in:
parent
55e93a9087
commit
5960e94da5
35 changed files with 183 additions and 29 deletions
|
@ -16,6 +16,9 @@ def computes(request):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
def get_hosts_status(computes):
|
def get_hosts_status(computes):
|
||||||
"""
|
"""
|
||||||
Function return all hosts all vds on host
|
Function return all hosts all vds on host
|
||||||
|
@ -46,8 +49,10 @@ def compute(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
errors = []
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -59,7 +64,7 @@ def compute(request, compute_id):
|
||||||
hypervisor = conn.hypervisor_type()
|
hypervisor = conn.hypervisor_type()
|
||||||
mem_usage = conn.get_memory_usage()
|
mem_usage = conn.get_memory_usage()
|
||||||
conn.close()
|
conn.close()
|
||||||
except libvirtError as err:
|
except libvirtError as lib_err:
|
||||||
errors.append(err)
|
error_messages.append(lib_err)
|
||||||
|
|
||||||
return render(request, 'compute.html', locals())
|
return render(request, 'compute.html', locals())
|
|
@ -20,6 +20,9 @@ def create_instance(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
conn = None
|
conn = None
|
||||||
error_messages = []
|
error_messages = []
|
||||||
storages = []
|
storages = []
|
||||||
|
|
|
@ -16,6 +16,9 @@ def interfaces(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
ifaces_all = []
|
ifaces_all = []
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
@ -60,6 +63,9 @@ def interface(request, compute_id, iface):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
ifaces_all = []
|
ifaces_all = []
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
0
logs/__init__.py
Normal file
0
logs/__init__.py
Normal file
3
logs/admin.py
Normal file
3
logs/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
26
logs/migrations/0001_initial.py
Normal file
26
logs/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('instances', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Logs',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('message', models.CharField(max_length=255)),
|
||||||
|
('date', models.DateTimeField()),
|
||||||
|
('instance', models.ForeignKey(to='instances.Instance')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
},
|
||||||
|
bases=(models.Model,),
|
||||||
|
),
|
||||||
|
]
|
0
logs/migrations/__init__.py
Normal file
0
logs/migrations/__init__.py
Normal file
11
logs/models.py
Normal file
11
logs/models.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from django.db import models
|
||||||
|
from instances.models import Instance
|
||||||
|
|
||||||
|
|
||||||
|
class Logs(models.Model):
|
||||||
|
instance = models.ForeignKey(Instance)
|
||||||
|
message = models.CharField(max_length=255)
|
||||||
|
date = models.DateTimeField()
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.instance
|
3
logs/tests.py
Normal file
3
logs/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
8
logs/views.py
Normal file
8
logs/views.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
|
from logs.models import Logs
|
||||||
|
|
||||||
|
|
||||||
|
def showlogs(request):
|
||||||
|
return render(request, 'showlogs.html', locals())
|
|
@ -18,6 +18,9 @@ def networks(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser():
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
||||||
|
@ -63,6 +66,9 @@ def network(request, compute_id, pool):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ def secrets(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
secrets_all = []
|
secrets_all = []
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
|
@ -17,6 +17,9 @@ def storages(request, compute_id):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
error_messages = []
|
error_messages = []
|
||||||
compute = Compute.objects.get(id=compute_id)
|
compute = Compute.objects.get(id=compute_id)
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
{% include 'sidebar.html' %}
|
{% include 'sidebar.html' %}
|
||||||
|
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
|
||||||
|
{% include 'create_comp_block.html' %}
|
||||||
|
|
||||||
<h1 class="page-header">{{ compute.name }}</h1>
|
<h1 class="page-header">{{ compute.name }}</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
<h4>{% trans "Basic details" %}</h4>
|
<h4>{% trans "Basic details" %}</h4>
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
{% include 'sidebar.html' %}
|
{% include 'sidebar.html' %}
|
||||||
|
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
|
||||||
|
{% include 'create_comp_block.html' %}
|
||||||
|
|
||||||
<h1 class="page-header">Computes</h1>
|
<h1 class="page-header">Computes</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if computes_info %}
|
{% if computes_info %}
|
||||||
|
|
5
templates/create_comp_block.html
Normal file
5
templates/create_comp_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
5
templates/create_iface_block.html
Normal file
5
templates/create_iface_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
5
templates/create_inst_block.html
Normal file
5
templates/create_inst_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
|
@ -11,7 +11,7 @@
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||||
<h1 class="page-header">{{ compute.name }}</h1>
|
<h1 class="page-header">{{ compute.name }}</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
5
templates/create_net_block.html
Normal file
5
templates/create_net_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
5
templates/create_secret_block.html
Normal file
5
templates/create_secret_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
5
templates/create_stg_block.html
Normal file
5
templates/create_stg_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
5
templates/create_user_block.html
Normal file
5
templates/create_user_block.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<button type="button" class="btn btn-success pull-right">
|
||||||
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
|
@ -1,8 +0,0 @@
|
||||||
{% if error_messages %}
|
|
||||||
{% for error in error_messages %}
|
|
||||||
<div class="alert alert-danger alert-dismissible" role="danger">
|
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
||||||
<strong>Error:</strong> {{ error }}
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
8
templates/errors_block.html
Normal file
8
templates/errors_block.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% if error_messages %}
|
||||||
|
{% for error in error_messages %}
|
||||||
|
<div class="alert alert-danger alert-dismissible" role="danger">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<strong>Error:</strong> {{ error }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
|
@ -8,12 +8,12 @@
|
||||||
{% include 'sidebar.html' %}
|
{% include 'sidebar.html' %}
|
||||||
|
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
{% if request.user.is_superuser %}
|
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
{% include 'create_inst_block.html' %}
|
||||||
{% endif %}
|
|
||||||
<h1 class="page-header">{{ vname }}</h1>
|
<h1 class="page-header">{{ vname }}</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
{% include 'sidebar.html' %}
|
{% include 'sidebar.html' %}
|
||||||
|
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
|
||||||
|
{% include 'create_inst_block.html' %}
|
||||||
|
|
||||||
<h1 class="page-header">Instances</h1>
|
<h1 class="page-header">Instances</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
<th>VCPU</th>
|
<th>VCPU</th>
|
||||||
<th>Memory</th>
|
<th>Memory</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th style="width:164px;">Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> <a href="{% url 'compute' host.0 %}">{{ host.1 }}</a>
|
<span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> <a href="{% url 'compute' host.0 %}">{{ host.1 }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ info.vcpu }}</td>
|
<td>{{ info.vcpu }}</td>
|
||||||
<td>{{ info.memory }}</td>
|
<td>{{ info.memory }} {% trans "MB" %}</td>
|
||||||
<td>{% ifequal info.status 1 %}
|
<td>{% ifequal info.status 1 %}
|
||||||
<span class="label label-success">{% trans "Running" %}</span>
|
<span class="label label-success">{% trans "Running" %}</span>
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
|
@ -115,7 +116,7 @@
|
||||||
<th>VCPU</th>
|
<th>VCPU</th>
|
||||||
<th>Memory</th>
|
<th>Memory</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th style="width:164px;">Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
20
templates/showlogs.html
Normal file
20
templates/showlogs.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block title %}{% trans "Logs" %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
{% include 'sidebar.html' %}
|
||||||
|
|
||||||
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
|
|
||||||
|
<h1 class="page-header">{% trans "Logs" %}</h1>
|
||||||
|
|
||||||
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -8,6 +8,7 @@
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<li {% active request "^/compute" %}><a href="{% url 'computes' %}"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span></a></li>
|
<li {% active request "^/compute" %}><a href="{% url 'computes' %}"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span></a></li>
|
||||||
<li {% active request "^/user" %}><a href="{% url 'users' %}"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a></li>
|
<li {% active request "^/user" %}><a href="{% url 'users' %}"><span class="glyphicon glyphicon-user" aria-hidden="true"></span></a></li>
|
||||||
|
<li {% active request "^/showlogs" %}><a href="{% url 'showlogs' %}"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="bottom-sticky">
|
<li class="bottom-sticky">
|
||||||
<a href="#"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a>
|
<a href="#"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span></a>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||||
<h1 class="page-header">{{ user.username }}</h1>
|
<h1 class="page-header">{{ user.username }}</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
{{ user }}
|
{{ user }}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
<button type="button" class="btn btn-success pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||||
<h1 class="page-header">{% trans "Accounts" %}</h1>
|
<h1 class="page-header">{% trans "Accounts" %}</h1>
|
||||||
|
|
||||||
{% include 'errors.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<div id="{{ user.username }}" class="col-xs-6 col-sm-4">
|
<div id="{{ user.username }}" class="col-xs-6 col-sm-4">
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +10,12 @@ def users(request):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not request.user.is_authenticated():
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
users = User.objects.filter(is_staff=False, is_superuser=False)
|
users = User.objects.filter(is_staff=False, is_superuser=False)
|
||||||
|
|
||||||
return render(request, 'users.html', locals())
|
return render(request, 'users.html', locals())
|
||||||
|
@ -18,6 +26,12 @@ def user(request, user_id):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not request.user.is_authenticated():
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
user = User.objects.get(id=user_id)
|
user = User.objects.get(id=user_id)
|
||||||
|
|
||||||
return render(request, 'user.html', locals())
|
return render(request, 'user.html', locals())
|
|
@ -436,7 +436,7 @@ class wvmConnect(object):
|
||||||
for name in self.get_instances():
|
for name in self.get_instances():
|
||||||
dom = self.get_instance(name)
|
dom = self.get_instance(name)
|
||||||
mem = util.get_xml_path(dom.XMLDesc(0), "/domain/currentMemory")
|
mem = util.get_xml_path(dom.XMLDesc(0), "/domain/currentMemory")
|
||||||
mem = int(mem) * 1024
|
mem = int(mem) / 1024
|
||||||
cur_vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu/@current")
|
cur_vcpu = util.get_xml_path(dom.XMLDesc(0), "/domain/vcpu/@current")
|
||||||
if cur_vcpu:
|
if cur_vcpu:
|
||||||
vcpu = cur_vcpu
|
vcpu = cur_vcpu
|
||||||
|
|
|
@ -25,6 +25,7 @@ INSTALLED_APPS = (
|
||||||
'instances',
|
'instances',
|
||||||
'users',
|
'users',
|
||||||
'create',
|
'create',
|
||||||
|
'logs',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
|
|
|
@ -31,5 +31,6 @@ urlpatterns = patterns('',
|
||||||
|
|
||||||
url(r'^console/$', 'console.views.console', name='console'),
|
url(r'^console/$', 'console.views.console', name='console'),
|
||||||
url(r'^create/(\d+)/$', 'create.views.create_instance', name='create_instance'),
|
url(r'^create/(\d+)/$', 'create.views.create_instance', name='create_instance'),
|
||||||
|
url(r'^logs/$', 'logs.views.showlogs', name='showlogs'),
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue