From 2a3693a55f1b26379f188e3d5bc6e0d4ae9ebee1 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Wed, 11 Dec 2024 11:59:16 +0200 Subject: [PATCH 1/7] Add friendly name to list group members response --- contrib/auth/acl/controller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/auth/acl/controller.go b/contrib/auth/acl/controller.go index 2917f5b1a8b..57a40909a48 100644 --- a/contrib/auth/acl/controller.go +++ b/contrib/auth/acl/controller.go @@ -151,6 +151,7 @@ func (c *Controller) ListGroupMembers(w http.ResponseWriter, r *http.Request, gr Username: u.Username, CreationDate: u.CreatedAt.Unix(), Email: u.Email, + FriendlyName: u.FriendlyName, }) } writeResponse(w, http.StatusOK, response) From 2331a7b7292aca3f40807f7ba60abf8b6970a992 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Wed, 11 Dec 2024 16:26:42 +0200 Subject: [PATCH 2/7] Add friendly name to list group members response --- pkg/api/controller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 7004db34abe..89133c4d407 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -1112,6 +1112,7 @@ func (c *Controller) ListGroupMembers(w http.ResponseWriter, r *http.Request, gr Id: u.Username, Email: u.Email, CreationDate: u.CreatedAt.Unix(), + FriendlyName: u.FriendlyName, }) } writeResponse(w, r, http.StatusOK, response) From 8892f3ca29e76efa6ee94d03e7de961d73f7c12b Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Thu, 12 Dec 2024 13:00:31 +0200 Subject: [PATCH 3/7] Changed UI to display user friendly name when possible --- webui/src/lib/components/auth/forms.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/webui/src/lib/components/auth/forms.jsx b/webui/src/lib/components/auth/forms.jsx index e5771961b53..84b9f80a015 100644 --- a/webui/src/lib/components/auth/forms.jsx +++ b/webui/src/lib/components/auth/forms.jsx @@ -12,6 +12,7 @@ import {Checkbox, DataTable, DebouncedFormControl, AlertError, Loading} from ".. const resolveEntityDisplayName = (ent) => { // for users if (ent?.email?.length) return ent.email; + if (ent?.friendly_name?.length) return ent.friendly_name; // for groups if (ent?.name?.length) return ent.name; return ent.id; From 9aa365dc2978d06daf256930cf5981cc99de2224 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Mon, 16 Dec 2024 15:36:53 +0200 Subject: [PATCH 4/7] Searching users in UI --- webui/src/lib/components/auth/forms.jsx | 6 ++-- webui/src/pages/auth/groups/group/members.jsx | 32 ++++++++++++++++--- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/webui/src/lib/components/auth/forms.jsx b/webui/src/lib/components/auth/forms.jsx index 84b9f80a015..c3a1c640a94 100644 --- a/webui/src/lib/components/auth/forms.jsx +++ b/webui/src/lib/components/auth/forms.jsx @@ -9,7 +9,7 @@ import {SearchIcon} from "@primer/octicons-react"; import {useAPI} from "../../hooks/api"; import {Checkbox, DataTable, DebouncedFormControl, AlertError, Loading} from "../controls"; -const resolveEntityDisplayName = (ent) => { +export const ResolveEntityDisplayName = (ent) => { // for users if (ent?.email?.length) return ent.email; if (ent?.friendly_name?.length) return ent.friendly_name; @@ -50,7 +50,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, addText = "Add", onAdd={() => setSelected([...selected, ent])} onRemove={() => setSelected(selected.filter(selectedEnt => selectedEnt.id !== ent.id))} name={'selected'}/>, - {resolveEntityDisplayName(ent)} + {ResolveEntityDisplayName(ent)} ]}/>
@@ -59,7 +59,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, addText = "Add", Selected: {(selected.map(item => ( - {resolveEntityDisplayName(item)} + {ResolveEntityDisplayName(item)} )))}

