Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Filter group members by role#1874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kamalqureshi wants to merge1 commit intolowcoder-org:dev
base:dev
Choose a base branch
Loading
fromkamalqureshi:filter_group_members_role
Open
Show file tree
Hide file tree
Changes fromall commits
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
1 change: 1 addition & 0 deletionsclient/packages/lowcoder/src/i18n/locales/en.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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;
}, [])

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()}
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 deletionclient/packages/lowcoder/src/util/pagination/type.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp