Skip to content

feat(ui): ThreatScore compliance views pillars, nav + charts#10975

Merged
pedrooot merged 16 commits into
masterfrom
PROWLER-1477-bug-threat-score-compliance-view-missing-categories-broken-navigation-and-chart-issues-ui
May 11, 2026
Merged

feat(ui): ThreatScore compliance views pillars, nav + charts#10975
pedrooot merged 16 commits into
masterfrom
PROWLER-1477-bug-threat-score-compliance-view-missing-categories-broken-navigation-and-chart-issues-ui

Conversation

@pedrooot

@pedrooot pedrooot commented May 4, 2026

Copy link
Copy Markdown
Member

Summary

Fixes four UX issues across the ThreatScore compliance views reported.

  1. ThreatScore pillars sometimes appeared in inconsistent order (or were
    missing entirely) across the badge, breakdown card, donut legend and
    accordion list.
  2. Clicking a pillar on /compliance did nothing instead of jumping to the
    ThreatScore detail page filtered to that pillar.
  3. The "Top Failed Sections" chart showed only 1–2 bars when most pillars
    were passing, producing a useless visualization.
  4. The Requirements Status donut tooltip would only fire on the green/pass
    slice because tiny fail/manual segments were impossible to hover.

Changes

Canonical pillar ordering (issue 1)

  • New lib/compliance/threatscore-pillars.ts exposes
    THREATSCORE_PILLARS, getOrderedPillars() and
    compareSectionsByCanonicalOrder(). Every ThreatScore view now consumes
    the same canonical list (1. IAM → 2. Attack Surface → 3. Logging and Monitoring → 4. Encryption); future pillars (e.g. 5. Data Protection)
    are appended in natural-numeric order.
  • threatscore-badge.tsx and threatscore-breakdown-card.tsx always
    render the full pillar set, with / 0 % when the API omits a pillar.
  • lib/compliance/threat.tsx sorts categories canonically before counters
    are computed so the accordion mirrors the chart order.
  • getOrderedPillars() defensively rejects NaN / null / non-numeric
    values so a future API regression cannot crash score.toFixed(...).

Pillar click → detail navigation (issue 2)

  • threatscore-badge.tsx: each pillar is now a <button> that navigates
    to /compliance/ProwlerThreatScore?...&section=<pillar>. Pillars without
    data are disabled / aria-disabled and no-op.
  • [compliancetitle]/page.tsx reads ?section= and resolves the accordion
    key by exact match (${framework.name}-${section}) — no suffix
    collisions across frameworks or category names.
  • client-accordion-wrapper.tsx accepts scrollToKey and uses
    requestAnimationFrame + [data-accordion-key] to scroll the section
    into view after the HeroUI accordion finishes expanding.
  • Accordion.tsx now stamps data-accordion-key={item.key} on each
    AccordionItem to provide a stable selector contract.

Top Failed Sections redesign (issue 3)

  • New ThreatScore-specific getTopFailedSections (in
    lib/compliance/threat-helpers.ts, kept as a pure module so it can be
    unit-tested without dragging in the next-auth chain) returns every
    canonical pillar with zero-fill.
  • top-failed-sections-card.tsx passes useSeverityEmptyState={false} to
    HorizontalBarChart when the caller pre-populated the categories, so
    zero-failure scans render four real bars at 0 instead of falling back to
    generic Critical / High / Medium / Low / Informational placeholders.

Donut tooltip on every segment (issue 4)

  • donut-chart.tsx switched from per-<Cell> mouse handlers to the
    Recharts-idiomatic activeIndex + activeShape pattern. The hovered
    slice is rendered through <Sector> enlarged by ACTIVE_GROW (4 px) so
    tiny 1-2 % slices are easy to see and target.
  • The resting outerRadius is reduced by ACTIVE_GROW so the enlarged
    active sector lands inside the original SVG viewport (consumers like
    RequirementsStatusCard use a fixed 172 × 172 wrapper).
  • Tooltip cursor={false} prevents the default cursor overlay from
    swallowing pointer events on small slices.

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? Yes / No
    • If so, do we need to update permissions for the provider? Please review this carefully.

