Introduce required/mandatory filters#9493
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AdityaHegde
left a comment
There was a problem hiding this comment.
Is a UI toggle for required filter a future thing? We have one for pin in the filter dropdown.
| r.CanvasSpec.Rows = rows | ||
| r.CanvasSpec.SecurityRules = rules | ||
| r.CanvasSpec.PinnedFilters = tmp.Filters.Pinned | ||
| r.CanvasSpec.RequiredFilters = tmp.Filters.Required |
There was a problem hiding this comment.
We should have validation for this to ensure it is defined in metrics view's measure/dimensions. Since there is no no-code way to set it a validation will help with issues.
There was a problem hiding this comment.
Added validation at reconcile time in canvas.go (validateRequiredFilters) — checks each filters.required entry exists as a dimension or measure on at least one metrics view referenced by the canvas' components. Did it at the reconciler rather than the parser since dimensions live on a separate resource the parser can't see; the reconciler already has the metrics view specs in hand.
| ); | ||
| // Required filters are implicitly pinned at runtime; persist them only under | ||
| // `filters.required` to avoid duplicating them in `filters.pinned`. | ||
| const genericPinnedKeys = Array.from(pinnedFilters) |
There was a problem hiding this comment.
We should do this dedupe render time instead. When we add a toggle for required switching it on and off will removed the pinned filter.
There was a problem hiding this comment.
Moved. Pinned and required are now tracked independently in memory; convertToUIFilters treats a filter as visible when either is set, and the sort orders required + pinned ahead of everything else. saveDefaultFilters writes both lists as-is, so toggling required off no longer drops the pin.
…dupe - Validate `filters.required` names against the canvas' metrics views at reconcile time so typos surface early. - Track pinned and required filters independently; render-time treats a filter as visible when either is set, so toggling required no longer silently drops the pin. - Add a `*` required toggle next to the pin button in the dimension and measure filter dropdowns; toggling persists to `filters.required` via Save as default. - Fix doubled "the" in the dimension filter tooltip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@AdityaHegde re: the UI toggle question — added a |
…ired-filters # Conflicts: # web-common/src/features/canvas/stores/canvas-entity.ts
There is no way to mark a filter as mandatory: a canvas always renders, even if a critical filter (e.g.
region,customer_id) has been left empty. Mandatory/Required ensures that a user always filters on one or more dimension values.This PR adds support for declaring required filters on canvas dashboards, alongside the existing
pinnedfilters.filters.requiredYAML field on canvas dashboardsdefaults.filtersor the user), the canvas body is replaced with an inline panel listing the missing filters; the filter row stays interactive so the user can set values.runtime/ai/instructions/data/resources/canvas.mdupdated so the analyst and developer agents know about the new field.Checklist: