Skip to content

Apply dashboard date filters to chart queries - #32378

Open
ehconitin wants to merge 7 commits into
mainfrom
ehco/dashboard-filter-chart-queries
Open

ehconitin wants to merge 7 commits into
mainfrom
ehco/dashboard-filter-chart-queries

Conversation

@ehconitin

@ehconitin ehconitin commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

What

Server side of dashboard date filters. The bar, line, and pie chart data queries accept dashboard filter values and apply them on top of the chart's own filter. No UI here: the filter bar and editor are in #32389.

How

  • Input. The three chart data queries take an optional pageFilterValues list (filter id, operand, value) next to widgetId.
  • Resolution. ChartPageFilterService reads the saved chart and its saved bindings, turns each value into a rule on the bound date field, and combines it with the chart's saved filter through the existing record query compiler. Values for a chart that is not saved, or does not match the request, are rejected.
  • Pie total. A filtered pie chart returns its center metric computed over the same chart and dashboard conditions as its slices, so slice limits and overlapping groups do not change it.
  • Timestamps. Before and After or equal accept a timestamp value as well as a calendar date.
  • IS_DASHBOARD_FILTERS_ENABLED gates all of it. Builds on Save and load dashboard filter widget bindings #32230.

Testing

  • The chart data integration suite checks that the dashboard date and the chart's saved condition both apply for bar, line, and pie, including the pie center metric. It runs in CI.
  • Unit tests cover the date and timestamp default value validation.
  • Not tried in a running app: nothing sends these values until Add the dashboard date filter bar and editor #32389.

View guided diff

@ehconitin
ehconitin marked this pull request as ready for review December 4, 2026 11:45
@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🤖 PR Review

Check Result
🔍 Build safety ⏭️ skipped — external-only
🧭 Triage ⏭️ skipped — external-only
📐 Quality ✅ passed — 4 nit(s)
🛡️ Security ✅ passed
🚦 Auto-approve 👀 needs review — Too large to review reliably (+2287 lines across 25 file(s))
🔐 Permissions ⏭️ skipped: no endpoint permission change

🛡️ Security Review

✅ No high-severity vulnerabilities detected.


🚦 Auto-approve

🙋 Manual review recommended for the following reason(s):

  • Too large to review reliably (+2287 lines across 25 file(s))

  • Complexity is high

  • 🧠 Complexity: high

  • 📏 Size: +2287 / -1420 lines across 25 file(s)


View details

Automated pre-review — human approval still required.

@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🟡 Quality review · 4 findings

Safe to merge behind the flag; two non-blocking high-level nits from the earlier review are still open

High-level — This is a flag-gated, additive, server-only chart-data API for dashboard date filters, but the chart service still swaps the client's filter for the saved one and repeats binding resolution that PageLayoutFilterBindingReadService already does.
Low-level — 2 rule violations found — 1426 rule questions over 29 piece(s) of 22 file(s)

💬 4 inline comments on the diff.


Reviewed against the pr-review standard — high-level then low-level. Advisory; human review still required. Run details.

continue;
}