diff --git a/webui/src/pages/auth/groups/group/members.jsx b/webui/src/pages/auth/groups/group/members.jsx index f8cab5ed014..b6d0af27ea5 100644 --- a/webui/src/pages/auth/groups/group/members.jsx +++ b/webui/src/pages/auth/groups/group/members.jsx @@ -4,9 +4,9 @@ import Button from "react-bootstrap/Button"; import {GroupHeader} from "../../../../lib/components/auth/nav"; import {useAPIWithPagination} from "../../../../lib/hooks/api"; -import {auth} from "../../../../lib/api"; +import {auth, MAX_LISTING_AMOUNT} from "../../../../lib/api"; import {Paginator} from "../../../../lib/components/pagination"; -import {AttachModal} from "../../../../lib/components/auth/forms"; +import {AttachModal, ResolveEntityDisplayName} from "../../../../lib/components/auth/forms"; import {ConfirmationButton} from "../../../../lib/components/modals"; import { ActionGroup, @@ -26,15 +26,37 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { const [refresh, setRefresh] = useState(false); const [showAddModal, setShowAddModal] = useState(false); const [attachError, setAttachError] = useState(null); - + const [allUsers, setAllUsers] = useState([]); const {results, loading, error, nextPage} = useAPIWithPagination(() => { return auth.listGroupMembers(groupId, after); }, [groupId, after, refresh]); - useEffect(() => { setAttachError(null); }, [refresh]); + const setAllUsersFromLakeFS = async () => { + if (allUsers.length > 0) { + return allUsers + } + after = "" + let hasMore = true + let usersList = [] + do { + let results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); + usersList = usersList.concat(results.results); + after = results.pagination.next_offset; + hasMore = results.pagination.has_more; + } + while (hasMore); + usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); + setAllUsers(usersList) + return usersList + } + const searchUsers = async (prefix, maxResults) => { + let allUsersList = await setAllUsersFromLakeFS() + let filteredUsers = allUsersList.filter(user => ResolveEntityDisplayName(user).startsWith(prefix)); + return filteredUsers.slice(0, maxResults); + }; let content; if (loading) content = ; else if (error) content= ; @@ -75,7 +97,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { filterPlaceholder={'Find User...'} modalTitle={'Add to Group'} addText={'Add to Group'} - searchFn={prefix => auth.listUsers(prefix, "", 5).then(res => res.results)} + searchFn={prefix => searchUsers(prefix, 5).then(res => res)} onHide={() => setShowAddModal(false)} onAttach={(selected) => { Promise.all(selected.map(user => auth.addUserToGroup(user.id, groupId))) From dd0f625e5f65e95634a45a18a3c3e6c3db55da71 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Mon, 16 Dec 2024 16:59:38 +0200 Subject: [PATCH 5/7] Error handling --- webui/src/pages/auth/groups/group/members.jsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/webui/src/pages/auth/groups/group/members.jsx b/webui/src/pages/auth/groups/group/members.jsx index b6d0af27ea5..66df2c76ca9 100644 --- a/webui/src/pages/auth/groups/group/members.jsx +++ b/webui/src/pages/auth/groups/group/members.jsx @@ -41,16 +41,20 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { after = "" let hasMore = true let usersList = [] - do { - let results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); - usersList = usersList.concat(results.results); - after = results.pagination.next_offset; - hasMore = results.pagination.has_more; + try { + do { + const results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); + usersList = usersList.concat(results.results); + after = results.pagination.next_offset; + hasMore = results.pagination.has_more; + } while (hasMore); + usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); + setAllUsers(usersList); + return usersList; + } catch (error) { + console.error("Error fetching users:", error); + return []; } - while (hasMore); - usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); - setAllUsers(usersList) - return usersList } const searchUsers = async (prefix, maxResults) => { let allUsersList = await setAllUsersFromLakeFS() From 609d471a424d4c277e77a79d17da1215f4bb4d3f Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Tue, 17 Dec 2024 14:32:54 +0200 Subject: [PATCH 6/7] Review changes --- webui/src/lib/components/auth/forms.jsx | 16 ++++---------- webui/src/lib/utils.ts | 2 +- webui/src/pages/auth/credentials.jsx | 4 ++-- webui/src/pages/auth/groups/group/members.jsx | 21 ++++++++++--------- webui/src/pages/auth/users/index.jsx | 4 ++-- webui/src/pages/auth/users/user/groups.jsx | 10 ++++++++- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/webui/src/lib/components/auth/forms.jsx b/webui/src/lib/components/auth/forms.jsx index c3a1c640a94..8f2b087952b 100644 --- a/webui/src/lib/components/auth/forms.jsx +++ b/webui/src/lib/components/auth/forms.jsx @@ -9,16 +9,8 @@ import {SearchIcon} from "@primer/octicons-react"; import {useAPI} from "../../hooks/api"; import {Checkbox, DataTable, DebouncedFormControl, AlertError, Loading} from "../controls"; -export const ResolveEntityDisplayName = (ent) => { - // for users - if (ent?.email?.length) return ent.email; - if (ent?.friendly_name?.length) return ent.friendly_name; - // for groups - if (ent?.name?.length) return ent.name; - return ent.id; -} - -export const AttachModal = ({ show, searchFn, onAttach, onHide, addText = "Add", + +export const AttachModal = ({ show, searchFn, onAttach, onHide, resolveEntityFN = (ent => ent.id), addText = "Add", emptyState = 'No matches', modalTitle = 'Add', headers = ['Select', 'ID'], filterPlaceholder = 'Filter...'}) => { const search = useRef(null); @@ -50,7 +42,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, addText = "Add", onAdd={() => setSelected([...selected, ent])} onRemove={() => setSelected(selected.filter(selectedEnt => selectedEnt.id !== ent.id))} name={'selected'}/>, - {ResolveEntityDisplayName(ent)} + {resolveEntityFN(ent)} ]}/>
@@ -59,7 +51,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, addText = "Add", Selected: {(selected.map(item => ( - {ResolveEntityDisplayName(item)} + {resolveEntityFN(item)} )))}

diff --git a/webui/src/lib/utils.ts b/webui/src/lib/utils.ts index 3be59c67120..266dfbd4817 100644 --- a/webui/src/lib/utils.ts +++ b/webui/src/lib/utils.ts @@ -4,7 +4,7 @@ interface User { friendly_name: string; } -export const resolveDisplayName = (user: User): string => { +export const resolveUserDisplayName = (user: User): string => { if (!user) return ""; if (user?.email?.length) return user.email; if (user?.friendly_name?.length) return user.friendly_name; diff --git a/webui/src/pages/auth/credentials.jsx b/webui/src/pages/auth/credentials.jsx index 344ab46c146..33dab61cc7c 100644 --- a/webui/src/pages/auth/credentials.jsx +++ b/webui/src/pages/auth/credentials.jsx @@ -12,7 +12,7 @@ import {auth} from "../../lib/api"; import {useState} from "react"; import {CredentialsShowModal, CredentialsTable} from "../../lib/components/auth/credentials"; import {useRouter} from "../../lib/hooks/router"; -import {resolveDisplayName} from "../../lib/utils"; +import {resolveUserDisplayName} from "../../lib/utils"; const CredentialsContainer = () => { const router = useRouter(); @@ -40,7 +40,7 @@ const CredentialsContainer = () => { Create a new Access Key for user {resolveDisplayName(user)}?} + msg={Create a new Access Key for user {resolveUserDisplayName(user)}?} onConfirm={hide => { createKey() .then(key => { setCreatedKey(key) }) diff --git a/webui/src/pages/auth/groups/group/members.jsx b/webui/src/pages/auth/groups/group/members.jsx index 66df2c76ca9..c7c9fe9842c 100644 --- a/webui/src/pages/auth/groups/group/members.jsx +++ b/webui/src/pages/auth/groups/group/members.jsx @@ -6,7 +6,7 @@ import {GroupHeader} from "../../../../lib/components/auth/nav"; import {useAPIWithPagination} from "../../../../lib/hooks/api"; import {auth, MAX_LISTING_AMOUNT} from "../../../../lib/api"; import {Paginator} from "../../../../lib/components/pagination"; -import {AttachModal, ResolveEntityDisplayName} from "../../../../lib/components/auth/forms"; +import {AttachModal} from "../../../../lib/components/auth/forms"; import {ConfirmationButton} from "../../../../lib/components/modals"; import { ActionGroup, @@ -19,7 +19,7 @@ import { } from "../../../../lib/components/controls"; import {useRouter} from "../../../../lib/hooks/router"; import {Link} from "../../../../lib/components/nav"; -import {resolveDisplayName} from "../../../../lib/utils"; +import {resolveUserDisplayName} from "../../../../lib/utils"; const GroupMemberList = ({ groupId, after, onPaginate }) => { @@ -34,7 +34,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { setAttachError(null); }, [refresh]); - const setAllUsersFromLakeFS = async () => { + const allUsersFromLakeFS = async (resolveUserDisplayNameFN = (user => user.id)) => { if (allUsers.length > 0) { return allUsers } @@ -48,7 +48,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { after = results.pagination.next_offset; hasMore = results.pagination.has_more; } while (hasMore); - usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); + usersList.sort((a, b) => resolveUserDisplayNameFN(a).localeCompare(resolveUserDisplayNameFN(b))); setAllUsers(usersList); return usersList; } catch (error) { @@ -56,9 +56,9 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { return []; } } - const searchUsers = async (prefix, maxResults) => { - let allUsersList = await setAllUsersFromLakeFS() - let filteredUsers = allUsersList.filter(user => ResolveEntityDisplayName(user).startsWith(prefix)); + const searchUsers = async (prefix, maxResults, resolveUserDisplayNameFN = (user => user.id)) => { + let allUsersList = await allUsersFromLakeFS(resolveUserDisplayNameFN) + let filteredUsers = allUsersList.filter(user => resolveUserDisplayNameFN(user).startsWith(prefix)); return filteredUsers.slice(0, maxResults); }; let content; @@ -71,7 +71,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { user.id} rowFn={user => [ - {resolveDisplayName(user)}, + {resolveUserDisplayName(user)}, ]} headers={['User ID', 'Created At']} @@ -80,7 +80,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { buttonFn: user => Are you sure you{'\''}d like to remove user {resolveDisplayName(user)} from group {groupId}?} + msg={Are you sure you{'\''}d like to remove user {resolveUserDisplayName(user)} from group {groupId}?} onConfirm={() => { auth.removeUserFromGroup(user.id, groupId) .catch(error => alert(error)) @@ -101,7 +101,8 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { filterPlaceholder={'Find User...'} modalTitle={'Add to Group'} addText={'Add to Group'} - searchFn={prefix => searchUsers(prefix, 5).then(res => res)} + resolveEntityFN={resolveUserDisplayName} + searchFn={prefix => searchUsers(prefix, 5, resolveUserDisplayName).then(res => res)} onHide={() => setShowAddModal(false)} onAttach={(selected) => { Promise.all(selected.map(user => auth.addUserToGroup(user.id, groupId))) diff --git a/webui/src/pages/auth/users/index.jsx b/webui/src/pages/auth/users/index.jsx index da45a7218dd..969f58064b5 100644 --- a/webui/src/pages/auth/users/index.jsx +++ b/webui/src/pages/auth/users/index.jsx @@ -24,7 +24,7 @@ import { } from "../../../lib/components/controls"; import validator from "validator/es"; import { disallowPercentSign, INVALID_USER_NAME_ERROR_MESSAGE } from "../validation"; -import { resolveDisplayName } from "../../../lib/utils"; +import { resolveUserDisplayName } from "../../../lib/utils"; const USER_NOT_FOUND = "unknown"; export const GetUserEmailByIdContext = createContext(); @@ -119,7 +119,7 @@ const UsersContainer = ({nextPage, refresh, setRefresh, error, loading, userList onRemove={() => setSelected(selected.filter(u => u !== user))} />, - { resolveDisplayName(user) } + { resolveUserDisplayName(user) } , ]}/> diff --git a/webui/src/pages/auth/users/user/groups.jsx b/webui/src/pages/auth/users/user/groups.jsx index 7e2fa6fc94a..ccf9b0dfac4 100644 --- a/webui/src/pages/auth/users/user/groups.jsx +++ b/webui/src/pages/auth/users/user/groups.jsx @@ -21,6 +21,12 @@ import { ConfirmationButton } from "../../../../lib/components/modals"; import { useRouter } from "../../../../lib/hooks/router"; import { Link } from "../../../../lib/components/nav"; +const resolveGroupDisplayName = (group) => { + if(!group) return ""; + if (group?.name?.length) return group.name; + return group.id; +} + const UserGroupsList = ({ userId, after, onPaginate }) => { const [refresh, setRefresh] = useState(false); const [showAddModal, setShowAddModal] = useState(false); @@ -97,6 +103,7 @@ const UserGroupsList = ({ userId, after, onPaginate }) => { searchFn={(prefix) => auth.listGroups(prefix, "", 5).then((res) => res.results) } + resolveEntityFN={resolveGroupDisplayName} onHide={() => setShowAddModal(false)} onAttach={(selected) => { Promise.all( @@ -112,7 +119,8 @@ const UserGroupsList = ({ userId, after, onPaginate }) => { .finally(() => { setShowAddModal(false); }); - }} + } + } /> )} From 6083e4badb163ab93ccc71985288f7d5b1f1d822 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Tue, 17 Dec 2024 17:54:54 +0200 Subject: [PATCH 7/7] Fix review comments --- webui/src/lib/components/auth/forms.jsx | 6 ++-- webui/src/lib/components/auth/users.jsx | 20 +++++++++++ webui/src/pages/auth/groups/group/members.jsx | 34 +++++-------------- webui/src/pages/auth/users/user/groups.jsx | 2 +- 4 files changed, 33 insertions(+), 29 deletions(-) create mode 100644 webui/src/lib/components/auth/users.jsx diff --git a/webui/src/lib/components/auth/forms.jsx b/webui/src/lib/components/auth/forms.jsx index 8f2b087952b..12608461c78 100644 --- a/webui/src/lib/components/auth/forms.jsx +++ b/webui/src/lib/components/auth/forms.jsx @@ -10,7 +10,7 @@ import {useAPI} from "../../hooks/api"; import {Checkbox, DataTable, DebouncedFormControl, AlertError, Loading} from "../controls"; -export const AttachModal = ({ show, searchFn, onAttach, onHide, resolveEntityFN = (ent => ent.id), addText = "Add", +export const AttachModal = ({ show, searchFn, resolveEntityFn = (ent => ent.id), onAttach, onHide , addText = "Add", emptyState = 'No matches', modalTitle = 'Add', headers = ['Select', 'ID'], filterPlaceholder = 'Filter...'}) => { const search = useRef(null); @@ -42,7 +42,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, resolveEntityFN onAdd={() => setSelected([...selected, ent])} onRemove={() => setSelected(selected.filter(selectedEnt => selectedEnt.id !== ent.id))} name={'selected'}/>, - {resolveEntityFN(ent)} + {resolveEntityFn(ent)} ]}/>
@@ -51,7 +51,7 @@ export const AttachModal = ({ show, searchFn, onAttach, onHide, resolveEntityFN Selected: {(selected.map(item => ( - {resolveEntityFN(item)} + {resolveEntityFn(item)} )))}

diff --git a/webui/src/lib/components/auth/users.jsx b/webui/src/lib/components/auth/users.jsx new file mode 100644 index 00000000000..8f317148359 --- /dev/null +++ b/webui/src/lib/components/auth/users.jsx @@ -0,0 +1,20 @@ +import {auth, MAX_LISTING_AMOUNT} from "../../api"; + +export const allUsersFromLakeFS = async (resolveUserDisplayNameFN = (user => user.id)) => { + let after = "" + let hasMore = true + let usersList = [] + try { + do { + const results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); + usersList = usersList.concat(results.results); + after = results.pagination.next_offset; + hasMore = results.pagination.has_more; + } while (hasMore); + usersList.sort((a, b) => resolveUserDisplayNameFN(a).localeCompare(resolveUserDisplayNameFN(b))); + return usersList; + } catch (error) { + console.error("Error fetching users:", error); + return []; + } +} \ No newline at end of file diff --git a/webui/src/pages/auth/groups/group/members.jsx b/webui/src/pages/auth/groups/group/members.jsx index c7c9fe9842c..3cdef8a439d 100644 --- a/webui/src/pages/auth/groups/group/members.jsx +++ b/webui/src/pages/auth/groups/group/members.jsx @@ -4,7 +4,7 @@ import Button from "react-bootstrap/Button"; import {GroupHeader} from "../../../../lib/components/auth/nav"; import {useAPIWithPagination} from "../../../../lib/hooks/api"; -import {auth, MAX_LISTING_AMOUNT} from "../../../../lib/api"; +import {auth} from "../../../../lib/api"; import {Paginator} from "../../../../lib/components/pagination"; import {AttachModal} from "../../../../lib/components/auth/forms"; import {ConfirmationButton} from "../../../../lib/components/modals"; @@ -20,6 +20,7 @@ import { import {useRouter} from "../../../../lib/hooks/router"; import {Link} from "../../../../lib/components/nav"; import {resolveUserDisplayName} from "../../../../lib/utils"; +import {allUsersFromLakeFS} from "../../../../lib/components/auth/users"; const GroupMemberList = ({ groupId, after, onPaginate }) => { @@ -34,30 +35,13 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { setAttachError(null); }, [refresh]); - const allUsersFromLakeFS = async (resolveUserDisplayNameFN = (user => user.id)) => { - if (allUsers.length > 0) { - return allUsers - } - after = "" - let hasMore = true - let usersList = [] - try { - do { - const results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); - usersList = usersList.concat(results.results); - after = results.pagination.next_offset; - hasMore = results.pagination.has_more; - } while (hasMore); - usersList.sort((a, b) => resolveUserDisplayNameFN(a).localeCompare(resolveUserDisplayNameFN(b))); - setAllUsers(usersList); - return usersList; - } catch (error) { - console.error("Error fetching users:", error); - return []; - } - } + const searchUsers = async (prefix, maxResults, resolveUserDisplayNameFN = (user => user.id)) => { - let allUsersList = await allUsersFromLakeFS(resolveUserDisplayNameFN) + let allUsersList = allUsers; + if (allUsersList.length == 0) { + allUsersList = await allUsersFromLakeFS(resolveUserDisplayNameFN) + setAllUsers(allUsersList) + } let filteredUsers = allUsersList.filter(user => resolveUserDisplayNameFN(user).startsWith(prefix)); return filteredUsers.slice(0, maxResults); }; @@ -101,7 +85,7 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { filterPlaceholder={'Find User...'} modalTitle={'Add to Group'} addText={'Add to Group'} - resolveEntityFN={resolveUserDisplayName} + resolveEntityFn={resolveUserDisplayName} searchFn={prefix => searchUsers(prefix, 5, resolveUserDisplayName).then(res => res)} onHide={() => setShowAddModal(false)} onAttach={(selected) => { diff --git a/webui/src/pages/auth/users/user/groups.jsx b/webui/src/pages/auth/users/user/groups.jsx index ccf9b0dfac4..bb8b0adc540 100644 --- a/webui/src/pages/auth/users/user/groups.jsx +++ b/webui/src/pages/auth/users/user/groups.jsx @@ -103,7 +103,7 @@ const UserGroupsList = ({ userId, after, onPaginate }) => { searchFn={(prefix) => auth.listGroups(prefix, "", 5).then((res) => res.results) } - resolveEntityFN={resolveGroupDisplayName} + resolveEntityFn={resolveGroupDisplayName} onHide={() => setShowAddModal(false)} onAttach={(selected) => { Promise.all(