Skip to content

refac: unified expression filter component across explore, canvas, alerts and reports - #9746

Open
AdityaHegde wants to merge 28 commits into
mainfrom
refac/unified-filter-component
Open

refac: unified expression filter component across explore, canvas, alerts and reports#9746
AdityaHegde wants to merge 28 commits into
mainfrom
refac/unified-filter-component

Conversation

@AdityaHegde

@AdityaHegde AdityaHegde commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

We have 3 different filter implementation across explore, canvas, alerts and reports with action code like toggling dimension value duplicated. This PR unifies expression filters components.

  1. ExpressionFilter.svelte acts as the unified filter component that takes a ExpressionFilterManager.
  2. ExpressionFilterManager contains MetricsViewFilterManager per configured metrics views. It also has the full list of DimensionFilterManager/MeasureFilterManager across metrics views, deduped by name. Takes all the filters from MetricsViewFilterManager and creates a sorted list for default filters bar, required first, followed by pinned, followed by dimension and finally measure filters.
  3. MetricsViewFilterManager is a wrapper per joiner. For existing filter bar it is always an AND joiner. Future PR will support more advanced editing like OR filter and nested AND/OR. Ensures pinned/required filters have an entry. Also handles adding new dimension/measure filter.
  4. DimensionFilterManager encapsulates all actions for a dimension filter. This code was spread out in different places. Along with DimensionFilter.svelte it handles everything for a dimension filter.
  5. Similarly, MeasureFilterManager encapsulates all actions for a measure filter. Along with MeasureFilter.svelte it handles everything for a measure filter.
  6. All of this depends on MetricsViewsProvider. All dimension and measure selectors are come from here.
  7. It also depends on YAMLConfigProvider that provide config that is yaml only and not maintained as a state while rendering dashboard. Currently this has required/pinned filters.
  8. Adds a DashboardConfigProvider for quickly building ExploreDashboardConfigProvider or CanvasDashboardConfigProvider.

For explore,

  1. Adds ExpressionFilterManager to StateManagers.
  2. Replaces the old filter component with the new ExpressionFilter.svelte passing it the ExpressionFilterManager from StateManagers.
  3. Replaces actions/selectors references in leaderbord, dimension table and other places to using ExpressionFilterManager directly.

For canvas,

  1. Adds ExpressionFilterManager to CanvasEntity.
  2. Replaces the old actions with calls to this ExpressionFilterManager.
  3. Still used the old timeAndFilterStore but uses data from parent's ExpressionFilterManager for expression related fields.

There will be a follow up to move time controls as well.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@nishantmonu51 nishantmonu51 added Type:Improvement Area:Dashboard Size:XL Very large change: 2,000+ lines labels Aug 4, 2026
@AdityaHegde AdityaHegde changed the title refac: unified filter component across explore, canvas, alerts and reports refac: unified expression filter component across explore, canvas, alerts and reports Aug 6, 2026
@AdityaHegde
AdityaHegde force-pushed the refac/unified-filter-component branch from fb87403 to 0e9eb72 Compare August 10, 2026 14:20
@AdityaHegde
AdityaHegde force-pushed the refac/unified-filter-component branch from 21c97f9 to cc9c8e9 Compare August 11, 2026 12:57
@AdityaHegde
AdityaHegde marked this pull request as ready for review August 19, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area:Dashboard Size:XL Very large change: 2,000+ lines Type:Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants