sadpandajoe opened a new pull request, #44617:
URL: https://github.com/apache/superset/pull/44617
### SUMMARY
When editing a physical dataset, toggling "Normalize column names" on
changes the
casing of every column in the dataset. Existing charts and dashboard filters
built
against the old-cased column names will break, but until now the only
warning was a
generic alert shown on save that doesn't mention this field or its
consequence at all.
This adds a specific warning that appears immediately when the checkbox is
toggled on,
before the user saves, so they can make an informed decision (e.g. cancel
and check
which charts reference this dataset first) instead of discovering the
breakage after
the fact.
### ROOT CAUSE
No field-specific side effect existed for `normalize_columns` in the dataset
editor.
The only existing warning was `DatasourceModal`'s generic on-save alert,
which fires
for any change to any field and does not call out this field's specific,
wider-reaching
consequence.
### THE FIX
`DatasourceEditor` now captures the dataset's `normalize_columns` value once
when the
editor opens (`normalizeColumnsBaseline`) and shows an inline warning
whenever the
live value differs from that baseline (i.e. it was toggled on during this
edit
session). The baseline is captured via `useState` rather than compared
against the
live prop, since the parent component echoes edits back down as a new prop
on every
change - comparing against the live prop would make the warning disappear
again
immediately after it appeared.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: toggling "Normalize column names" on shows no warning until the
dataset is
saved, at which point only a generic "this affects all charts" alert appears.
After: toggling the checkbox on immediately shows a warning specific to the
casing
change and its impact on existing charts/filters, visible for the rest of
the editing
session until the checkbox is toggled back off.
### TESTING INSTRUCTIONS
1. Open an existing physical dataset for editing and go to the Settings tab.
2. Toggle "Normalize column names" on - a warning should appear immediately,
before
saving, stating that this will change column casing and break existing
charts and
dashboard filters referencing the old names.
3. Toggle it back off - the warning should disappear.
4. Open a dataset that already has "Normalize column names" enabled - no
warning
should appear for the already-enabled state.
5. Automated coverage:
`DatasourceEditorNormalizeColumnsWarning.test.tsx` covers toggle-on,
toggle-off,
already-enabled, and the case where a parent component echoes the edit
back down
as a new prop (regression test for the exact failure mode above).
### 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
--
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]