From ac30be57ae4c02bcd122af28f3d0d73eafe34ac6 Mon Sep 17 00:00:00 2001 From: wangyao Date: Wed, 13 Dec 2017 16:28:27 +0800 Subject: [PATCH] Fix users page display error According bug description, the users page show error with host and dbs. The cause of the problem is we can not only use user_name as id, it is not unique. Now I changed the id as the combination of user_name and user_host. Change-Id: I28136de2b7c79633dd51bdea5d704038c29aa516 Closes-Bug: #1737695 --- trove_dashboard/content/databases/tables.py | 3 ++- trove_dashboard/content/databases/tests.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/trove_dashboard/content/databases/tables.py b/trove_dashboard/content/databases/tables.py index f1e3039a..238c5a5d 100644 --- a/trove_dashboard/content/databases/tables.py +++ b/trove_dashboard/content/databases/tables.py @@ -692,7 +692,8 @@ class UsersTable(tables.DataTable): row_actions = [EditUser, ManageAccess, DeleteUser] def get_object_id(self, datum): - return datum.name + obj_id = datum.name + "@" + datum.host + return obj_id class DatabaseTable(tables.DataTable): diff --git a/trove_dashboard/content/databases/tests.py b/trove_dashboard/content/databases/tests.py index 522aa804..dc6cb423 100644 --- a/trove_dashboard/content/databases/tests.py +++ b/trove_dashboard/content/databases/tests.py @@ -635,7 +635,7 @@ class DatabaseTests(test.TestCase): database_id = database.id # Instead of using the user's ID, the api uses the user's name. BOOO! - user_id = user.name + user_id = user.name + "@" + user.host # views.py: DetailView.get_data api.trove.instance_get(IsA(http.HttpRequest), IsA(six.text_type))\