8000 BED-6056 Icon to disabled tiers by KillahDillah · Pull Request #1640 · SpecterOps/BloodHound · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

BED-6056 Icon to disabled tiers #1640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

KillahDillah
Copy link
Contributor
@KillahDillah KillahDillah commented Jul 1, 2025

Description

Add alert icon to tiers that do not have analysis enabled

Motivation and Context

Resolves BED-6056

Brings attention to tiers that do not have analysis enabled.

How Has This Been Tested?

Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.

Visually, changes in DB, and unit tests.

Screenshots (optional):

Screenshot 2025-07-02 at 3 11 52 PM
Screenshot 2025-07-02 at 3 12 06 PM

Types of changes

  • Chore (a change that does not modify the application functionality)

Checklist:

Summary by CodeRabbit

  • New Features

    • Introduced a Zone Analysis icon that conditionally appears in zone management lists and summary cards based on analysis status and configuration.
    • Added tooltips to the Zone Analysis icon to indicate when analysis is disabled.
    • New hook to determine if privilege zone analysis is enabled via configuration.
  • Enhancements

    • List and summary components now display analysis status per item for improved visibility.
  • Bug Fixes

    • Improved test coverage and robustness for conditional rendering of analysis icons and tooltips.
  • API Changes

    • The analysis status property on zone tags is now always present and can be true, false, or null.
    • Summary cards accept a new prop to indicate analysis status.
  • Chores

    • Updated and refactored tests for consistency and better async handling.

Copy link
Contributor
coderabbitai bot commented Jul 1, 2025

Walkthrough

This change introduces a new ZoneAnalysisIcon component that conditionally renders based on privilege configuration. The AssetGroupTag type now requires an analysis_enabled property. The SummaryCard and related components accept and propagate an analysisEnabled prop, which controls the display of the icon and tooltips. The usePrivilegeZoneAnalysis hook centralizes fetching the multi-tier analysis configuration. Tests are enhanced with MSW mocks to verify conditional rendering and async behavior, and test IDs are added for better test targeting.

Changes

