partially working user management
This commit is contained in:
@@ -2,6 +2,7 @@ from django.conf.urls.defaults import *
|
||||
from django.conf import settings
|
||||
|
||||
INSTANCES = r'^instances/(?P<instance_id>[^/]+)/%s$'
|
||||
USERS = r'^users/(?P<user_id>[^/]+)/%s$'
|
||||
|
||||
urlpatterns = patterns('django_openstack.syspanel.views.instances',
|
||||
url(r'^usage/(?P<tenant_id>[^/]+)$', 'tenant_usage',
|
||||
@@ -24,6 +25,11 @@ urlpatterns += patterns('django_openstack.syspanel.views.flavors',
|
||||
url(r'^flavors/create/$', 'create', name='syspanel_flavors_create'),
|
||||
)
|
||||
|
||||
urlpatterns += patterns('django_openstack.syspanel.views.users',
|
||||
url(r'^users/$', 'index', name='syspanel_users'),
|
||||
url(USERS % 'update', 'update', name='syspanel_users_update'),
|
||||
url(r'^users/create$', 'create', name='syspanel_users_create'),
|
||||
)
|
||||
|
||||
urlpatterns_OLD = patterns('',
|
||||
url(r'^$', 'django_openstack.syspanel.views.home.index', name='syspanel_index'),
|
||||
|
||||
@@ -173,5 +173,3 @@ def index(request):
|
||||
'terminate_form': terminate_form,
|
||||
'reboot_form': reboot_form,
|
||||
}, context_instance=template.RequestContext(request))
|
||||
|
||||
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<li><a {% if current_sidebar == "instances" %} class="active" {% endif %} href="{% url syspanel_instances %}">Instances</a></li>
|
||||
<li><a {% if current_sidebar == "images" %} class="active" {% endif %} href="{% url syspanel_images %}">Images</a></li>
|
||||
<li><a {% if current_sidebar == "flavors" %} class="active" {% endif %} href="{% url syspanel_flavors %}">Flavors</a></li>
|
||||
<li><a {% if current_sidebar == "users" %} class="active" {% endif %} href="{% url syspanel_users %}">Users</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<form id="form_user_delete{{user.id}}" class="form-user-delete" method="post">
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
<input name="user" type="hidden" value="{{user.id}}" />
|
||||
<input id="enable_{{user.id}}" class="enable" type="submit" value="Delete" />
|
||||
</form>
|
||||
10
openstack-dashboard/dashboard/templates/_user_form.html
Normal file
10
openstack-dashboard/dashboard/templates/_user_form.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<form id="user_form" action="" method="post">
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
{{ field.label_tag }}
|
||||
{{ field.errors }}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
<input type="submit" value="Create User" class="large-rounded" />
|
||||
</form>
|
||||
@@ -0,0 +1,19 @@
|
||||
{% if user.enabled %}
|
||||
<form id="form_user_disable_{{user.id}}" class="form-user-disable" method="post">
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
<input name="user" type="hidden" value="{{user.id}}" />
|
||||
<input id="disable_{{user.id}}" class="disable" type="submit" value="Disable" />
|
||||
</form>
|
||||
{% else %}
|
||||
<form id="form_user_enable_{{user.id}}" class="form-user-enable" method="post">
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
<input name="user" type="hidden" value="{{user.id}}" />
|
||||
<input id="enable_{{user.id}}" class="enable" type="submit" value="Enable" />
|
||||
</form>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,37 @@
|
||||
{% extends 'syspanel_base.html' %}
|
||||
{# list of user's instances #}
|
||||
{# standard nav, sidebar, list of instances in main #}
|
||||
|
||||
{% block sidebar %}
|
||||
{% with current_sidebar="images" %}
|
||||
{{block.super}}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div id='page_header'>
|
||||
<h2><span>System Panel:</span> Users </h2>
|
||||
<p class='desc'><span>—</span> Create a User </p>
|
||||
</div>
|
||||
|
||||
{% include "_messages.html" %}
|
||||
|
||||
|
||||
<div class="main_content">
|
||||
<div class="dash_block wide form">
|
||||
<div class='title_block'>
|
||||
<h3>Create User</h3>
|
||||
</div>
|
||||
|
||||
{% include '_user_form.html' %}
|
||||
|
||||
<div class="right">
|
||||
<h3>Description:</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vitae est urna. Phasellus sagittis, sem posuere hendrerit mattis, velit risus viverra enim, tempus dapibus sem turpis ac erat.</p>
|
||||
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis ligula nec lacus mollis eu laoreet lectus porta. </p>
|
||||
<p>Sed iaculis mauris et est consectetur egestas. Praesent dolor libero, semper sed aliquet</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,39 @@
|
||||
{% extends 'syspanel_base.html' %}
|
||||
{# list of user's instances #}
|
||||
{# standard nav, sidebar, list of instances in main #}
|
||||
|
||||
{% block sidebar %}
|
||||
{% with current_sidebar="images" %}
|
||||
{{block.super}}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div id='page_header'>
|
||||
<h2><span>System Panel:</span> Users </h2>
|
||||
<p class='desc'><span>—</span> Update User </p>
|
||||
</div>
|
||||
|
||||
{% include "_messages.html" %}
|
||||
|
||||
|
||||
<div class="main_content">
|
||||
<div class="dash_block wide form">
|
||||
<div class='title_block'>
|
||||
<h3>Create User</h3>
|
||||
</div>
|
||||
FIXME!!! this doesn't work correctly
|
||||
|
||||
{% include '_user_form.html' %}
|
||||
|
||||
<div class="right">
|
||||
<h3>Description:</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus vitae est urna. Phasellus sagittis, sem posuere hendrerit mattis, velit risus viverra enim, tempus dapibus sem turpis ac erat.</p>
|
||||
<p>Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis ligula nec lacus mollis eu laoreet lectus porta. </p>
|
||||
<p>Sed iaculis mauris et est consectetur egestas. Praesent dolor libero, semper sed aliquet</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
59
openstack-dashboard/dashboard/templates/syspanel_users.html
Normal file
59
openstack-dashboard/dashboard/templates/syspanel_users.html
Normal file
@@ -0,0 +1,59 @@
|
||||
{% extends 'syspanel_base.html' %}
|
||||
{# list of user's instances #}
|
||||
{# standard nav, sidebar, list of instances in main #}
|
||||
|
||||
{% block sidebar %}
|
||||
{% with current_sidebar="images" %}
|
||||
{{block.super}}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div id='page_header'>
|
||||
<h2><span>System Panel:</span> Users</h2>
|
||||
<p class='desc'><span>—</span> Create, Edit, Upload, and Delete Users.</p>
|
||||
</div>
|
||||
|
||||
{% include "_messages.html" %}
|
||||
|
||||
<div class="main_content">
|
||||
<div class='table_title wide'>
|
||||
<h3>Users</h3>
|
||||
<a class="refresh" href="{% url syspanel_users %}">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>ID</th>
|
||||
<th>Email</th>
|
||||
<th>Default Tenant</th>
|
||||
<th>Options</th>
|
||||
</tr>
|
||||
{% for user in users %}
|
||||
<tr class="{% cycle 'odd' 'even' %}">
|
||||
<td>{{user.id}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
<td>{{user.tenantId}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
<li>{% include "_user_delete.html" with form=user_delete_form %}</li>
|
||||
<li>{% include "_user_toggle_enabled.html" with form=user_toggle_enabled_form %}</li>
|
||||
<li><a href="{% url syspanel_users_update user.id %}">Update</a></li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<a id="user_create_link" href="{% url syspanel_users_create %}">Create New User >></a>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user