Skip to content

New Feature Pagination #4704

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

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

vinodkiran
Copy link
Contributor

@vinodkiran vinodkiran commented Jun 23, 2025

Adding Pagination Support (Table view and Card view) for the following

  • Chatflows
  • Agentflows (v1/v2)
  • Chat Sessions
  • Agent Executions (already existing)
  • Assistants - Custom
  • Assistants - OpenAI
  • Tools
  • Variables
  • API Keys
  • Document Stores
  • Datasets
  • Dataset Items
  • Evaluators
  • Evaluations (with versions)

The following will NOT be taken up in this PR and will be handled separately shortly.

  • Document Loaders
  • Chat Messages for a session
  • Credentials
  • SSO Config (not needed)
  • Roles
  • Users
  • Workspaces
  • Login Activity - redo pagination to make it consistent with the rest of the application.

@vinodkiran vinodkiran requested review from Copilot, 0xi4o and HenryHengZJ and removed request for 0xi4o June 23, 2025 02:03
@vinodkiran vinodkiran requested a review from chungyau97 June 23, 2025 02:06
Copilot

This comment was marked as outdated.

HenryHengZJ and others added 6 commits June 24, 2025 23:12
2) ensure page limits are passed on load
3) co-pilot review comments (n+1 query)
4)
2) ensure page limits are passed on load
3) co-pilot review comments (n+1 query)
4) refresh lists after insert/delete.
@vinodkiran vinodkiran requested a review from Copilot June 27, 2025 06:39
Copilot

This comment was marked as outdated.

… API key services

- Added check for empty entities in DocumentStoreDTO.fromEntities to return an empty array.
- Updated condition in getAllDocumentStores to handle total count correctly, allowing for zero total.
- Refined logic in getAllApiKeys to check for empty keys and ensure correct API key retrieval.
- Adjusted UI components to safely handle potential undefined apiKeys array.
@vinodkiran vinodkiran requested a review from Copilot July 4, 2025 02:54
Copilot

This comment was marked as outdated.

@vinodkiran vinodkiran requested a review from Copilot July 4, 2025 02:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds pageable list views across the app by wiring up front-end state, components, and API calls with pagination parameters and updating back-end services/controllers to accept and enforce page/limit queries.

  • Integrates a reusable TablePagination component into list views (variables, tools, evaluators, evaluations, docstores, datasets, dataset items, chatflows, agentflows, API keys, agent executions)
  • Updates all REST client methods to accept { params: { page, limit } } and back-end controllers/services to implement skip/take logic and return { data, total }
  • Adds getPageAndLimitParams helper and updates pagination utilities to centralize query parsing

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 5 comments.

Show a summary per file
File/Pattern Description
packages/ui/src/views/*/index.jsx Inject pagination state, call refresh/applyFilters, render TablePagination
packages/ui/src/views/datasets/DatasetItems.jsx Same as above for dataset rows
packages/ui/src/ui-component/pagination/TablePagination.jsx New component driving pagination UI and events
packages/ui/src/api/*.js Updated every getAllX to pass { params }
packages/server/src/utils/pagination.ts New helper to extract/validate page & limit
packages/server/src/services/*/index.ts Extended services to accept page/limit, use skip/take, return count
packages/server/src/controllers/*/index.ts Wire controllers to getPageAndLimitParams and return paged responses
Comments suppressed due to low confidence (1)

packages/ui/src/views/evaluators/index.jsx:17

  • The useError import is unused in this file; consider removing it to reduce dead code.
import TablePagination, { DEFAULT_ITEMS_PER_PAGE } from '@/ui-component/pagination/TablePagination'

Comment on lines +343 to +345
{variables.filter(filterVariables).map((variable, index) => (
<StyledTableRow
key={index}
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Avoid using the array index as the React key; use a unique identifier (e.g., variable.id) to prevent rendering issues when list items change order.

Copilot uses AI. Check for mistakes.

import { useTheme } from '@mui/material/styles'

// project imports
import ErrorBoundary from '@/ErrorBoundary'
import { useError } from '@/store/context/ErrorContext'
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

The useError hook is imported but never used; please remove unused imports.

Suggested change
import { useError } from '@/store/context/ErrorContext'

Copilot uses AI. Check for mistakes.

@@ -26,9 +26,11 @@ import ConfirmDialog from '@/ui-component/dialog/ConfirmDialog'
import AddEditDatasetRowDialog from './AddEditDatasetRowDialog'
import UploadCSVFileDialog from '@/views/datasets/UploadCSVFileDialog'
import ErrorBoundary from '@/ErrorBoundary'
import { useError } from '@/store/context/ErrorContext'
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

Unused useError import detected; remove it to clean up the code.

Suggested change
import { useError } from '@/store/context/ErrorContext'

Copilot uses AI. Check for mistakes.

</FormControl>
</Box>
{totalItems > 0 && (
<Typography variant='body'>
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

Material-UI doesn’t define a body typography variant; switch to body1 or body2 to avoid warnings.

Suggested change
<Typography variant='body'>
<Typography variant='body2'>

Copilot uses AI. Check for mistakes.

Comment on lines +60 to +63
<MenuItem value={12}>12</MenuItem>
<MenuItem value={24}>24</MenuItem>
<MenuItem value={48}>48</MenuItem>
<MenuItem value={100}>100</MenuItem>
Copy link
Preview

Copilot AI Jul 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Hard-coded page-size options limit flexibility; consider making the options configurable via props or a shared constant.

Suggested change
<MenuItem value={12}>12</MenuItem>
<MenuItem value={24}>24</MenuItem>
<MenuItem value={48}>48</MenuItem>
<MenuItem value={100}>100</MenuItem>
{pageSizeOptions.map((option) => (
<MenuItem key={option} value={option}>
{option}
</MenuItem>
))}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants