eschutho opened a new pull request, #43736:
URL: https://github.com/apache/superset/pull/43736

   ### SUMMARY
   
   Dashboard builders can configure a **Group By** native filter (the Dynamic 
Group By chart customization, `chart_customization_dynamic_groupby`), but until 
now viewers could group by **any** groupable column of the underlying dataset. 
This PR lets the builder curate an **allowlist** of columns that viewers are 
allowed to group by.
   
   Tracking: [Shortcut sc-119327](https://app.shortcut.com/preset/story/119327)
   
   **What changed**
   
   - **Builder config panel** (`FiltersConfigForm.tsx`): adds a multi-select 
**"Groupable columns"** control for the Group By filter, reusing the existing 
`ColumnSelect` in `mode="multiple"`. The selection is the allowlist. It renders 
only for the Dynamic Group By customization and only once a dataset is chosen. 
Changing the dataset clears the allowlist so it can't hold stale, 
dataset-specific column names.
   - **Persistence**: the selection is stored in the customization's 
`controlValues.columnsAllowlist`. `controlValues` is already serialized with 
the customization, so the allowlist survives **save/reload** and **dashboard 
export/import** with **no backend changes**.
   - **Viewer** (`GroupByFilterCard.tsx`): filters the offered column options 
through the allowlist via a small pure helper `applyColumnAllowlist`.
   - **Backwards compatible**: an **unset or empty** allowlist means **no 
restriction**. Existing Group By filters (which never stored an allowlist) keep 
offering every groupable column exactly as before.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   _N/A — mechanical UI addition; see testing instructions to reproduce 
locally._
   
   ### TESTING INSTRUCTIONS
   
   Automated (frontend):
   
   ```
   cd superset-frontend
   npm test -- \
     
src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.test.tsx
 \
     
src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/GroupByColumnAllowlist.test.tsx
 \
     
src/dashboard/components/nativeFilters/FiltersConfigModal/transformers/customizationTransformer.test.ts
   ```
   
   Covers: the filtering helper (allowlist unset/empty → all columns; non-empty 
→ only allowlisted, ignoring non-existent entries), the viewer only rendering 
allowlisted options (and all options when unconfigured), the config-form 
control rendering and reading back its persisted value, and 
`controlValues.columnsAllowlist` surviving the save transform.
   
   Manual:
   1. On a dashboard, add a **Group By** native filter and pick a dataset.
   2. In its config, set **"Groupable columns"** to a subset of columns; save.
   3. As a viewer, confirm the Group By filter only offers that subset.
   4. Clear the selection (empty) and confirm all groupable columns are offered 
again (backwards-compatible default).
   5. Export the dashboard and re-import it; confirm the allowlist is preserved.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to