added quotas to syspanel

This commit is contained in:
Jake Dahn 2011-07-11 16:16:07 -07:00
parent 10557dc50a
commit a82c99bbf5
4 changed files with 81 additions and 0 deletions

View File

@ -26,6 +26,10 @@ urlpatterns += patterns('django_openstack.syspanel.views.images',
)
urlpatterns += patterns('django_openstack.syspanel.views.quotas',
url(r'^quotas/$', 'index', name='syspanel_quotas'),
)
urlpatterns += patterns('django_openstack.syspanel.views.flavors',
url(r'^flavors/$', 'index', name='syspanel_flavors'),
url(r'^flavors/create/$', 'create', name='syspanel_flavors_create'),

View File

@ -0,0 +1,28 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
from operator import itemgetter
from django import template
from django import http
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.shortcuts import render_to_response
from openstackx.api import exceptions as api_exceptions
from django_openstack import api
from django_openstack import forms
@login_required
def index(request):
quotas = api.admin_api(request).quota_sets.get(True)._info
quotas['ram'] = int(quotas['ram']) / 100
quotas.pop('id')
messages.success(request, quotas)
return render_to_response('syspanel_quotas.html',{
'quotas': quotas,
}, context_instance = template.RequestContext(request))

View File

@ -8,5 +8,6 @@
<li><a {% if current_sidebar == "images" %} class="active" {% endif %} href="{% url syspanel_images %}">Images</a></li>
<li><a {% if current_sidebar == "tenants" %} class="active" {% endif %} href="{% url syspanel_tenants %}">Tenants</a></li>
<li><a {% if current_sidebar == "users" %} class="active" {% endif %} href="{% url syspanel_users %}">Users</a></li>
<li><a {% if current_sidebar == "quotas" %} class="active" {% endif %} href="{% url syspanel_quotas %}">Quotas</a></li>
</ul>
</div>

View File

@ -0,0 +1,48 @@
{% extends 'syspanel_base.html' %}
{# list of tenants #}
{# standard nav, sidebar, list of instances in main #}
{% block sidebar %}
{% with current_sidebar="quotas" %}
{{block.super}}
{% endwith %}
{% endblock %}
{% block main %}
<div id='page_header'>
<h2><span>System Panel:</span> Quotas</h2>
<p class='desc'><span>&mdash;</span>Default Quotas</p>
</div>
{% include "_messages.html" %}
<div class="main_content">
<div class='table_title wide'>
<h3>Default Quotas</h3>
<a class="refresh" title="Refresh" href="{% url syspanel_tenants %}">Refresh List</a>
<div class='search'>
<form action='' method='post'>
<fieldset>
<label for='table_search'>Search</label>
<input id='table_search' name='search' type='text' value='' />
</fieldset>
</form>
</div>
</div>
<table class="wide">
<tr>
<th>Quota Name</th>
<th>Limit</th>
</tr>
{% for name,value in quotas.items %}
<tr>
<td>{{name}}</td>
<td>{{value}}</td>
</tr>
{% endfor %}
</table>
<a id="tenant_create_link" class="action_link large-rounded" href="{% url syspanel_tenants_create %}">Create New Tenant </a>
</div>
{% endblock %}