Repository navigation
Conversation
盘级取数的筛选器绑定默认只来自已落库的 layout_json,请求里出现未知 widgetId 会被 静默忽略 —— 于是本次会话新拖入、或改了配置还没保存的筛选器「配好取值却没反应」, 新用户配第一个筛选器时必然踩中(issue #172 / 用户信号 S13)。 - 请求契约:DashboardQueryFilter 增加可选 binding + operator;未落库的筛选器由前端 随值下发,后端 mergeRequestFilterBindings 并入 layout 投影(同名以请求为准,覆盖 「改了没保存」的情况);已落库的筛选器省略这两个字段,行为不变。 - 前端:queryWithState 不再按落库过滤筛选器,载荷带上 binding/operator;移除块上 「保存仪表盘后生效」提示(该边界已不成立)。 - 文档:AGENTS.md / features.md / troubleshooting.md 同步该口径。 - 验证:go test -race ./... 全绿;biome check + vitest 793 用例全绿;真实浏览器 E2E (headless Chrome/CDP):新增未落库 region 筛选器 → 图表立即由 4 柱收窄为 1 柱, 请求体带 binding/operator,后端 SQL 出现 WHERE region IN (?)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
修 issue #172(P0 / 用户信号 S13):本次会话新拖入、或改了配置还没保存的盘级筛选器,配好取值后立刻作用到图表,不再要求先保存整个仪表盘。
怎么做的
根因:
POST /api/dashboards/{id}/query的筛选器绑定只来自已落库的layout_json,请求里出现未知widgetId会被静默忽略 —— 未落库的筛选器发出去也白跑。方案取 issue 里的方案 ①(前端本地合并 → 请求透传),最小改动:api/openapi.yaml):DashboardQueryFilter增加可选binding {datasetId, column}+operator,供未落库筛选器随值下发;已落库的筛选器省略即可。service/dashboard/query.go):新增mergeRequestFilterBindings,把请求自带的绑定并入 layout 投影 —— 同名widgetId以请求为准(覆盖「改了算子/绑定没保存」的情况);不带绑定的请求项(老写法)行为完全不变。DashboardEditor.tsx/lib/dashboardFilterValue.ts):queryWithState不再按落库过滤筛选器;载荷对带 binding 的块一并下发binding+operator。AGENTS.md/features.md/troubleshooting.md同步口径。验证
go test -race ./...全绿(新增mergeRequestFilterBindings表驱动用例 + 未落库筛选器被认领/请求绑定覆盖 layout 两个端到端用例)。biome check无 error(仅 5 个既有 CSS warning);vitest793 用例全绿(新增「未落库筛选器带 binding 下发」「已落库等价绑定」等用例)。{"page_id":"p-recovered-0","filters":[{"widgetId":"w-…","value":["华东"],"binding":{"datasetId":1,"column":"0000xpwz"},"operator":"in"}],"linkages":[]}(改动前此筛选器会被整体丢弃,filters为空)。SELECT region, SUM(amount) AS "amount" FROM sales_orders WHERE region IN (?) GROUP BY region;图表由 4 柱收窄为 1 柱(截图确认)。["华东","华南"]→IN (?, ?)两柱;清空取值 →filters: []、图表回到 4 柱;保存后(筛选器转正)仍照常生效,无回归。已知残留边界(未扩大范围)
未保存的图表块走本地取数(
GET /api/charts/{id}/data),不带盘级筛选 —— 新增筛选器只作用到已保存的图表块。此限制在 issue #172 之前即存在,已在AGENTS.md/features.md/troubleshooting.md注明。备注
make api-gen生成的后端idls/gen_types.go已随之重跑(含一处既有的字段排序漂移,3 行,非本次语义改动);前端idls/gen_types.ts未重跑 —— 该生成物本身落后于 openapi(缺linkages/total),重跑会带入无关漂移,故按既有约定在api/index.ts的手写薄层补齐(本次载荷类型为手写DashboardQueryFilterValue,无需改生成物)。证据截图:
/tmp/e2e-2-filtered.png(华东单柱)、/tmp/e2e-3-two-regions.png(两柱)、/tmp/e2e-4-cleared.png(清空回四柱)。🤖 开发 Agent 自动提交,等待评审 Agent Review + E2E。