[ARVADOS-WORKBENCH2] updated: 1.3.1-443-gc401fa41

Git user git at public.curoverse.com
Thu Apr 25 08:31:30 UTC 2019


Summary of changes:
 src/store/users/user-panel-middleware-service.ts | 33 +++++++++++++++++++-----
 src/store/users/users-actions.ts                 |  2 +-
 2 files changed, 27 insertions(+), 8 deletions(-)

       via  c401fa41f85e75f25814338f309df98f579a0627 (commit)
      from  8aefa4e5d201f77eecb7cfe21a690cb9db1c01e7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit c401fa41f85e75f25814338f309df98f579a0627
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Thu Apr 25 10:31:17 2019 +0200

    refs #14859-admin-filtering-by-name-inside-user-panel
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/users/user-panel-middleware-service.ts b/src/store/users/user-panel-middleware-service.ts
index bc4bb130..cffcce4d 100644
--- a/src/store/users/user-panel-middleware-service.ts
+++ b/src/store/users/user-panel-middleware-service.ts
@@ -27,24 +27,43 @@ export class UserMiddlewareService extends DataExplorerMiddlewareService {
         const state = api.getState();
         const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
         try {
-            const response = await this.services.userService.list(getParams(dataExplorer));
-            api.dispatch(updateResources(response.items));
-            api.dispatch(setItems(response));
+            const responseFirstName = await this.services.userService.list(getParamsFirstName(dataExplorer));
+            if (responseFirstName.itemsAvailable) {
+                api.dispatch(updateResources(responseFirstName.items));
+                api.dispatch(setItems(responseFirstName));
+            } else {
+                const responseLastName = await this.services.userService.list(getParamsLastName(dataExplorer));
+                api.dispatch(updateResources(responseLastName.items));
+                api.dispatch(setItems(responseLastName));
+            }
         } catch {
             api.dispatch(couldNotFetchUsers());
         }
     }
 }
 
-export const getParams = (dataExplorer: DataExplorer) => ({
+const getParamsFirstName = (dataExplorer: DataExplorer) => ({
     ...dataExplorerToListParams(dataExplorer),
     order: getOrder(dataExplorer),
-    filters: getFilters(dataExplorer)
+    filters: getFiltersFirstName(dataExplorer)
 });
 
-export const getFilters = (dataExplorer: DataExplorer) => {
+const getParamsLastName = (dataExplorer: DataExplorer) => ({
+    ...dataExplorerToListParams(dataExplorer),
+    order: getOrder(dataExplorer),
+    filters: getFiltersLastName(dataExplorer)
+});
+
+const getFiltersFirstName = (dataExplorer: DataExplorer) => {
+    const filters = new FilterBuilder()
+        .addILike("firstName", dataExplorer.searchValue)
+        .getFilters();
+    return filters;
+};
+
+const getFiltersLastName = (dataExplorer: DataExplorer) => {
     const filters = new FilterBuilder()
-        .addILike("username", dataExplorer.searchValue)
+        .addILike("lastName", dataExplorer.searchValue)
         .getFilters();
     return filters;
 };
diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index 066aa80b..caf466f7 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -12,7 +12,7 @@ import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions
 import { UserResource } from "~/models/user";
 import { getResource } from '~/store/resources/resources';
 import { navigateToProject, navigateToUsers, navigateToRootProject } from "~/store/navigation/navigation-action";
-import { saveApiToken, getUserDetails } from '~/store/auth/auth-action';
+import { saveApiToken } from '~/store/auth/auth-action';
 
 export const USERS_PANEL_ID = 'usersPanel';
 export const USER_ATTRIBUTES_DIALOG = 'userAttributesDialog';

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list