Skip to content

ENG-2598: Add read-only conditions list to policy detail page#7457

Merged
gilluminate merged 12 commits intomainfrom
gill/ENG-2598/fe-condition-list
Feb 25, 2026
Merged

ENG-2598: Add read-only conditions list to policy detail page#7457
gilluminate merged 12 commits intomainfrom
gill/ENG-2598/fe-condition-list

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented Feb 23, 2026

Ticket ENG-2598

Description Of Changes

Add a read-only conditions list to the policy detail page, matching the pattern established by the Manual Tasks conditions tab (TaskConditionsTab). Policies with routing conditions now display them as a list of field / operator / value rows using Ant Design's List component.

  • Policy detail page passes policy.conditions down to PolicyConditionsTab
  • Conditions are normalized from the polymorphic ConditionGroup | ConditionLeaf | null shape into a flat ConditionLeaf[] for display
  • Reuses existing formatting utilities (operatorLabels, formatFieldDisplay, formatConditionValue) from the manual tasks feature
  • Policies list page shows a condition count summary (e.g. "3 conditions") alongside each policy
  • MSW mock data includes realistic condition varieties: single leaves, OR groups, and null
  • MSW handler added for individual policy fetch (GET /dsr/policy/:key)
  • Read-only for now — no add/edit/delete UI (CRUD is a follow-up)

Code Changes

  • clients/admin-ui/src/features/policies/conditions/PolicyConditionsTab.tsx - Rewritten from stub to render conditions as an Ant List with field name, operator tag, and value
  • clients/admin-ui/src/pages/privacy-requests/policies/[key].tsx - Pass policy.conditions prop to PolicyConditionsTab
  • clients/admin-ui/src/pages/privacy-requests/policies/index.tsx - Show condition count summary per policy, sort non-default policies alphabetically
  • clients/admin-ui/src/features/policies/utils/summarizeConditions.ts - Utility to count and pluralize condition leaves for display
  • clients/admin-ui/src/features/policies/utils/summarizeConditions.test.ts - Unit tests for summarizeConditions (null, leaf, group, nested)
  • clients/admin-ui/cypress/e2e/policies/policy-detail.cy.ts - Cypress E2E tests for conditions list (empty state, single leaf, condition group)

Steps to Confirm

  1. Run the admin-ui dev server with mocks: npm run dev:mock from clients/admin-ui
  2. Navigate to Privacy requests > Policies
  3. Expected: Policies list shows condition count summaries (e.g. "3 conditions") for policies that have conditions
  4. Click on a policy with conditions (e.g. "GDPR Erasure Policy" or "EU Data Access Request")
  5. Click the Conditions tab
  6. Expected: Conditions are listed as rows with field name, operator tag, and value
  7. Click on a policy without conditions (e.g. "Default Access Policy")
  8. Click the Conditions tab
  9. Expected: Empty state message: "No conditions configured. This policy will apply to all matching requests."

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration label
    • Add a high-risk label
    • Updates unreleased work already in Changelog
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date
    • Ensure that your downgrade() migration is correct
    • No migrations
  • Documentation:
    • Documentation complete
    • Documentation issue created
    • No documentation updates required

Made with Cursor

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Feb 24, 2026 0:38am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Feb 24, 2026 0:38am

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Adds a read-only conditions list to the policy detail page, displaying routing conditions as field/operator/value rows using Ant Design's List component. The implementation follows established patterns from the manual tasks feature and includes proper recursive flattening of nested condition groups. The policies list page now shows condition count summaries alongside each policy.

Major Changes:

  • PolicyConditionsTab rewritten to display conditions using extractLeafConditions utility
  • New utilities: extractLeafConditions (recursive flattening) and summarizeConditions (count display)
  • Policy detail page displays condition count in tabs, passes conditions to tab component
  • Policies list shows condition summaries per policy with alphabetical sorting for non-default policies
  • MSW mock data expanded with realistic condition examples (single leaves, OR groups)
  • MSW handler added for individual policy fetch endpoint
  • Comprehensive E2E tests cover empty state, single leaf, and condition groups

Quality Indicators:

  • All edge cases tested (null, single leaf, nested groups)
  • Reuses existing formatting utilities for consistency
  • Proper TypeScript types generated and exported
  • Read-only implementation as intended (CRUD is follow-up work)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is well-tested with comprehensive unit and E2E tests, follows established patterns from the codebase, properly handles edge cases (null, single leaf, nested groups), and is read-only which limits potential impact. The recursive flattening logic is correct, and all custom style guidelines are followed except one minor non-critical suggestion about using Flex instead of div.
  • No files require special attention

Important Files Changed

Filename Overview
clients/admin-ui/src/features/policies/conditions/PolicyConditionsTab.tsx Main component for displaying read-only conditions list with field, operator, and value display. Uses Ant List component. Minor: wrapping div could be Flex for consistency.
clients/admin-ui/src/features/policies/utils/extractLeafConditions.ts Recursive utility to flatten nested condition groups into leaf conditions. Implementation is correct and handles all edge cases.
clients/admin-ui/src/pages/privacy-requests/policies/[key].tsx Policy detail page updated to pass conditions to tab and display condition count. Clean integration.
clients/admin-ui/src/pages/privacy-requests/policies/index.tsx Policies list page displays condition summaries. Implements custom search state instead of useSearch hook, but reasonable for this context.
clients/admin-ui/cypress/e2e/policies/policy-detail.cy.ts Comprehensive E2E tests for conditions display including empty state, single leaf, and condition groups.
clients/admin-ui/src/mocks/policy/data.ts Mock policies expanded with realistic condition examples (single leaves, OR groups). Good test data coverage.

Last reviewed commit: 6ce98af

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

14 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@gilluminate gilluminate force-pushed the gill/ENG-2598/fe-condition-list branch from d95d065 to 6ce98af Compare February 23, 2026 21:17
@gilluminate
Copy link
Copy Markdown
Contributor Author

@greptile

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

14 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

gilluminate and others added 12 commits February 23, 2026 17:34
Co-Authored-By: Cursor <cursoragent@cursor.com>
Switch import to named export to resolve import/no-named-as-default
ESLint error, and remove redundant default export.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@gilluminate gilluminate added this pull request to the merge queue Feb 25, 2026
Merged via the queue into main with commit 75e348a Feb 25, 2026
45 checks passed
@gilluminate gilluminate deleted the gill/ENG-2598/fe-condition-list branch February 25, 2026 16:11
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.

2 participants