Add the dashboard date filter bar and editor

Draft
EH
1h ago
+2685-278

What

Dashboards get a date filter bar under the tabs. Editors create a shared date filter from a bar, line, or pie chart's Filter settings, connect other charts to it, and choose its default. Viewers change the date from the bar, and Reset returns to the saved default.

All the UI for dashboard date filters is here, on top of the server side in #32378. It includes the viewer controls from #32380, which moved here so #32378 is server only.

How

  • Viewer. A tab shows a filter when a visible chart is connected to it. The chip and date pickers are the view filter ones. Selections stay in the browser.
  • Create and connect. The variable picker on a chart's date rule lists compatible dashboard filters and opens a name-only Create page. A connected rule shows the field and an inline chip. Its remove button disconnects that chart.
  • Edit. In edit mode the chip opens the date picker and the filter's side panel, with the name, Used by, and Delete dashboard filter in the footer menu. Charts already reflect the draft default while editing, including a chart connected a moment ago. Save persists the name, default, and connections. Cancel discards them.
  • Dates and times. Before and After or equal support a time when a connected field stores timestamps. A connected chart keeps its own saved time zone.
  • Save. The editor uses the existing layout save mutation. After a successful save the draft takes the saved filter list, so a filter created and saved in one session can be changed or deleted without a reload.
  • Gated by IS_DASHBOARD_FILTERS_ENABLED.

Testing

  • 1,865 frontend tests pass across the page layout, side panel, view chip, and filter dropdown folders. New coverage: viewer Reset and tab changes, the rules a draft filter adds per chart, and the save input (name or default without rewriting connections, a deleted filter left out).
  • Typecheck, lint, and formatting passed locally.
  • Tried in a local app: created a filter from a chart, connected a second chart, renamed it, set a default, saved, changed and reset it as a viewer, then deleted it. Checked both a filter saved earlier and one created in the same session, with a reload after each.
  • Not tried in the app: a pie chart in edit mode.

Browser test

  1. Enable IS_DASHBOARD_FILTERS_ENABLED and open a dashboard with two charts on an object that has a date field.
  2. Click Edit, select a chart, open Filter, and add a rule on the date field. Click the variable button, then New dashboard filter, then Create. The chip appears in the bar before saving.
  3. Connect the second chart by picking the existing filter. Open the chip, check Used by lists both charts, and choose a default. Both charts update. Save.
  4. As a viewer, change the date. Only connected charts update. Reset restores the default.
  5. Edit again, open the chip, and choose Delete dashboard filter from the footer menu. Save and reload: the chip is gone.