Skip to content

Conversation

@pedrooot
Copy link
Member

@pedrooot pedrooot commented Dec 5, 2025

Context

This PR extracts the UI fix from PR #9470 to show Top Failed Requirements for compliances that have a flat structure (like RBI) without the compliance JSON changes.

Fix for compliances that don't have section hierarchy showing empty "Top Failed Sections" chart.

[Before]
Screenshot 2025-12-05 at 13 04 33

[After]
Screenshot 2025-12-05 at 13 18 16

Description

For compliances like RBI that have a flat structure (requirements directly in framework without categories/sections), the Top Failed Sections chart was showing empty because the logic only iterated over framework.categories.

This fix:

  • Detects flat structure compliances (framework.requirements without categories)
  • Shows 'Top Failed Requirements' for flat structures
  • Keeps 'Top Failed Sections' for hierarchical structures (like ENS)
  • Updates getTopFailedSections to return TopFailedResult with type metadata
  • Adds dynamic title to TopFailedSectionsCard component

Steps to review

  1. Navigate to a compliance detail page for a flat-structure compliance (e.g., RBI)
  2. Verify the "Top Failed Requirements" chart displays correctly
  3. Navigate to a hierarchical compliance (e.g., ENS)
  4. Verify the "Top Failed Sections" chart still displays correctly

Checklist

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

  • Verify if API specs need to be regenerated. - Not needed
  • Check if version updates are required (e.g., specs, Poetry, etc.). - Not needed
  • Ensure new entries are added to CHANGELOG.md, if applicable. - Not needed

License

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

… hierarchy

For compliances like RBI that have a flat structure (requirements directly
in framework without categories/sections), the Top Failed Sections chart
was showing empty because the logic only iterated over framework.categories.

This fix:
- Detects flat structure compliances (framework.requirements without categories)
- Shows 'Top Failed Requirements' for flat structures
- Keeps 'Top Failed Sections' for hierarchical structures (like ENS)
- Updates getTopFailedSections to return TopFailedResult with type metadata
- Adds dynamic title to TopFailedSectionsCard component
@pedrooot pedrooot requested a review from a team as a code owner December 5, 2025 12:36
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

✅ All necessary CHANGELOG.md files have been updated.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Conflict Markers Resolved

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🔒 Container Security Scan

Image: prowler-ui:0f4b4cf
Last scan: 2025-12-05 16:43:38 UTC

✅ No Vulnerabilities Detected

The container image passed all security checks. No known CVEs were found.

📋 Resources:

pedrooot and others added 2 commits December 5, 2025 13:48
- Add optional requirements property to Framework interface for flat structures
- Replace union type with const-based pattern for TopFailedDataType
- Remove all 'as any' casts from commons.tsx and mitre.tsx
- Extract helper functions (buildTopFailedResult, hasFlatStructure, incrementFailedCount) for DRY
- Type Maps properly with explicit generic parameters
- Add proper return types to findOrCreateCategory and findOrCreateControl
- Replace any[] with unknown[] in ENSAttributesMetadata
- Fix React import to use named imports (createElement, ReactNode)
- Update pre-commit hook to allow var() in chart components
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.

3 participants