kgabryje opened a new pull request #15798: URL: https://github.com/apache/superset/pull/15798
### SUMMARY When user creates a new adhoc metric with drag and dropping a column into metrics control, auto fill default aggregate in metric popover. If column's generic type is numeric, set `SUM` aggregate as default. if column's generic type is string or boolean, set `COUNT_DISTINCT` aggregate as default. Otherwise, don't set a default aggregate. Also, this PR fixes a bug metrics popover - when user created a metric with a custom label and then tried to create next metric, previous label was set instead of a default label. Now it should work as expected. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF https://user-images.githubusercontent.com/15073128/126321084-c75a8fc2-40fa-4d66-bf32-3be7eefa6f4d.mov ### TESTING INSTRUCTIONS 0. Enable drag and drop feature flag 1. Drag numeric column to metrics control. The default aggregate should be `SUM` 2. Drag string or boolean column to metrics control. The default aggregate should be `COUNT_DISTINCT` 3. Drag other type of column to metrics control. Aggregate should be unset. 4. Click Run and make sure the metrics work properly 5. Edit the default label of some metric and then try to add a new one. A default label in the new metric popover should match column's name and selected aggregate. Previously set label shouldn't be shown here ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] 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 @junlincc -- 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]
