Uh oh!
There was an error while loading. Please reload this page.
feat(dashboard): enhance globalFilters with options, optionsFrom, defaultValue, scope, targetWidgets - #718
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…aultValue, scope, targetWidgets (#712) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Enhances the DashboardSchema.globalFilters protocol in @objectstack/spec to support Airtable-style filter bars with static options, dynamic option binding, defaults, and widget-level scoping.
Changes:
- Added
GlobalFilterOptionsFromSchemaand extracted/expandedGlobalFilterSchema(options/optionsFrom/defaultValue/scope/targetWidgets +lookuptype). - Updated
DashboardSchema.globalFiltersto use the newGlobalFilterSchema. - Added/expanded tests covering new global filter capabilities and marked roadmap item #712 complete.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/spec/src/ui/dashboard.zod.ts | Introduces new global filter schemas and wires them into DashboardSchema. |
| packages/spec/src/ui/dashboard.test.ts | Adds parsing/compatibility tests for enhanced globalFilters configuration. |
| ROADMAP.md | Marks issue #712 as complete. |
| /** Widget IDs to apply this filter to (when scope is widget) */ | ||
| targetWidgets: z.array(z.string()).optional().describe('Widget IDs to apply this filter to'), |
There was a problem hiding this comment.
targetWidgets is documented as “Widget IDs”, but DashboardWidgetSchema doesn’t define any stable widget identifier field (e.g. id/name). As a result, it’s unclear what strings in targetWidgets are expected to match, and consumers can’t reliably target widgets.
Consider adding an explicit widget identifier field to DashboardWidgetSchema (ideally snake_case via SnakeCaseIdentifierSchema) and clarifying that targetWidgets references that field (or rename targetWidgets to reflect the actual reference).
| /** Widget IDs to apply this filter to (when scope is widget) */ | |
| targetWidgets: z.array(z.string()).optional().describe('Widget IDs to apply this filter to'), | |
| /** Widget identifiers (DashboardWidgetSchema.widgetId) to apply this filter to (when scope is widget) */ | |
| targetWidgets: z.array(SnakeCaseIdentifierSchema).optional().describe('Widget identifiers (DashboardWidgetSchema.widgetId) to apply this filter to'), |
DashboardSchema.globalFilterslacked dynamic option binding and scoping — needed for Airtable-style filter bars where dropdowns auto-populate from object data.Schema changes (
dashboard.zod.ts)GlobalFilterOptionsFromSchema— new schema for dynamic option binding (object,valueField,labelField, optionalfilter)GlobalFilterSchema— extracted from inline definition, extended with:options— static option list{ value, label }[]optionsFrom— dynamic binding viaGlobalFilterOptionsFromSchemadefaultValue— pre-selected valuescope—'dashboard'(default) |'widget'targetWidgets— selective widget targeting'lookup'added to type enumGlobalFilter,GlobalFilterOptionsFromBackward compatibility
Old configs parse identically — all new fields are optional,
scopedefaults to'dashboard'.Tests & roadmap
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.