Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 10, 2026

When configuring vertical/horizontal bar charts with multiple dimensions in structural mode (e.g., "Endpoint" + "Vulnerable Endpoint"), the breakdown field dropdown incorrectly shows all fields from all dimensions. Selecting a dimension-specific field (e.g., "Platform" from "Vulnerable Endpoint") causes the widget to display only that dimension's data, dropping others entirely.

Changes

Modified HistogramParameters.tsx to filter breakdown fields to the intersection of fields common across all selected dimensions:

  • Multi-dimension detection: When mode === 'structural' && entities.length > 1, fetch schemas per entity separately instead of combining them
  • Field intersection: Calculate common fields using Set operations for O(1) lookups
  • Auto-clear invalid selections: Clear previously selected breakdown field if it no longer exists in the filtered options
  • Safety: Handle empty entity lists gracefully
// Before: Combined schemas show all fields from all dimensions
engineSchemas(entities).then(response => {
  // Shows fields from ALL entities mixed together
});

// After: Calculate intersection of fields
Promise.all(entities.map(entity => engineSchemas([entity])))
  .then(responses => {
    const entityFieldSets = responses.map(r => 
      new Set(getEntityPropertiesListOptions(r.data, ...).map(o => o.id))
    );
    // Only show fields that exist in ALL dimensions
    const commonFields = [...entityFieldSets[0]].filter(id =>
      entityFieldSets.every(set => set.has(id))
    );
  });

Impact

Affects vertical-barchart and horizontal-barchart in structural mode with multiple dimensions. Single-dimension widgets, temporal mode, and widgets with predefined fields (security-coverage, attack-path) unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>Multi-dimension in not well supported on vertical widget</issue_title>
<issue_description>## Environment
OpenBAS version: 1.18.18

Reproducible Steps

  • Create a vertical bar widget with two different dimensions (e.g., "Endpoint" and "Vulnerable Endpoint")
Image
  • Select "Structural" mode
  • Observe: Breakdown field dropdown shows all fields from both dimensions
Image
  • Select a breakdown field that belongs to "Vulnerable Endpoint"

Current Behavior

  • Widget displays only Vulnerable Endpoint data, completely ignoring Endpoint dimension data

Proposed Solutions

Option A: Restrict users to selecting only one dimension per widget
Option B: Enable dimension-specific breakdown selection (separate breakdown for each dimension)

⚠️ Check if the problem is present on other widgets</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix multi-dimension support in vertical widget Fix breakdown field filtering for multi-dimension structural widgets Jan 10, 2026
Copilot AI requested a review from SamuelHassine January 10, 2026 21:35
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.57%. Comparing base (b8c0b6a) to head (9b10a9d).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #4713   +/-   ##
=========================================
  Coverage     50.57%   50.57%           
  Complexity     3708     3708           
=========================================
  Files           903      903           
  Lines         26819    26819           
  Branches       2012     2012           
=========================================
  Hits          13563    13563           
  Misses        12437    12437           
  Partials        819      819           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Multi-dimension in not well supported on vertical widget

2 participants