Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Dropdown in User Groups to filter roles
  • Loading branch information
kamalqureshi committed Jul 16, 2025
commit 8ff5f78bc650d9dd8bbaf8aa49c59e6978af9b01
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3021,6 +3021,7 @@ export const en = {
"joinTimeColumn": "Joining Time",
"actionColumn": "Operation",
"roleColumn": "Role",
"filterByRole": "Filter by role",
"exitGroup": "Exit Group",
"moveOutGroup": "Remove from Group",
"inviteUser": "Invite Members",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GroupRoleInfo, GroupUser, OrgGroup, TacoRoles } from "constants/orgConstants";
import { GroupRoleInfo, GroupUser, OrgGroup, TacoRoles, RoleIdType } from "constants/orgConstants";
import { User } from "constants/userConstants";
import { AddIcon, ArrowIcon, CustomSelect, PackUpIcon, Search, SuperUserIcon } from "lowcoder-design";
import { AddIcon, ArrowIcon, CustomSelect, Dropdown, PackUpIcon, Search, SuperUserIcon } from "lowcoder-design";
import { trans } from "i18n";
import ProfileImage from "pages/common/profileImage";
import React, { useCallback, useEffect, useMemo, useState } from "react";
Expand Down Expand Up @@ -84,6 +84,7 @@ const GroupUsersPermission: React.FC<GroupPermissionProp> = (props) => {
setElements
} = props;
const [searchValue, setSearchValue] = useState("")
const [roleFilter, setRoleFilter] = useState<RoleIdType | "">("")
const dispatch = useDispatch();

const adminCount = groupUsers.filter((user) => isGroupAdmin(user.role)).length;
Expand All @@ -99,9 +100,23 @@ const GroupUsersPermission: React.FC<GroupPermissionProp> = (props) => {
});
}, [groupUsers]);

const roleFilterOptions = useCallback(() => {
const filterOptions = [
...TacoRoles.map(role => ({
label: GroupRoleInfo[role].name,
value: role as RoleIdType | ""
})),
{
label: "All",
value: "" as RoleIdType | ""
}
]
return filterOptions;
}, [])

Comment thread
raheeliftikhar5 marked this conversation as resolved.
Outdated
const debouncedFetchPotentialMembers = useCallback(
debounce((searchVal: string) => {
fetchGroupUsrPagination({groupId: group.groupId, search: searchVal})
debounce((searchVal: string, roleFilter: string) => {
fetchGroupUsrPagination({groupId: group.groupId, search: searchVal, role: roleFilter})
.then(result => {
if (result.success) {
setElements({
Expand All @@ -115,13 +130,13 @@ const GroupUsersPermission: React.FC<GroupPermissionProp> = (props) => {
);

useEffect(() => {
if (searchValue.length > 2 || searchValue === "") {
debouncedFetchPotentialMembers(searchValue);
if (searchValue.length > 2 || searchValue === "" || roleFilter) {
debouncedFetchPotentialMembers(searchValue, roleFilter);
}
return () => {
debouncedFetchPotentialMembers.cancel();
};
}, [searchValue, debouncedFetchPotentialMembers]);
}, [searchValue, roleFilter, debouncedFetchPotentialMembers]);

return (
<>
Expand All @@ -137,6 +152,17 @@ const GroupUsersPermission: React.FC<GroupPermissionProp> = (props) => {
</HeaderBack>
{isGroupAdmin(currentUserGroupRole) && !group.syncGroup && (
<OptionsHeader>
<Dropdown
options={roleFilterOptions()}
Comment thread
raheeliftikhar5 marked this conversation as resolved.
Outdated
value={roleFilter || ""}
onChange={(value) => {
setRoleFilter(value);
}}
style={{
minWidth: "100px"
}}
placeholder={trans("memberSettings.filterByRole")}
/>
<Search
placeholder={trans("memberSettings.searchMember")}
value={searchValue}
Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/util/pagination/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ export interface fetchGroupUserRequestType {
groupId: string;
pageNum?: number;
pageSize?: number;
search?: string
search?: string;
role?: string;
}

export interface fetchQueryLibraryPaginationRequestType {
Expand Down
Loading