UI

  • All issue/task requirements work as expected on the UI
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • All issue/task requirements work as expected on the API
  • Endpoint response output (if applicable)
  • EXPLAIN ANALYZE output for new/modified queries or indexes (if applicable)
  • Performance test results (if applicable)
  • Any other relevant evidence of the implementation (if applicable)
  • Verify if API specs need to be regenerated.
  • Check if version updates are required (e.g., specs, Poetry, etc.).
  • Ensure new entries are added to CHANGELOG.md, if applicable.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pedrooot pedrooot requested a review from a team as a code owner May 4, 2026 10:48
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

✅ All necessary CHANGELOG.md files have been updated.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔒 Container Security Scan

Image: prowler-ui:222dacb
Last scan: 2026-05-11 05:45:20 UTC

📊 Vulnerability Summary

Severity Count
🔴 Critical 2
Total 2

2 package(s) affected

⚠️ Action Required

Critical severity vulnerabilities detected. These should be addressed before merging:

  • Review the detailed scan results
  • Update affected packages to patched versions
  • Consider using a different base image if updates are unavailable

📋 Resources:

@alejandrobailo

alejandrobailo commented May 5, 2026

Copy link
Copy Markdown
Contributor

Hey, pushed a few small follow-ups on top of your branch, feel free to keep, tweak or revert any of them:

  • Swapped the useEffect in client-accordion-wrapper for a container callback ref so the auto-scroll runs without an effect
  • Typed Category.percentualScore properly and dropped the as any cast in threat.tsx
  • Used Recharts' SectorProps for the donut active shape so we can ditch the local interface
  • Made prepopulated an explicit prop on TopFailedSectionsCard instead of deriving it from dataType
  • Trimmed the CHANGELOG so it only carries the feat(ui): ThreatScore compliance views pillars, nav + charts #10975 entry, under a fresh [1.25.3] UNRELEASED

Nice work!

…iew-missing-categories-broken-navigation-and-chart-issues-ui
pedrooot added 2 commits May 5, 2026 16:52
…ategories-broken-navigation-and-chart-issues-ui' of https://github.com/prowler-cloud/prowler into PROWLER-1477-bug-threat-score-compliance-view-missing-categories-broken-navigation-and-chart-issues-ui
Comment thread ui/CHANGELOG.md Outdated
pedrooot added 2 commits May 6, 2026 08:53
…iew-missing-categories-broken-navigation-and-chart-issues-ui
…iew-missing-categories-broken-navigation-and-chart-issues-ui
@github-actions github-actions Bot added the has-conflicts The PR has conflicts that needs to be resolved. label May 8, 2026
@github-actions github-actions Bot removed the has-conflicts The PR has conflicts that needs to be resolved. label May 8, 2026
Track the last scrolled-to key in a ref so the inline callback ref no
longer re-fires scrollIntoView on every re-render. Without this, any
state change (Expand all, row toggle, parent re-render) would snap the
page back to the original ?section= target. Also nest the animation
frame so scrollIntoView reads a stable offset after the HeroUI
framer-motion expand has begun to settle.
Remove the trailing (PROWLER-1477) from the renderActiveShape comment.
Ticket numbers belong in PR and issue history, not in source comments
where they rot as the code evolves.
alejandrobailo
alejandrobailo previously approved these changes May 8, 2026
@pedrooot pedrooot changed the title fix(ui): ThreatScore compliance views pillars, nav + charts feat(ui): ThreatScore compliance views pillars, nav + charts May 8, 2026
@alejandrobailo alejandrobailo self-requested a review May 11, 2026 07:52
@pedrooot pedrooot merged commit 1ad329f into master May 11, 2026
26 checks passed
@pedrooot pedrooot deleted the PROWLER-1477-bug-threat-score-compliance-view-missing-categories-broken-navigation-and-chart-issues-ui branch May 11, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants