Add findings table with pagination to access control summary#7643
Add findings table with pagination to access control summary#7643kruulik merged 4 commits intoaccess-control-summary-dashboardfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Greptile SummaryThis PR adds a paginated The implementation is mostly clean and follows existing patterns (
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: bed0f93 |
| <Pagination | ||
| {...paginationProps} | ||
| total={data?.total} | ||
| showTotal={(t, range) => `${range[0]}-${range[1]} of ${t} items`} |
There was a problem hiding this comment.
Single-character variable name
t is a 1-character variable name that should use a descriptive full name per the project's naming convention.
| showTotal={(t, range) => `${range[0]}-${range[1]} of ${t} items`} | |
| showTotal={(total, range) => `${range[0]}-${range[1]} of ${total} items`} |
Rule Used: Use full names for variables, not 1 to 2 character... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| CONTROLS[policy].map((control, i) => ({ | ||
| policy, | ||
| control, | ||
| violation_count: Math.floor(Math.random() * 40) + 2, | ||
| last_violation: new Date(baseTime - i * 2 * 60 * 60 * 1000).toISOString(), | ||
| })), |
There was a problem hiding this comment.
Single-character variable names
i is a 1-character variable name that should use a descriptive full name per the project's naming convention. The same applies to the index variable i at line 191 in generateLogs().
| CONTROLS[policy].map((control, i) => ({ | |
| policy, | |
| control, | |
| violation_count: Math.floor(Math.random() * 40) + 2, | |
| last_violation: new Date(baseTime - i * 2 * 60 * 60 * 1000).toISOString(), | |
| })), | |
| CONTROLS[policy].map((control, controlIndex) => ({ | |
| policy, | |
| control, | |
| violation_count: Math.floor(Math.random() * 40) + 2, | |
| last_violation: new Date(baseTime - controlIndex * 2 * 60 * 60 * 1000).toISOString(), | |
| })), |
Also update generateLogs (line 191):
return Array.from({ length: 50 }, (_, logIndex) => ({
timestamp: new Date(baseTime - logIndex * 45 * 60 * 1000).toISOString(),
consumer: LOG_CONSUMERS[logIndex % LOG_CONSUMERS.length],
policy: allPolicies[logIndex % allPolicies.length],
dataset: LOG_DATASETS[logIndex % LOG_DATASETS.length],
data_use: LOG_DATA_USES[logIndex % LOG_DATA_USES.length],
}));Rule Used: Use full names for variables, not 1 to 2 character... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| CONTROLS[policy].map((control, i) => ({ | ||
| policy, | ||
| control, | ||
| violation_count: Math.floor(Math.random() * 40) + 2, |
There was a problem hiding this comment.
Non-deterministic mock data from Math.random()
violation_count is randomized via Math.random() on each module evaluation. This means the data (including sort order after .sort()) will be different on every hot-reload, page refresh, or module re-import during development. This makes pagination behavior non-reproducible: a count that was 34 in one session might be 11 in the next, causing items to appear on different pages.
Since the intent is realistic pagination testing, consider using deterministic values (e.g. seeded, or a static formula like (controlIndex + 1) * 3 + policyIndex) so the data is consistent between reloads.
| width: 120, | ||
| sorter: (a, b) => a.violation_count - b.violation_count, | ||
| }, | ||
| { | ||
| title: "Last violation", | ||
| dataIndex: "last_violation", | ||
| key: "last_violation", | ||
| width: 160, | ||
| render: (timestamp: string) => | ||
| formatDistance(new Date(timestamp), new Date(), { addSuffix: true }), | ||
| sorter: (a, b) => | ||
| new Date(a.last_violation).getTime() - | ||
| new Date(b.last_violation).getTime(), |
There was a problem hiding this comment.
Client-side sort applied to a single page of server-side paginated data
The sorter functions defined here perform client-side sorting, but FindingsTable fetches only one page of data at a time from the server. As a result, clicking a column header will only sort the currently displayed items — not the full dataset of ~37 violations.
For example, if page 1 shows violations with counts [34, 28, 22, 15, 12, 10, 9, 8, 7, 6] and the user sorts ascending, they'll see those same 10 items reordered, but the actual lowest-violation items from pages 2–4 are never surfaced. This gives users a misleading picture of the data ordering.
The API already supports server-side sorting via sort_by and sort_direction params in PolicyViolationsParams (in access-control.slice.ts), but these are not wired up in FindingsTable.
To fix this, the inline sorter functions should be removed (or replaced with sorter: true to keep the sort-arrow UI) and the <Table>'s onChange handler should capture sort events and pass sort_by/sort_direction to useGetPolicyViolationsQuery. A sort state change should also reset the page back to 1.
bbf6d00
into
access-control-summary-dashboard
Ticket ENG-2943
Description Of Changes
Add a paginated findings table below the summary cards on the access control summary page. The table shows policy violations grouped by policy + control, with sortable columns for violation count and last violation time. Rows are clickable (noop for now, wired up in a follow-up). Also expands mock data to ~37 violation aggregates and 50 violation log entries for more realistic pagination testing.
Code Changes
clients/admin-ui/src/features/access-control/summary/FindingsTable.tsx- New component: paginated Ant Table consuminguseGetPolicyViolationsQuery, usesuseAntPaginationwith separate URL query keysclients/admin-ui/src/features/access-control/summary/violationsColumns.tsx- Column definitions for the aggregate violations table (Policy, Control, Violations, Last Violation)clients/admin-ui/src/features/access-control/summary/violationLogsColumns.tsx- Column definitions for the activity log table (for use on the Request Log tab in a follow-up)clients/admin-ui/src/mocks/access-control/data.ts- Expanded mock data: ~37 violation aggregates across 8 policies, 50 violation log entriesclients/admin-ui/src/pages/data-discovery/access-control/summary/index.tsx- Render<FindingsTable />below<SummaryCards />Steps to Confirm
NEXT_PUBLIC_MOCK_API=true npm run devfromclients/admin-ui//data-discovery/access-control/summaryPre-Merge Checklist
CHANGELOG.mdupdated