Skip to content
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

refactor: add pagination on folders #4020

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open

Conversation

Cristhianzl
Copy link
Collaborator

This PR will refactor several components related to Folders and Flows.

Backend:

  • Implemented pagination for the Folders endpoint.
  • Added pagination for the Flows endpoint.
  • Separated flow headers from the main data to streamline response handling.
  • Integrated the fastapi_pagination library.
  • Isolated basic_example flows from the primary flows request.

Frontend:

  • Enabled pagination in Folder components.
  • Refactored PaginatorComponent for improved functionality.
  • Updated logic for retrieving flows.
  • Moved component logic from MyCollectionComponent child components to the parent component.

⬆️ (uv.lock): Update httpx version from 0.27.2 to 0.27.0
⬆️ (uv.lock): Add new package grpcio-health-checking version 1.62.3

⬆️ (uv.lock): upgrade weaviate-client package from version 3.26.7 to 4.8.1 and add new dependencies grpcio, grpcio-health-checking, grpcio-tools, httpx, and pydantic. Update package source and distribution URLs accordingly.
…o improve performance and user experience

📝 (flows.py): Update documentation to reflect changes made for pagination and additional query parameters
📝 (folders.py): Add a new endpoint to retrieve a folder with paginated flows for better organization and readability
…et_all" parameter to the request

🐛 (test_database.py): fix endpoint for fetching read-only starter projects to use correct URL path
…constants for default values and improve code readability

🐛 (paginatorComponent/index.tsx): fix issue with setting maxPageIndex when pages prop is provided to PaginatorComponent
… settings, and store pagination settings to enhance user experience and improve functionality
… enable refetching queries on mutation settled state

📝 (use-post-login-user.ts): update useLoginUser function to include onSettled callback in options to refetch queries after mutation settles
…h basic examples of flows from the API and update the state with the fetched data.
…d process flows with query parameters for components_only, get_all, folder_id, remove_example_flows, page, and size. This allows for more flexible and specific retrieval of flow data.
…ns in the useGetFolderQuery function to enhance flexibility and customization for fetching folder data.
…d setStarterProjectId to improve code readability and maintainability

✨ (use-get-folders.ts): Update useGetFoldersQuery to setFolders with the fetched data instead of filtering out starter projects to simplify the logic and improve performance
…an object with get_all property set to true to fetch all flows when refreshing
… use constants for better maintainability

📝 (AdminPage/index.tsx): Update resetFilter function to set page size and index using constants for consistency
📝 (AdminPage/index.tsx): Update logic to handle loading state and empty user list based on isIdle state for better user experience
📝 (AdminPage/index.tsx): Update PaginatorComponent props to use constant for rows count and simplify paginate function assignment
…les and folders data for improved functionality and user experience
…a parameter to get all flows at once for better performance.
…ons to manage pagination for flows in the UtilityStoreType
…FoldersStoreType to manage folder data efficiently
… to allow customization of the number of pages displayed in the paginator
…lues for page and size to manage pagination in the utility store
…on 'setFolders' to manage folder data in the store
…a parameter to get all flows at once, improving efficiency and reducing unnecessary calls to the backend.
…ation constants for better organization

♻️ (StorePage/index.tsx): refactor pagination logic to use new pagination constants for clarity and consistency throughout the file
… in ComponentsComponent to improve user experience and performance.
…functionality to improve user experience and data handling in the MyCollectionComponent component
… build query parameter strings for URLs in the frontend controllers.
…te query parameter strings for API requests

📝 (use-get-folder.ts): add comments to explain the purpose of the code and improve code readability
🔧 (use-get-folder.ts): update useGetFolderQuery function to include additional configuration options for the query, such as refetchOnWindowFocus: false
…ter deleting a folder to keep it in sync with the server data
…nId state for refetching queries with the correct folder_id

🐛 (use-post-add-flow.ts): fix queryClient.refetchQueries to include the correct queryKey with folder_id or myCollectionId if response.folder_id is null
… buildQueryStringUrl utility function for better code readability and maintainability
…on functionality to the router for better code organization and readability
@Cristhianzl Cristhianzl self-assigned this Oct 4, 2024
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Oct 4, 2024
@github-actions github-actions bot added refactor Maintenance tasks and housekeeping and removed enhancement New feature or request labels Oct 4, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4020.dmtpw4p5recq1.amplifyapp.com

Cristhianzl and others added 14 commits October 4, 2024 11:25
…to handle cancel action in ConfirmationModal. Refactor handleCancel function to improve code readability and maintainability.
…function to clean up code and improve maintainability
…eGetFolders query with the updated folder_id after patching a flow
…etch queries with the specific folder id when deleting folders
… query parameters for pagination and filtering options
…h useGetFolders query with the correct queryKey and folder_id parameter
…a new flow to ensure the UI is up to date with the latest data.
…ly when isFetched is true to improve performance and reduce unnecessary API calls
…handlePageChange callback for better code organization and readability. Update key prop in ComponentsComponent to include filter and search variables for proper re-rendering.
…y to provide initial data while fetching folder information
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Maintenance tasks and housekeeping size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant