Skip to content

Conversation

@briangregoryholmes
Copy link
Contributor

@briangregoryholmes briangregoryholmes commented Nov 25, 2025

This PR adds support for specifying default time, dimension and measure filters when loading a Canvas dashboard for the first time. When using the builder surface in Rill Developer, the workspace provides a quick way to save the currently selected filters as default, which propagate to the YAML as metrics SQL statements:

type: canvas
defaults:
  time_range: 6h as of latest/m+1m
  filters:
    AdBids_metrics: (publisher IN ('Facebook', 'Google')) AND (publisher IN (SELECT publisher
      FROM metrics_view HAVING total_records > 200))

To support the use of multiple metrics views across a single canvas, these metrics SQL filters are keyed with the name of the underlying metrics view.

  • Filters are handled on a per-metrics-view basis via instances of the new FilterState class
  • Filter consolidation and rendering across multiple FilterState classes happens through the new FilterManager
  • URL filters are keyed with a string that takes the form f.{{metrics_view_name}}
  • Each FilterState class has actions on it that allow for filter state manipulation
  • The FilterManager class has proxies for these functions to call them across multiple FilterState classes
  • Consolidation of the namespace across multiple metrics views currently assumes that all dimensions/measures with equivalent identifiers are the same
  • Canvas initialization now happens through the CanvasProvider component no matter where a Canvas is rendered
  • When adding a filter for a measure/dimension that exists across multiple metrics views, it is added to each FilterState class (and to the URL) independently, though the actual URL navigation is batched for each user action
  • Canvas loading, url param syncing and redirecting happens through the onUrlChange function as well as updated getters and setters in canvas/state-managers.ts
  • Removes use of RuntimeProvider for embeds, sets the runtime in the topmost layout load function instead
  • A new "save defaults" button is added to update the YAML defaults with the current filter state
  • Refactors canvas time state management to use TimeManager and TimeState classes

Outstanding items:

  • Update designs (and implementation) to reflect "pin" behavior rather than lock @Di7design
  • Remove old Filter class if possible
  • Ensure changes did not break Explore
  • Ensure prior filter strings (without scoped metrics view) work as intended
  • Fix tests
  • Abstract UI filter parsing method and apply to defaults
  • Fix issue with measure filter pills not updating on first apply
  • Update CanvasFilterButton to display labels rather than unique ids
  • Match sidebar design to Figma
  • Add pinning capability to measures
  • Resolve issue where unpinning does not immediately reflect in pill
  • Add "saved as default" state to button when viewing defaults
  • Resolve issue where filter dropdown reopens after applying selections
  • Bring back measure-specific dimension lists

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!

Note

Adds per-metrics-view canvas filtering with pinning and saved defaults, updates URL/schema and parser, refactors initialization/embeds, and introduces new UI to manage and display default/pinned filters.

  • Canvas filtering overhaul:
    • Introduces per-metrics-view filtering via FilterManager and MetricsViewFilter with consolidated UI/state.
    • Adds default filters and pinning (save/clear defaults; pinned chips), new inspector tabs, and read-only chips.
    • Updates URL schema to scoped filters (f.{metrics_view}) and batching of navigation.
  • Protocol & API:
    • Extends CanvasSpec with pinned_filters; CanvasPreset with filter_expr; updates Swagger/TS/Go protobufs.
    • Parser reads filters.pinned and defaults.filters from YAML.
  • Runtime/initialization:
    • New handleCanvasStoreInitialization and onUrlChange; removes RuntimeProvider for embeds; sets runtime in layout.
  • UI components:
    • New SaveDefaultsButton, default filters display; enhanced Chip (pin/gray), filter buttons/chips; time/comparison tweaks.
  • Embeds/routes:
    • Canvas embed and app routes refactored to initialize/store canvas and sync URL.
  • Cleanup & tests:
    • Removes old Filters class; updates bookmark handling and tests to new comparison/filters.

Written by Cursor Bugbot for commit defa8bf. This will update automatically on new commits. Configure here.

@briangregoryholmes briangregoryholmes self-assigned this Nov 26, 2025
@Di7design
Copy link

See Figma here.
Screenshot 2025-11-26 at 9 48 23 AM

@nishantmonu51
Copy link
Collaborator

@briangregoryholmes : Is this ready for review ? Still on track for the release next week?

Copy link
Collaborator

@AdityaHegde AdityaHegde left a comment

Choose a reason for hiding this comment

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

This is a bit too large for a 100% review. Approving this as a 90% review.

Copy link
Contributor

@ericokuma ericokuma left a comment

