From 78d4d8b490b37d837010825a640ecf472659305d Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Thu, 1 Jun 2017 10:48:58 -0400 Subject: [PATCH 1/3] add primefaces datatable for users #3614 --- src/main/java/Bundle.properties | 3 ++ .../dashboard/DashboardUsersPage.java | 20 +++++++++ src/main/webapp/dashboard-users.xhtml | 43 +++++++++++++++++++ src/main/webapp/dashboard.xhtml | 15 +++++++ 4 files changed, 81 insertions(+) create mode 100644 src/main/java/edu/harvard/iq/dataverse/dashboard/DashboardUsersPage.java create mode 100644 src/main/webapp/dashboard-users.xhtml diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index 5c3fd33a754..efa15e528f8 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -329,6 +329,9 @@ dashboard.card.harvestingserver.sets={0, choice, 0#Sets|1#Set|2#Sets} dashboard.card.harvestingserver.btn.manage=Manage Server dashboard.card.metadataexport.header=Metadata Export dashboard.card.metadataexport.message=Dataset metadata export is only available through the {0} API. Learn more in the {0} {1}API Guide{2}. +dashboard.card.users.header=Users +dashboard.card.users.message=List and manage users. +dashboard.card.users.btn.manage=Manage Users #harvestclients.xhtml harvestclients.title=Manage Harvesting Clients diff --git a/src/main/java/edu/harvard/iq/dataverse/dashboard/DashboardUsersPage.java b/src/main/java/edu/harvard/iq/dataverse/dashboard/DashboardUsersPage.java new file mode 100644 index 00000000000..9b40ed91fb4 --- /dev/null +++ b/src/main/java/edu/harvard/iq/dataverse/dashboard/DashboardUsersPage.java @@ -0,0 +1,20 @@ +package edu.harvard.iq.dataverse.dashboard; + +import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean; +import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; +import java.util.List; +import javax.ejb.EJB; +import javax.faces.view.ViewScoped; +import javax.inject.Named; + +@ViewScoped +@Named +public class DashboardUsersPage implements java.io.Serializable { + + @EJB + AuthenticationServiceBean authenticationService; + + public List getAuthenticatedUsers() { + return authenticationService.findAllAuthenticatedUsers(); + } +} diff --git a/src/main/webapp/dashboard-users.xhtml b/src/main/webapp/dashboard-users.xhtml new file mode 100644 index 00000000000..3de282bad0b --- /dev/null +++ b/src/main/webapp/dashboard-users.xhtml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/dashboard.xhtml b/src/main/webapp/dashboard.xhtml index ac170efe593..001b75f4950 100644 --- a/src/main/webapp/dashboard.xhtml +++ b/src/main/webapp/dashboard.xhtml @@ -102,6 +102,21 @@ +
+
+

#{bundle['dashboard.card.users.header']}

+
+

#{bundle['dashboard.card.users.message']}

+
+ +
+
From 4cafe569df9a5df43db7d9a48c2738dff06c055d Mon Sep 17 00:00:00 2001 From: Michael Heppler Date: Thu, 1 Jun 2017 15:17:05 -0400 Subject: [PATCH 2/3] Added static placeholder for filter and pagination to Manage Users pg. [ref #3614] --- src/main/java/Bundle.properties | 2 +- src/main/webapp/dashboard-users.xhtml | 104 +++++++++++++++++++++----- src/main/webapp/dashboard.xhtml | 14 +++- 3 files changed, 100 insertions(+), 20 deletions(-) diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index efa15e528f8..1875c69452c 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -330,7 +330,7 @@ dashboard.card.harvestingserver.btn.manage=Manage Server dashboard.card.metadataexport.header=Metadata Export dashboard.card.metadataexport.message=Dataset metadata export is only available through the {0} API. Learn more in the {0} {1}API Guide{2}. dashboard.card.users.header=Users -dashboard.card.users.message=List and manage users. +dashboard.card.users.empty=No users have been created. dashboard.card.users.btn.manage=Manage Users #harvestclients.xhtml diff --git a/src/main/webapp/dashboard-users.xhtml b/src/main/webapp/dashboard-users.xhtml index 3de282bad0b..1b3a4713e9a 100644 --- a/src/main/webapp/dashboard-users.xhtml +++ b/src/main/webapp/dashboard-users.xhtml @@ -6,10 +6,8 @@ xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:p="http://primefaces.org/ui" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"> - - @@ -21,21 +19,93 @@ - - - - - - - - - - - - - - - + +
+
+
+ + + + Filter + + +
+
+
+
    + +
  • + + + +
  • +
  • + + + +
  • + + +
  • + + + + + + + + + + + + + + + + +
  • +
    +
    +
  • + + + +
  • +
  • + + + +
  • +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/webapp/dashboard.xhtml b/src/main/webapp/dashboard.xhtml index 001b75f4950..4e4a08f3ea1 100644 --- a/src/main/webapp/dashboard.xhtml +++ b/src/main/webapp/dashboard.xhtml @@ -105,8 +105,18 @@

#{bundle['dashboard.card.users.header']}

-
-

#{bundle['dashboard.card.users.message']}

+
+
+

#{bundle['dashboard.card.users.empty']}

+
+
+ +

Users

+
+
+ +

Super-Users

+
From f1d7e7e0343513ec5c508bfad9f910612bfaf4e1 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Thu, 1 Jun 2017 15:24:02 -0400 Subject: [PATCH 3/3] add 14,000 users to test performance #3614 --- .../edu/harvard/iq/dataverse/api/AdminIT.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/AdminIT.java b/src/test/java/edu/harvard/iq/dataverse/api/AdminIT.java index 4367711f5f5..654cc770b12 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/AdminIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/AdminIT.java @@ -301,4 +301,24 @@ public void testFindPermissonsOn() { assertEquals(200, deleteSuperuser.getStatusCode()); } + @Test + public void testCreateManyUsers() { + boolean disabled = true; + if (disabled) { + return; + } + // FIXME: JSF datatable performance is horrific with this many users. There may be code + // in DVN 3 we can grab. Otherwise, we should look into + // https://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml + // and/or these answers from BalusC: + // https://stackoverflow.com/questions/2372648/large-jsf-datatable-backed-by-database-that-can-handle-paging-sorting + // https://stackoverflow.com/questions/1986998/resultset-to-pagination + int numUsersInProdAtHarvard = 14000; + int numUsersToCreate = numUsersInProdAtHarvard; + for (int i = 0; i < numUsersToCreate; i++) { + System.out.println("creating user " + i); + Response createRandomUserResponse = UtilIT.createRandomUser(); + } + } + }