const binding = resolveEffectiveFlatEntity({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Nit · High-level · extend existing seams

ChartPageFilterService rebuilds the binding lookup (getPageLayoutFilterBindings → resolveEffectiveFlatEntity → isActive → validatePageLayoutFilterBindingTarget) already in PageLayoutFilterBindingReadService

The same pipeline now lives in two places (engine/metadata-modules/page-layout-filter/services/page-layout-filter-binding-read.service.ts is the other), so a change to how active or valid bindings are resolved has to be made twice or the two will drift. Add a by-widget/by-filter-id lookup to the read service and call it here.

@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5RetriggerView in Greptile

[Medium impact] The change affects dashboard chart queries across three chart types.

Fix the dropped value-free date filters before merging.

Findings

  1. P1 Value-free date filters are dropped ▶

Summary

Adds server support for dashboard date filters on bar, line, and pie charts.

  • Dashboard date filters now narrow bar, line, and pie chart results.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Chart request] --> B{Filter values supplied and flag enabled?}
  B -->|No| C[Use requested chart filter]
  B -->|Yes| D[Load saved chart and bindings]
  D --> E[Check binding targets]
  E --> F[Convert dashboard dates]
  F --> G[Compile date filters]
  G --> H[Combine with saved chart filter]
  C --> I[Run grouped chart query]
  H --> I
Loading

Reviews (1) · Last reviewed commit: "Apply dashboard date filters to chart qu..." · Reviewed by Greptile

@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🔍 Visual Regression Review — twenty-front

✅ 14 visual change(s) reviewed — all explained by this PR.

Changed: 24 · Added: 0 · Removed: 0 · Unchanged: 2155

10 item(s) to double-check (uncertain / low confidence)
Story Verdict Confidence Explained by
🟡 modules-sidepanel-snoozeaichat--day-and-time-picker uncertain 60% none (time-dependent content)
🟡 ui-data-field-input-richtextfieldinput--default uncertain 55% none
🟡 modules-objectrecord-recordform-recordformfieldinputs--address uncertain 55% none
🟡 ui-data-field-form-input-formmultirecordpicker--multiple-selection-and-session-r… uncertain 50% none
🟡 ui-input-internal-date-datepicker--clear-selection uncertain 70% none (date-dependent story)
🟡 modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection uncertain 55% none
🟡 modules-pagelayout-widgets-recordpagenotewidget--select-and-format-text uncertain 55% none
🟡 modules-ai-aichattab--new-chat-suggested-prompt uncertain 60% none (random suggested prompt)
🟡 modules-objectrecord-recordcalendar-grid--week uncertain 70% none (date-dependent story)
🟡 modules-objectrecord-recordcalendar-grid--day uncertain 60% none (date-dependent story)
Changed stories
Story Diff %
modules-sidepanel-snoozeaichat--day-and-time-picker 19%
ui-data-field-input-richtextfieldinput--default 16%
modules-objectrecord-recordform-recordformfieldinputs--address 11%
ui-data-field-form-input-formmultirecordpicker--multiple-selection-and-session-reset 5%
modules-pagelayout-widgets-recordpagenotewidget--dashboard-selection 1%
modules-pagelayout-widgets-recordpagenotewidget--select-and-format-text 1%
ui-input-internal-date-datepicker--clear-selection 1%
modules-sidepanel-composerpages--calendar-event-without-account-permission 0%
modules-sidepanel-composerpages--calendar-event-without-accounts 0%
modules-objectrecord-recordcalendar-grid--week 0%
modules-objectrecord-recordcalendar-grid--month 0%
modules-sidepanel-recordcreationflow--submit-with-button 0%
modules-sidepanel-recordcreationflow--submit-with-command-enter 0%
modules-sidepanel-recordcreationflow--retry-after-failed-creation 0%
modules-sidepanel-recordcreationflow--submit-with-control-enter 0%
modules-ai-aichattab--new-chat-suggested-prompt 0%
modules-objectrecord-recordcalendar-grid--day 0%
modules-ai-aichattab--open-original-from-reply 0%
pages-settings-mcpservers-settingsaimcpserverdetail--sync-keeps-unsaved-edits 0%
modules-sidepanel-composerpages--calendar-event 0%
modules-activities-files-videopreview--player 0%
modules-activity-taskgroups--empty 0%
modules-ai-aichattab--reply-to-teammate 0%
modules-settings-mcp-settingsmcpsetup--default 0%

View run details · advisory mode

@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

🚀 Preview Environment Ready!

Your preview environment is available at: https://proportion-tried-queries-camp.trycloudflare.com

This environment will automatically shut down after 5 hours.

@ehconitin ehconitin changed the title Apply dashboard date filters to bar, line, and pie charts Add dashboard date filters for bar, line, and pie charts Dec 4, 2026
@ehconitin
ehconitin force-pushed the ehco/dashboard-filter-chart-queries branch from f31d6b3 to a4618a5 Compare December 5, 2026 09:05
@ehconitin ehconitin changed the title Add dashboard date filters for bar, line, and pie charts Apply dashboard date filters to chart queries Dec 5, 2026
@twenty-ci-bot-public

twenty-ci-bot-public Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

🔍 Visual Regression Review — twenty-ui

✅ No visual changes to review.

Changed: 3 · Added: 0 · Removed: 0 · Unchanged: 1539

Changed stories
Story Diff %
ui-components-datepicker-interactions--css-variable-spacing 0%
ui-components-datepicker-interactions--external-month-change 0%
ui-icon-icon--constrained-rows 0%

View run details · advisory mode

},
queryContext,
),
shouldIncludeUngroupedAggregate && isDefined(pageFilters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Nit · Low-level · Return early

A large multi-line ternary with a nested ternary for the filter (lines 331-336) is added inline in the array, which is harder to read than early-returned or extracted conditional logic.

Also on lines 329–343.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant