diff options
author | Devin Carlen <devin.carlen@gmail.com> | 2011-09-27 10:46:10 -0700 |
---|---|---|
committer | Devin Carlen <devin.carlen@gmail.com> | 2011-09-27 10:46:10 -0700 |
commit | fadd6a54a9735392900e2c1cfe61eb43da5eb61c (patch) | |
tree | f47e4f3e26bda387c68e2d25c39d71c463b732d0 /django-openstack | |
parent | 0f67a2d8c0cee1ade2414f3ab1cc4a3a5b10296a (diff) | |
parent | 8b40139267bdae5c36a56d01eb968839b3a6a67c (diff) | |
download | horizon-fadd6a54a9735392900e2c1cfe61eb43da5eb61c.tar.gz |
Merge pull request #133 from cloudbuilders/user_list
user listing improvements
Diffstat (limited to 'django-openstack')
4 files changed, 13 insertions, 14 deletions
diff --git a/django-openstack/django_openstack/syspanel/views/tenants.py b/django-openstack/django_openstack/syspanel/views/tenants.py index 271cf1857..cf72d830a 100644 --- a/django-openstack/django_openstack/syspanel/views/tenants.py +++ b/django-openstack/django_openstack/syspanel/views/tenants.py @@ -59,7 +59,7 @@ class AddUser(forms.SelfHandlingForm): except api_exceptions.ApiException, e: messages.error(request, 'Unable to create user association: %s' % (e.message)) - return redirect('syspanel_tenants') + return redirect('syspanel_tenant_users', tenant_id=data['tenant']) class RemoveUser(forms.SelfHandlingForm): @@ -79,7 +79,7 @@ class RemoveUser(forms.SelfHandlingForm): except api_exceptions.ApiException, e: messages.error(request, 'Unable to create tenant: %s' % (e.message)) - return redirect('syspanel_tenants') + return redirect('syspanel_tenant_users', tenant_id=data['tenant']) class CreateTenant(forms.SelfHandlingForm): @@ -243,22 +243,15 @@ def users(request, tenant_id): users = api.account_api(request).users.get_for_tenant(tenant_id) all_users = api.account_api(request).users.list() - new_user_ids = [] user_ids = [u.id for u in users] - all_user_ids = [u.id for u in all_users] - for uid in all_user_ids: - if not uid in user_ids: - new_user_ids.append(uid) - for i in user_ids: - if i in new_user_ids: - new_user_ids.remove(i) + new_users = [u for u in all_users if not u.id in user_ids] return render_to_response( 'django_openstack/syspanel/tenants/users.html', { 'add_user_form': add_user_form, 'remove_user_form': remove_user_form, 'tenant_id': tenant_id, 'users': users, - 'new_users': new_user_ids, + 'new_users': new_users, }, context_instance=template.RequestContext(request)) diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html index 44f70148b..5893467d7 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/_add_user.html @@ -3,7 +3,7 @@ {% for hidden in form.hidden_fields %} {{hidden}} {% endfor %} - <input name="user" type="hidden" value="{{user}}" /> + <input name="user" type="hidden" value="{{user.id}}" /> <input name="tenant" type="hidden" value="{{tenant_id}}" /> - <input id="add_tenant_user_{{user}}" class="add" ttle="User: {{user}}" type="submit" value="Add" /> + <input id="add_tenant_user_{{user.id}}" class="add" title="User: {{user.id}}" type="submit" value="Add" /> </form> diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html index c77ffde38..b60bac78c 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/tenants/users.html @@ -18,6 +18,7 @@ {% if users %} <table class="wide"> <tr id='headings'> + <th>ID</th> <th>Name</th> <th>Email</th> <th>Actions</th> @@ -26,6 +27,7 @@ {% for user in users %} <tr class="{% cycle 'odd' 'even' %}"> <td>{{user.id}}</td> + <td>{{user.name}}</td> <td>{{user.email}}</td> <td id="actions"> <ul> @@ -46,13 +48,15 @@ <h3>Add new users</h3> <table class="wide"> <tr id='headings'> + <th>ID</th> <th>Name</th> <th>Actions</th> </tr> <tbody class='main'> {% for user in new_users %} <tr class="{% cycle 'odd' 'even' %}"> - <td>{{user}}</td> + <td>{{user.id}}</td> + <td>{{user.name}}</td> <td id="actions"> <ul> <li class="form">{% include "django_openstack/syspanel/tenants/_add_user.html" with form=add_user_form %}</li> diff --git a/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html b/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html index d3237c7c4..7b622dfe7 100644 --- a/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html +++ b/django-openstack/django_openstack/templates/django_openstack/syspanel/users/index.html @@ -17,6 +17,7 @@ <table class="wide"> <tr> <th>ID</th> + <th>Name</th> <th>Email</th> <th>Default Tenant</th> <th>Options</th> @@ -24,6 +25,7 @@ {% for user in users %} <tr class="{% cycle 'odd' 'even' %}"> <td>{{user.id}}{% if not user.enabled %} (disabled){% endif %}</td> + <td>{{user.name}}</td> <td>{{user.email}}</td> <td>{{user.tenantId}}</td> <td id="actions"> |