Skip to content

Add pagination support to attachment modal#8953

Merged
Ben-El merged 13 commits intomasterfrom
add-pagination-support-to-policy-attachment-modal
Apr 15, 2025
Merged

Add pagination support to attachment modal#8953
Ben-El merged 13 commits intomasterfrom
add-pagination-support-to-policy-attachment-modal

Conversation

@Ben-El
Copy link
Copy Markdown
Contributor

@Ben-El Ben-El commented Apr 9, 2025

Closes #8966

Change Description

Updated the attachment modal to include pagination for:

  • Attach policy modal in users and groups sections (listing policies).
  • Add user to group modal (listing groups).
  • Add member to group modal (listing users/members).

Adjusted the search function and integrated a paginator for handling large datasets efficiently.
This enhances usability when browsing extensive policy/group/member lists.

Testing Details

Was tested manually on local env, verified the pagination controls are showing, and added some more policies locally to increase the list size to see the pagination work appropriately.

image image image

Updated the policy attachment modal to include pagination for listing policies. Adjusted the search function and integrated a paginator for handling large datasets efficiently. This enhances usability when browsing extensive policy lists.
@Ben-El Ben-El added the exclude-changelog PR description should not be included in next release changelog label Apr 9, 2025
@Ben-El Ben-El requested a review from itaigilo April 9, 2025 09:07
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2025

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed, 1 skipped

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2025

E2E Test Results - Quickstart

12 passed

Copy link
Copy Markdown
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Ben-El for the effort.

Some comments needs addressing,
Plus, can you please add screenshots of how the UI looks after your changes?

Comment thread webui/src/pages/auth/groups/group/policies.jsx Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttachModal is used not only for policy attachment, but by other components as well.
Can you describe the effects of your changes on these other components?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The components that are affected are marked in the pic above,
which are:

  • Attach policy modal in users and groups sections
  • Add user to group modal.
  • Add member to group modal.

Generally speaking, to these 4 modals, I added the pagination functionality.

Comment thread webui/src/lib/components/auth/forms.jsx Outdated
Comment thread webui/src/lib/components/auth/forms.jsx Outdated
@itaigilo
Copy link
Copy Markdown
Contributor

itaigilo commented Apr 9, 2025

Closes treeverse/product#693

CHANGES WERE DONE IN LAKEFS, NOT ENTERPRISE (i.e not like what's written in the "bug" issue above)

@Ben-El Please avoid (if possible) linking to non-lakeFS repos, since these are not available for OSS contributers.

@itaigilo
Copy link
Copy Markdown
Contributor

itaigilo commented Apr 9, 2025

Closes treeverse/product#693

Also note that:

  • Since the linked Issue is in a different repo, it won't be closed when the PR will be merged.
  • The Issue also mentions case-insensitivity, which isn't covered by this PR. Make sure that the Issue shouldn't be closed until this will also be addressed.

Ben-El added 3 commits April 9, 2025 19:52
Simplify state management by removing redundant `results` state and directly using API response. Centralize pagination logic and improve search behavior with a dedicated handler for prefix updates.
Replaced custom search logic with paginated API calls to improve scalability and maintainability. Updated group members, user policies, and user groups search functions for consistent use of pagination parameters. Removed unnecessary local state and redundant logic to streamline the code.
@Ben-El Ben-El changed the title Add pagination support to policy attachment modal Add pagination support to attachment modal Apr 10, 2025
@Ben-El Ben-El requested a review from itaigilo April 10, 2025 12:37
Copy link
Copy Markdown
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good -
Blocking for the members comment.

Also, again, please avoid from linking Issues in private git repos (i.e product),
Since this is an open-source repo.

Comment thread webui/src/lib/components/auth/forms.jsx Outdated
Comment thread webui/src/pages/auth/groups/group/members.jsx Outdated
@Ben-El Ben-El requested a review from itaigilo April 10, 2025 14:20
Ben-El added 4 commits April 12, 2025 12:18
Refactored the user search functionality to use a locally cached list of all users, reducing redundancy in API calls. Introduced a `searchUsers` function that filters from a pre-fetched user list, paginating results efficiently.
Adjusted the indentation of the DataTable and Paginator components in the auth forms file to improve code clarity and maintain consistency. This change does not alter functionality but enhances code maintainability and readability.
Updated the indentation in the DataTable component for better readability and consistent formatting. No functional changes were introduced.
Corrected inconsistent indentation in the `rowFn` function of the auth forms component. This improves code readability and adheres to the project's formatting standards without altering functionality.
Copy link
Copy Markdown
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Almost there, but added a few more comments, to make this cleaner, hopefully.

Comment thread webui/src/pages/auth/groups/group/members.jsx Outdated
Comment thread webui/src/pages/auth/groups/group/members.jsx Outdated
Comment thread webui/src/lib/components/auth/forms.jsx Outdated
Centralized page size constant and improved code readability by using shared pagination parameters. Simplified and unified the handling of search and pagination across components.
@Ben-El Ben-El requested a review from itaigilo April 15, 2025 09:46
Updated the `pageSize` constant to `PageSize` in both definition and usage to follow naming conventions. This ensures better alignment with code standards and improves readability.
Copy link
Copy Markdown
Contributor

@itaigilo itaigilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 💪

Approving to unblock,
But please fix the last comment before merging.

Comment thread webui/src/pages/auth/groups/group/policies.jsx Outdated
Comment thread webui/src/lib/components/auth/forms.jsx
Replaced hardcoded page size value (5) with the `PageSize` constant across multiple components for consistency and maintainability. This ensures centralized management of pagination settings.
@Ben-El Ben-El assigned Ben-El and unassigned Ben-El Apr 15, 2025
@Ben-El Ben-El merged commit 7eb3d68 into master Apr 15, 2025
45 of 46 checks passed
@Ben-El Ben-El deleted the add-pagination-support-to-policy-attachment-modal branch April 15, 2025 17:21
@idanovo idanovo added the include-changelog PR description should be included in next release changelog label Apr 27, 2025
@Ben-El Ben-El added area/UI Improvements or additions to UI and removed exclude-changelog PR description should not be included in next release changelog labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/UI Improvements or additions to UI include-changelog PR description should be included in next release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI - Add pagination for attachment modal

3 participants