Choose a reason for hiding this comment

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

UX looks good to me

@Di7design

@Di7design
Copy link

UX looks good to me

@Di7design

This branch is functional, but we might need further iteration.

@ericokuma
Copy link
Contributor

Looks good @briangregoryholmes

@briangregoryholmes briangregoryholmes merged commit 0be210e into main Dec 11, 2025
14 checks passed
@briangregoryholmes briangregoryholmes deleted the bgh/default-filters branch December 11, 2025 20:31
@ericokuma
Copy link
Contributor

Great job everyone!

briangregoryholmes added a commit that referenced this pull request Dec 17, 2025
* wip

* wip

* cleanup and qa

* rudimentary pinning UI and cleanup

* wip measure support

* pinning fixes

* hide no filters added when adding a temporary filter

* show measure pills in default filters sidebar

* reorg

* cleanup

* initial measure apply fix

* display labels instead of ids

* add saved as default state

* remove import

* add pinning to measures, update designs

* resolve issue with filters opening after apply

* design update

* gofumpt

* revert

* sorting

* default bug fixes

* save as default button states

* quality checks

* feedback and qa

* delete file

* quality check fix

* save as default when no time range param present in url fix

* remove import

* bug fixes and qa

* fix: save default state button incorporates pinned state

* remove log

* cleanup

* remove logs

* remove logs

* rework sorting

* temp bug fix

* embed bug fixes, qa and cleanup

* remove comment

* move constructor

* comment

* remove unused function

* remove imports

* test fix

* revert temporary change

* bookmarks test fixes

* quality check

* test fixes

* remove logs

* unused variable

* test fixes

* filter opening fix

* remove file

* rework subscriber

* test fixes and rework

* test fix

* time control refactor

* remove comment

* revert package-lock changes

* embed test fix

* test fix

* test fixes

* test fixes

* remove log

* cleanup

* remove logs

* test and feedback changes

* feedback and fixes

* refactor init

* fix for turning off filter bar

* metricssql support first pass

* cleanup and feedback

* test fix

* remove unused import

* test fixes

* test fixes and cleanup

* test fix

* test fix attempt

* rework init of dimension filter component

* remove remaining _ prefixed stores

* flatten api returned expressions

* remove function input

* add rudimentary tests

* add test

* update default ranges

* store pinned state locally on dropdown before applying

* support canvases with no time dimension

* uncomment components and remove log

* change first day of week function to check for time dimension

* support metrics sql templating in markdown

* type fix

* cleanup

* refine comment

* variable name

* remove unused property

* rename API

* format
k-anshul pushed a commit that referenced this pull request Dec 18, 2025
* wip

* wip

* cleanup and qa

* rudimentary pinning UI and cleanup

* wip measure support

* pinning fixes

* hide no filters added when adding a temporary filter

* show measure pills in default filters sidebar

* reorg

* cleanup

* initial measure apply fix

* display labels instead of ids

* add saved as default state

* remove import

* add pinning to measures, update designs

* resolve issue with filters opening after apply

* design update

* gofumpt

* revert

* sorting

* default bug fixes

* save as default button states

* quality checks

* feedback and qa

* delete file

* quality check fix

* save as default when no time range param present in url fix

* remove import

* bug fixes and qa

* fix: save default state button incorporates pinned state

* remove log

* cleanup

* remove logs

* remove logs

* rework sorting

* temp bug fix

* embed bug fixes, qa and cleanup

* remove comment

* move constructor

* comment

* remove unused function

* remove imports

* test fix

* revert temporary change

* bookmarks test fixes

* quality check

* test fixes

* remove logs

* unused variable

* test fixes

* filter opening fix

* remove file

* rework subscriber

* test fixes and rework

* test fix

* time control refactor

* remove comment

* revert package-lock changes

* embed test fix

* test fix

* test fixes

* test fixes

* remove log

* cleanup

* remove logs

* test and feedback changes

* feedback and fixes

* refactor init

* fix for turning off filter bar

* metricssql support first pass

* cleanup and feedback

* test fix

* remove unused import

* test fixes

* test fixes and cleanup

* test fix

* test fix attempt

* rework init of dimension filter component

* remove remaining _ prefixed stores

* flatten api returned expressions

* remove function input

* add rudimentary tests

* add test

* update default ranges

* store pinned state locally on dropdown before applying

* support canvases with no time dimension

* uncomment components and remove log

* change first day of week function to check for time dimension

* support metrics sql templating in markdown

* type fix

* cleanup

* refine comment

* variable name

* remove unused property

* rename API

* format
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.

7 participants