File(s) Change Summary
.../ZoneManagement/ZoneAnalysisIcon.tsx Added new ZoneAnalysisIcon component with optional tooltip, using privilege config hook.
.../ZoneManagement/index.tsx Re-exported all exports from ZoneAnalysisIcon for broader module access.
.../ZoneManagement/Details/DetailsList.tsx Integrated ZoneAnalysisIcon for tag items with analysis_enabled false/undefined; added test IDs.
.../ZoneManagement/Details/DetailsList.test.tsx Added tests for conditional rendering of tier icon tooltips; introduced MSW mock server.
.../ZoneManagement/Summary/SummaryCard.tsx Added analysisEnabled prop; conditionally renders ZoneAnalysisIcon with tooltip; added test ID.
.../ZoneManagement/Summary/SummaryCard.test.tsx Enhanced tests with async queries and MSW mocks for config-driven icon tooltip rendering.
.../ZoneManagement/Summary/SummaryList.tsx Passes analysis_enabled as analysisEnabled prop to SummaryCard.
.../ZoneManagement/Summary/SummaryList.test.tsx Updated test data to include analysis_enabled; formatting tweaks on inline functions.
.../ZoneManagement/Save/TagForm/TagForm.tsx Refactored to use usePrivilegeZoneAnalysis hook; simplified toggle rendering logic.
.../hooks/useConfiguration.ts Added usePrivilegeZoneAnalysis hook to fetch and parse multi-tier analysis configuration.
.../js-client-library/src/types.ts Made analysis_enabled required (`boolean

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant Config as usePrivilegeZoneAnalysis Hook
    participant API as /api/v2/config Endpoint

    UI->>Config: Call usePrivilegeZoneAnalysis()
    Config->>API: Fetch configuration data
    API-->>Config: Return config response
    Config-->>UI: Return multi_tier_analysis_enabled flag

    UI->>UI: Render components
    alt multi_tier_analysis_enabled is true
        UI->>UI: Render ZoneAnalysisIcon if analysis_enabled is false or null
    else multi_tier_analysis_enabled is false
        UI->>UI: Do not render ZoneAnalysisIcon
    end
Loading

Possibly related PRs

  • SpecterOps/BloodHound#1550: Adds backend configuration parameter for multi-tier analysis, complementing this PR's frontend handling of the same feature.

Poem

🥕
A rabbit hopped through code so bright,
Bringing icons to the user's sight.
Now tiers show if they're analyzed,
With tooltips, tests, and types revised.
Config-driven, clear, and neat—
This change makes UI complete!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e93d6f2 and 6a2a995.

📒 Files selected for processing (1)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/ZoneAnalysisIcon.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/ZoneAnalysisIcon.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build BloodHound Container Image / Build and Package Container
  • GitHub Check: run-tests
  • GitHub Check: build-ui
  • GitHub Check: run-analysis
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@KillahDillah KillahDillah self-assigned this Jul 1, 2025
@KillahDillah KillahDillah marked this pull request as ready for review July 3, 2025 18:32
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

🧹 Nitpick comments (2)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (1)

68-68: Consider using a theme variable for the icon color

The hardcoded color #ED8537 should be defined as a theme variable for better maintainability and consistency across the application.

Consider moving this color to your theme configuration and referencing it instead of hardcoding.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (1)

33-33: Remove or address the TODO comment

This comment appears to be a question that should be resolved or removed before merging.

-// why is this details and not summary?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93d2a6d and 6591ca6.

📒 Files selected for processing (4)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (4 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx (4 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (5 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (4)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)
  • useGetConfiguration (29-33)
packages/javascript/js-client-library/src/utils/config.ts (1)
  • parseTieringConfiguration (145-152)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/hooks.ts (1)
  • useAssetGroupTagInfo (80-88)
packages/javascript/bh-shared-ui/src/components/AppIcon/AppIcon.tsx (1)
  • AppIcon (28-28)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build BloodHound Container Image / Build and Package Container
  • GitHub Check: run-tests
  • GitHub Check: run-analysis
  • GitHub Check: build-ui
🔇 Additional comments (3)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (1)

49-78: Well-implemented conditional tooltip rendering

The implementation correctly displays the analysis disabled warning only when multi-tier analysis is enabled globally but disabled for the specific tag. The tooltip provides clear user feedback.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (1)

127-189: Comprehensive test coverage for tooltip rendering scenarios

Good test coverage for the three key scenarios:

  1. Multi-tier analysis disabled - no tooltip
  2. Multi-tier enabled but tag analysis disabled - tooltip shown
  3. Multi-tier enabled and tag analysis enabled - no tooltip

The test structure properly mocks the configuration API responses.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx (1)

168-189: Consistent implementation with SummaryCard

The tooltip implementation correctly mirrors the logic in SummaryCard, providing a consistent user experience across components. The conditional rendering properly checks for multi-tier analysis being enabled and tag analysis being disabled.

@KillahDillah KillahDillah added the user interface A pull request containing changes affecting the UI code. label Jul 3, 2025
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (2)

126-128: Fix incorrect promise handling in longWait.

The longWait function call should be awaited if it returns a promise.

-        longWait(() => {
-            expect(screen.queryByTestId('analysis_disabled_icon')).not.toBeInTheDocument();
-        })
+        await longWait(() => {
+            expect(screen.queryByTestId('analysis_disabled_icon')).not.toBeInTheDocument();
+        })

151-153: Fix incorrect promise handling in longWait.

The longWait function call should be awaited if it returns a promise.

-        longWait(() => {
-            expect(screen.getByTestId('analysis_disabled_icon')).toBeInTheDocument();
-        })
+        await longWait(() => {
+            expect(screen.getByTestId('analysis_disabled_icon')).toBeInTheDocument();
+        })
🧹 Nitpick comments (2)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (1)

169-188: Remove unnecessary blank line.

The test logic is sound, but there's an extra blank line that should be removed for consistency.

         );

-
         render(<DetailsList title='Tiers' listQuery={testQuery} selected={'1'}  => { }} />)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (1)

33-33: Remove or clarify the leftover comment.

This comment appears to be a leftover from development and should either be removed or clarified if it represents a legitimate concern.

-// why is this details and not summary?
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6591ca6 and 0b82314.

📒 Files selected for processing (4)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (4 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (5 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (1 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryList.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx
🧰 Additional context used
🧠 Learnings (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (1)
Learnt from: superlinkx
PR: SpecterOps/BloodHound#1503
File: cmd/api/src/services/job/jobs_test.go:19-143
Timestamp: 2025-05-27T16:58:33.295Z
Learning: Tests in cmd/api/src/services/job/jobs_test.go have been found to be flaky in the past and are due for rewrite. They should be skipped with t.Skip() until they can be properly rewritten.
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build BloodHound Container Image / Build and Package Container
  • GitHub Check: run-tests
  • GitHub Check: run-analysis
  • GitHub Check: build-ui
🔇 Additional comments (13)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (6)

17-21: Good addition of necessary imports for MSW testing.

The new imports support the MSW server setup and additional testing utilities needed for the analysis disabled icon tests.


41-41: Appropriate test data enhancement.

The addition of the analysis_enabled boolean flag to the test data properly supports the new conditional rendering logic for the analysis disabled icon.

Also applies to: 55-55, 69-69


74-87: Well-structured MSW server setup.

The configuration response object and server lifecycle management are properly implemented to support the configuration API mocking needed for the tests.


127-150: Comprehensive test coverage for disabled multi-tier analysis.

The test correctly verifies that no analysis disabled icon is shown when multi-tier analysis is disabled, regardless of individual tier analysis settings.


152-167: Effective test for enabled multi-tier analysis with disabled tier analysis.

The test appropriately verifies that the analysis disabled icon appears when multi-tier analysis is enabled and there are tiers with analysis_enabled: false.


179-187: Excellent granular testing of tier-specific icon visibility.

The test correctly verifies that the analysis disabled icon appears only on specific tiers with analysis_enabled: false while being absent on tiers with analysis_enabled: true.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryList.tsx (1)

79-79: LGTM! Correct prop passing for analysis status feature.

The addition of the analysis prop correctly passes the analysis enabled status from the list item to the SummaryCard component, enabling the conditional rendering of the alert icon for tiers without analysis enabled.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (6)

36-42: LGTM! Proper async mock setup for navigation.

The updated navigation mock correctly handles async module imports and provides the necessary mock functionality for the tests.


44-53: LGTM! Well-structured configuration response mock.

The mock configuration response is properly structured and supports the test scenarios for multi-tier analysis functionality.


70-72: LGTM! Proper MSW server lifecycle management.

The server lifecycle hooks are correctly implemented to ensure clean test isolation.


106-129: LGTM! Comprehensive test coverage for disabled multi-tier analysis.

The test correctly verifies that the analysis disabled icon is not rendered when multi-tier analysis is disabled, using appropriate mocking and assertions.


131-154: LGTM! Proper test coverage for analysis disabled scenario.

The test correctly verifies the rendering of the analysis disabled icon when multi-tier analysis is enabled but the specific tier has analysis disabled.


156-168: LGTM! Correct test for enabled analysis scenario.

The test properly verifies that the analysis disabled icon is not rendered when both multi-tier analysis and tier-specific analysis are enabled, using appropriate scoping with within.

8000
@KillahDillah KillahDillah marked this pull request as draft July 3, 2025 22:40
@KillahDillah KillahDillah marked this pull request as ready for review July 9, 2025 18:05
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae4869d and ae204c6.

📒 Files selected for processing (7)
  • packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx (5 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx (3 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (3 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (1 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryList.test.tsx (6 hunks)
  • packages/javascript/js-client-library/src/types.ts (1 hunks)
🚧 Files skipped from review as they are similar to p 8000 revious changes (3)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)
packages/javascript/js-client-library/src/utils/config.ts (1)
  • parseTieringConfiguration (145-152)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx (2)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)
  • hasMultiTierAnalysisEnabled (35-40)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/utils.tsx (1)
  • TIER_ZERO_ID (20-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build BloodHound Container Image / Build and Package Container
  • GitHub Check: build-ui
  • GitHub Check: run-tests
  • GitHub Check: run-analysis
🔇 Additional comments (6)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)

17-17: LGTM: Clean import addition.

The parseTieringConfiguration import is correctly added to support the new function.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryList.test.tsx (2)

49-49: LGTM: Mock data updated to match new type definition.

The addition of analysis_enabled: false to the mock data correctly aligns with the updated AssetGroupTag interface where this field is now required.

Also applies to: 69-69


82-82: LGTM: Consistent formatting improvement.

The formatting of the onSelect prop is now consistent across all test cases.

Also applies to: 93-93, 104-104, 117-117

packages/javascript/js-client-library/src/types.ts (1)

85-85: LGTM: Type definition updated to support new UI requirements.

The change from optional boolean | undefined to required boolean | null ensures consistent handling of the analysis enabled state across all components. This aligns with the UI changes where the field is now consistently used.

Note: This is a breaking change that requires all existing AssetGroupTag objects to include the analysis_enabled field.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx (2)

111-113: LGTM: Cleaner configuration handling.

The code now uses the centralized hook instead of duplicating configuration parsing logic, which improves maintainability and consistency.

Note: The hook name will need to be updated once the naming convention is fixed in the source.


293-293: Clarify the use of checked={toggleEnabled || undefined}
File: packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx
Lines: 293-293

Changed from:

- checked={toggleEnabled}
+ checked={toggleEnabled || undefined}

risks passing undefined whenever toggleEnabled is false, which can turn a controlled Switch into an uncontrolled one. The checked prop on DoodleUI’s Switch likely expects a boolean, not undefined. If this was added solely to satisfy a TypeScript signature (boolean | undefined), it’s better to:

  • Refine toggleEnabled’s type so it’s always boolean, or
  • Explicitly cast with !!toggleEnabled, or
  • Remove the || undefined if the component’s prop is strictly boolean.

Please verify:

  • Does @bloodhoundenterprise/doodleui’s Switch checked prop accept undefined?
  • Was this change added to work around a TS error?
  • If the prop is strictly boolean, revert to checked={toggleEnabled}; otherwise confirm that the uncontrolled behavior is intentional.

@KillahDillah KillahDillah marked this pull request as draft July 10, 2025 20:55
@KillahDillah KillahDillah force-pushed the BED-6056-disabled-tiers-icon branch from 2b89e47 to dc0effd Compare July 11, 2025 20:37
@KillahDillah KillahDillah marked this pull request as ready for review July 12, 2025 00:45
Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/TierAnalysisIcon.tsx (1)

29-29: Consider using theme variables instead of hardcoded colors.

The orange color #ED8537 is hardcoded. Consider using CSS custom properties or theme variables for better maintainability and consistency with the design system.

-                            className={clsx(iconClasses, 'mr-2 text-[#ED8537]')} />
+                            className={clsx(iconClasses, 'mr-2 text-orange-500')} />
-            className={clsx(iconClasses, 'mr-2 text-[#ED8537]')}
+            className={clsx(iconClasses, 'mr-2 text-orange-500')}

Also applies to: 42-42

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46f1c22 and a1f389a.

📒 Files selected for processing (9)
  • packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (4 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx (3 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx (5 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/TierAnalysisIcon.tsx (1 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/index.tsx (1 hunks)
  • packages/javascript/js-client-library/src/types.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/index.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/javascript/js-client-library/src/types.ts
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx
  • packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Save/TagForm/TagForm.tsx
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx
🧰 Additional context used
🧠 Learnings (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (1)
Learnt from: mistahj67
PR: SpecterOps/BloodHound#1648
File: cmd/api/src/api/v2/assetgrouptags.go:763-766
Timestamp: 2025-07-09T00:36:54.112Z
Learning: In cmd/api/src/api/v2/assetgrouptags.go, the SearchAssetGroupTags method intentionally fetches all asset group tags and selectors without database-level filtering because it needs to build a complete `kinds` array from all relevant tags for the graph query filter. This allows members to be searched across all tags of the requested type while still filtering the returned tags/selectors by name match.
🧬 Code Graph Analysis (2)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/TierAnalysisIcon.tsx (2)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)
  • usePrivilegeZoneAnalysis (35-44)
packages/javascript/bh-shared-ui/src/components/AppIcon/AppIcon.tsx (1)
  • AppIcon (28-28)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (1)
packages/javascript/js-client-library/src/types.ts (1)
  • AssetGroupTagTypeTier (56-56)
🔇 Additional comments (4)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.test.tsx (2)

74-87: Well-structured mock server setup.

The configuration response and server setup using MSW is well-implemented with proper lifecycle management. This provides a clean way to test different configuration scenarios.


127-184: Comprehensive test coverage for conditional icon rendering.

The three new test cases thoroughly cover the different scenarios:

  1. Icon not rendered when multi-tier analysis is disabled
  2. Icon rendered when analysis is enabled but tier analysis is off
  3. Conditional rendering per item when analysis is enabled

The use of within() to scope queries to specific list items and the proper use of synchronous query methods (queryByTestId, getByTestId) shows good testing practices.

packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.test.tsx (2)

30-36: Good practice using async import for mocking.

The updated mock for useAppNavigate properly uses async import to preserve the actual module exports while overriding only the specific function. This is a more robust mocking approach.


100-164: Consistent and thorough test coverage.

The three new test cases follow the same comprehensive testing pattern as DetailsList.test.tsx, providing consistent coverage across components. The proper use of:

  • Mock server for configuration responses
  • Scoped queries with within()
  • Synchronous query methods (queryByTestId, getByTestId)
  • Async operations with proper awaiting

This demonstrates good testing practices and maintains consistency across the test suite.

@KillahDillah KillahDillah force-pushed the BED-6056-disabled-tiers-icon branch from e2c12b9 to a849e41 Compare July 14, 2025 17:03
Copy link
Contributor
@coderabbitai coderabbitai bot E6FF left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/ZoneAnalysisIcon.tsx (1)

29-29: Consider using design system colors instead of hardcoded hex values.

The hardcoded color #ED8537 should ideally be defined in your design system for better maintainability and consistency.

If you have design system color tokens available, consider replacing the hardcoded value:

-className={clsx(iconClasses, 'mb-0.5 mr-2 text-[#ED8537]')}
+className={clsx(iconClasses, 'mb-0.5 mr-2 text-warning-500')}

Also applies to: 42-42

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19580d2 and 11f9313.

📒 Files selected for processing (5)
  • packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx (3 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx (2 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/ZoneAnalysisIcon.tsx (1 hunks)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/index.tsx
  • packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Details/DetailsList.tsx
  • packages/javascript/bh-shared-ui/src/views/ZoneManagement/Summary/SummaryCard.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/javascript/bh-shared-ui/src/views/ZoneManagement/ZoneAnalysisIcon.tsx (2)
packages/javascript/bh-shared-ui/src/hooks/useConfiguration.ts (1)
  • usePrivilegeZoneAnalysis (35-41)
packages/javascript/bh-shared-ui/src/components/AppIcon/AppIcon.tsx (1)
  • AppIcon (28-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build BloodHound Container Image / Build and Package Container
  • GitHub Check: build-ui
  • GitHub Check: run-analysis
  • GitHub Check: run-tests

@KillahDillah KillahDillah force-pushed the BED-6056-disabled-tiers-icon branch from e93d6f2 to 6a2a995 Compare July 15, 2025 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user interface A pull request containing changes affecting the UI code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0