generated from openedx/frontend-template-application
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: [FC-0099] add filters and sorting functionality to the team table #8
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
brian-smith-tcril
merged 15 commits into
openedx:master
from
eduNEXT:bc/add-table-filters
Oct 23, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1e3749a
feat: add filters and sorting functionality to the team table
bra-i-am 85d0eff
feat: add lodash.debounce for improved fetchData performance in TeamT…
bra-i-am f7a35d9
feat: implement query settings management for team members table with…
dcoa 0fcaafe
fix: increase staleTime for useTeamMembers hook to 30 minutes
bra-i-am 1e05f38
refactor: simplify TableControlBar layout and restore Clear filters b…
bra-i-am a1984eb
feat: add internationalization support for sorting and search placeho…
bra-i-am 857f82e
test: fix issues with failing tests
bra-i-am b11b757
refactor: update SearchFilter to use string & localize Clear filters …
bra-i-am 2b0980e
test: add missing comprehensive tests
bra-i-am 85ca129
refactor: update sorting and group all in a Table
dcoa 7e9a404
test: update to use useEvent intead of fireEvent
dcoa ce7e65b
refactor: user retrival for paginated query in user detail view
dcoa bd009ee
refactor: separation of i18n messages
dcoa ce5cabe
style: remove comment in API
dcoa 0962368
fix: adress debaunce time
dcoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,16 +2,17 @@ import { | |
| useMutation, useQuery, useQueryClient, useSuspenseQuery, | ||
| } from '@tanstack/react-query'; | ||
| import { appId } from '@src/constants'; | ||
| import { LibraryMetadata, TeamMember } from '@src/types'; | ||
| import { LibraryMetadata } from '@src/types'; | ||
| import { | ||
| assignTeamMembersRole, | ||
| AssignTeamMembersRoleRequest, | ||
| getLibrary, getPermissionsByRole, getTeamMembers, PermissionsByRole, | ||
| assignTeamMembersRole, AssignTeamMembersRoleRequest, getLibrary, getPermissionsByRole, getTeamMembers, | ||
| GetTeamMembersResponse, PermissionsByRole, QuerySettings, | ||
| } from './api'; | ||
|
|
||
| const authzQueryKeys = { | ||
| all: [appId, 'authz'] as const, | ||
| teamMembers: (object: string) => [...authzQueryKeys.all, 'teamMembers', object] as const, | ||
| teamMembersAll: (scope: string) => [...authzQueryKeys.all, 'teamMembers', scope] as const, | ||
| teamMembers: (scope: string, querySettings?: QuerySettings) => [ | ||
| ...authzQueryKeys.teamMembersAll(scope), querySettings] as const, | ||
| permissionsByRole: (scope: string) => [...authzQueryKeys.all, 'permissionsByRole', scope] as const, | ||
| library: (libraryId: string) => [...authzQueryKeys.all, 'library', libraryId] as const, | ||
| }; | ||
|
|
@@ -20,17 +21,19 @@ const authzQueryKeys = { | |
| * React Query hook to fetch all team members for a specific object/scope. | ||
| * It retrieves the full list of members who have access to the given scope. | ||
| * | ||
| * @param object - The unique identifier of the object/scope | ||
| * @param scope - The unique identifier of the object/scope | ||
| * @param querySettings - Optional query parameters for filtering, sorting, and pagination | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * const { data: teamMembers, isLoading, isError } = useTeamMembers('lib:123'); | ||
| * const { data: teamMembers, isLoading, isError } = useTeamMembers('lib:123', querySettings); | ||
| * ``` | ||
| */ | ||
| export const useTeamMembers = (object: string) => useQuery<TeamMember[], Error>({ | ||
| queryKey: authzQueryKeys.teamMembers(object), | ||
| queryFn: () => getTeamMembers(object), | ||
| export const useTeamMembers = (scope: string, querySettings: QuerySettings) => useQuery<GetTeamMembersResponse, Error>({ | ||
| queryKey: authzQueryKeys.teamMembers(scope, querySettings), | ||
| queryFn: () => getTeamMembers(scope, querySettings), | ||
| staleTime: 1000 * 60 * 30, // refetch after 30 minutes | ||
| refetchOnWindowFocus: false, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious as to why this is being added. It doesn't seem like something that would be a sort/filter/search specific change. |
||
| }); | ||
|
|
||
| /** | ||
|
|
@@ -80,7 +83,7 @@ export const useAssignTeamMembersRole = () => { | |
| data: AssignTeamMembersRoleRequest | ||
| }) => assignTeamMembersRole(data), | ||
| onSettled: (_data, _error, { data: { scope } }) => { | ||
| queryClient.invalidateQueries({ queryKey: authzQueryKeys.teamMembers(scope) }); | ||
| queryClient.invalidateQueries({ queryKey: authzQueryKeys.teamMembersAll(scope) }); | ||
| }, | ||
| }); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there be a possible scenario where we'd have
sortBybut notorder? I know for the current sort options (Name A-Z, Name Z-A) we'll always have both so this isn't a blocking comment.