Skip to content

feat: aggregate statistics [ENG-2780, ENG-3139]#7751

Open
speaker-ender wants to merge 7 commits intomainfrom
feat/aggregate-statistics--ENG-2780
Open

feat: aggregate statistics [ENG-2780, ENG-3139]#7751
speaker-ender wants to merge 7 commits intomainfrom
feat/aggregate-statistics--ENG-2780

Conversation

@speaker-ender
Copy link
Contributor

@speaker-ender speaker-ender commented Mar 25, 2026

Ticket [ENG-2780, ENG-3139]

Description Of Changes

Adding a progress indicator widget to the action center

Code Changes

  • Updating the donut chard component to handle different types of dynamic sizing within containers

Steps to Confirm

  1. Go to the action center and confirm that the new widgets display correct empty states that link to the integrations page when no monitors exist
  2. Confirm that the correct visuals appear when monitors are added
  3. Visit individual monitor screens (datastore, web monitor, integrations) and confirm that only data relevant to that monitor are displayed
  4. Verify that the widgets do not display when the alpha flag is turned off

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • 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 with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link
Contributor

vercel bot commented Mar 25, 2026

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

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Mar 26, 2026 4:37pm
fides-privacy-center Ignored Ignored Mar 26, 2026 4:37pm

Request Review

Comment on lines 282 to +312
@@ -310,6 +296,20 @@ export const snakeCaseToTitleCase = (
)
.join(" ");

