kgabryje opened a new pull request #15302: URL: https://github.com/apache/superset/pull/15302
### SUMMARY When new native filter was created, "Apply to all panels" scope was always selected by default. In the case of dashboards that have charts built on multiple datasets (e.g. `Slack Dashboard` from test data), filter that uses given dataset usually is incompatible and does not have any effect on charts that use a different dataset. This PR implements "smarter" selection of default scope - when user created a new filter, charts that use different dataset than the filter will be unselected. Changing dataset updates the default scoping tree, but only if the user didn't make any changes there - if the user changes selection in the scoping tree and then changes dataset, we don't update the tree automatically. The feature takes effect only on new filters. Once a filter is saved, we don't apply default selection to the scopong tree upon editing the filter and its dataset. Next to "incompatible" charts I added an icon with a tooltip that explains why those charts were not selected by default. I used `Info` icon for that purpose. Other icons that I considered were `Alert` and `Warning` , but since potentially a lot of those icons can appear next to each other, I didn't want to use something too "aggressive". I'd greatly appreciate design input/approval! CC @mihir174. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF https://user-images.githubusercontent.com/15073128/122973217-47028c00-d391-11eb-8a1a-0c21d13ca50e.mov ### TESTING INSTRUCTIONS 0. Enable `DASHBOARD_NATIVE_FILTERS` feature flag 1. Create a dashboard with charts that use the same dataset. 2. Create a native filter and verify that "Apply to all panels" scope is selected by default 3. Create a dashboard with charts that use multiple datasets 4. Create a native filter, choose a dataset and verify that only the charts that use that dataset are in scope by default. 5. Change dataset, verify that scope tree got updated so that charts that use the new dataset are now in scope. 6. Modify the scope, change dataset and verify that the scope didn't change. 7. Save the filter, edit it, change its dataset, verify that the scoe didn't change. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: closes #14977 - [ ] 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 CC: @villebro @michael-s-molina @rusackas -- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