/**
* Formats a number with a suffix for large numbers (K, M, etc.)
* @param num - The number to format
* @param digits - The number of digits to round to (default is 0)
* @returns The formatted number as a string
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
*
* @example
* nFormatter(1111); // returns "1K"
* nFormatter(1111, 0); // returns "1K"
* nFormatter(1111, 1); // returns "1.1K"
* nFormatter(1111, 2); // returns "1.11K"
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

drive-by fixing of comments

@speaker-ender speaker-ender force-pushed the feat/aggregate-statistics--ENG-2780 branch from c07ee8e to 92bb486 Compare March 26, 2026 14:59
@speaker-ender speaker-ender changed the title feat: aggregate statistics [ENG-2780] feat: aggregate statistics [ENG-2780, ENG-3139] Mar 26, 2026
@speaker-ender speaker-ender marked this pull request as ready for review March 26, 2026 15:56
@speaker-ender speaker-ender requested a review from a team as a code owner March 26, 2026 15:56
@speaker-ender speaker-ender requested review from kruulik and removed request for a team March 26, 2026 15:56
chore: more types

chore: even more types

chore: all the types

wip: something that works

chore: adding query hook

chore: wip

chore: more types

chore: more type updates

wip: more card stuff

chore: update types

wip: some labels and such

chore: fix comments

core: layout improvements and refactoring

chore: linting and formatting

chore: more responsiveness

chore: further refactors

wip: stuf

chore: comment out

refactor: compact variant

chore: mostly there

fix: formatting

fix: donut chart fit feature

fix: formatting

chore: adding changelog
chore: update text

fix: linting and formatting
@speaker-ender speaker-ender force-pushed the feat/aggregate-statistics--ENG-2780 branch from 64de1e1 to 86dd160 Compare March 26, 2026 15:56
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Code Review — feat: aggregate statistics [ENG-2780, ENG-3139]

Overall this is a well-structured feature: clean component decomposition, proper feature-flag gating, and the DonutChart enhancements (thin variant, fit prop) are nicely done. A few things to fix before merge:

Suggestions (fix before merge)

  • Typo in endpoint/hook names (getAggretateStatisticsgetAggregateStatistics): propagates to both exported hooks and all call sites — worth fixing now before the name spreads further.
  • monitor_type optional but used in URL path: the query arg is typed monitor_type? but interpolated directly into the URL. Either make it required or add a guard.
  • Duplicated getMonitorUpdateName: identical function exists in both MonitorResultDescription.tsx and ProgressCard/utils.ts. Extract to a shared location.
  • Typo in user-facing string: "accross""across" in MONITOR_TYPE_TO_EMPTY_TEXT.
  • Typo in constant name: MONITOR_TYPE_TO_PERECENT_STATISTIC_LABELMONITOR_TYPE_TO_PERCENT_STATISTIC_LABEL.

Nice to Have

  • content-center vs items-center in DonutChart.tsx: content-center only affects multi-line flex containers; items-center is likely what was intended.
  • PropsWithChildren without children: ProgressCard never renders children, so the PropsWithChildren wrapper is unnecessary.
  • renderIcon defined inside component: pure function, no closure needed — move it outside MonitorStats.
  • Overly complex classNames spread pattern: classNames(...["a", ...(cond ? ["b"] : [])]) can be simplified to classNames("a", cond && "b") throughout.
  • heliosInsights test flag is true: most alpha flags use test: false. Confirm existing tests that render ActionCenterLayout or the website monitor page have been updated to account for the new stats widgets.
  • ExtendedDatastoreMonitorUpdates.ts appears unused: not imported anywhere in the PR — remove if not needed yet.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 26, 2026

Greptile Summary

This PR adds aggregate statistics widgets to the action center, introducing a new MonitorStats component and ProgressCard sub-components that display per-monitor-type progress (approval rate, status counts, top classifications) using a donut chart. The DonutChart component is also extended with a thin variant and a fit prop to support dynamic sizing within compact containers. All new widgets are gated behind the heliosInsights feature flag.

Key issues found:

  • Consistent typo in hook/endpoint name: getAggretateStatistics (and the exported hooks useGetAggretateStatisticsQuery / useLazyGetAggretateStatisticsQuery) are missing a "g" — should be getAggregateStatistics. This affects action-center.slice.ts and MonitorStats.tsx.
  • Typo in constant name: MONITOR_TYPE_TO_PERECENT_STATISTIC_LABEL in ProgressCard/utils.tsPERECENT should be PERCENT.
  • Typo in user-facing text: "accross" should be "across" in the website empty-state description.
  • Single-character variable names: The destructured parameter k in ([k]) => key === k violates the project's full-name convention. This appears in both ProgressCard/utils.ts (line 12) and MonitorResultDescription.tsx (line 16).
  • Hardcoded string union for monitor_type: action-center.slice.ts defines monitor_type as "website" | "datastore" | "infrastructure" rather than using the newly added APIMonitorType enum. MonitorStats.tsx also uses string literals directly instead of enum values.
  • Duplicate helper function: getMonitorUpdateName is defined identically in both ProgressCard/utils.ts and MonitorResultDescription.tsx — it should be extracted and shared.
  • div used for text display: <div className="text-xs">None</div> in ProgressCard.tsx should use the fidesui Text component.
  • PR size: This PR touches 27 files, which exceeds the 15-file guideline.

Confidence Score: 4/5

Safe to merge once the hook/endpoint typo and the minor style issues are addressed; the feature is fully gated behind a flag.

All issues are cosmetic (typos, naming conventions, one duplicate helper) with no functional impact — the typo in the hook name is consistent across all usage sites so nothing is broken at runtime. The feature flag means no production exposure until explicitly enabled. A quick round of fixes brings this to merge-ready.

ProgressCard/utils.ts (three separate typos + short variable name + duplicate function) and action-center.slice.ts (endpoint name typo, raw string union instead of enum).

Important Files Changed

Filename Overview
clients/admin-ui/src/features/data-discovery-and-detection/action-center/MonitorStats.tsx New component that renders per-monitor-type statistics cards. Has a typo in the imported hook name (useGetAggretateStatisticsQuery) and uses hardcoded string literals instead of the APIMonitorType enum for monitor_type values.
clients/admin-ui/src/features/data-discovery-and-detection/action-center/ProgressCard/utils.ts New utility file mapping monitor types to display labels and transforming API responses to card props. Contains two typos (accross, PERECENT), a single-char variable name (k), and duplicates getMonitorUpdateName from MonitorResultDescription.tsx.
clients/admin-ui/src/features/data-discovery-and-detection/action-center/ProgressCard/ProgressCard.tsx New 277-line card component displaying a donut chart with numeric/percentage stats in both compact and full layouts. One bare div wrapping a "None" text string should use the fidesui Text component instead.
clients/admin-ui/src/features/data-discovery-and-detection/action-center/action-center.slice.ts Adds getAggretateStatistics RTK Query endpoint (typo — should be getAggregateStatistics) and a new child_staged_resource_urns array query param. The monitor_type param uses a raw string union rather than the APIMonitorType enum.
clients/admin-ui/src/features/data-discovery-and-detection/action-center/constants.ts Refactors MONITOR_UPDATE_NAMES Map to a plain MONITOR_UPDATE_LABELS object and extends it with StatusCounts keys. Clean change.
clients/fidesui/src/components/charts/DonutChart.tsx Adds thin variant and a fit prop (contain/fill) to control how the chart scales within its container. Clean, well-scoped change.
clients/admin-ui/src/features/data-discovery-and-detection/action-center/MonitorResultDescription.tsx Migrates from MONITOR_UPDATE_NAMES Map to MONITOR_UPDATE_LABELS object lookup. Introduces a single-char variable name (k) and duplicates the getMonitorUpdateName helper now also present in ProgressCard/utils.ts.

Reviews (1): Last reviewed commit: "refactor: flag naming" | Re-trigger Greptile

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.

1 participant