superset icon indicating copy to clipboard operation
superset copied to clipboard

feat: Add comparison time label to Big Number with Time Period plugin

Open kgabryje opened this issue 1 year ago • 11 comments

SUMMARY

Add a custom control to Big Number with Time Period Comparison plugin, which adds a label with actual time range for comparison below the range for comparison selector.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

https://github.com/apache/superset/assets/15073128/2829e113-c320-451f-aa27-45a24f8ec7cc

TESTING INSTRUCTIONS

  1. Create a Big Number with Time Period Comparison chart
  2. Add some time filter
  3. Select range for comparison
  4. Verify that the label updates whenever the time filter or range for comparison changes
  5. Run query
  6. Verify that the label matches the time filter in second query

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] Required feature flags:
  • [ ] Changes UI
  • [ ] Includes DB Migration (follow approval process in SIP-59)
    • [ ] 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

kgabryje avatar Feb 26 '24 15:02 kgabryje

Codecov Report

Attention: Patch coverage is 33.33333% with 32 lines in your changes are missing coverage. Please review.

Project coverage is 69.70%. Comparing base (89e89de) to head (553a721).

Files Patch % Lines
...plore/components/controls/ComparisonRangeLabel.tsx 7.14% 26 Missing :warning:
...ontrols/DateFilterControl/utils/dateFilterUtils.ts 40.00% 2 Missing and 1 partial :warning:
superset/views/api.py 80.00% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27253      +/-   ##
==========================================
- Coverage   69.73%   69.70%   -0.03%     
==========================================
  Files        1909     1910       +1     
  Lines       74670    74716      +46     
  Branches     8324     8329       +5     
==========================================
+ Hits        52069    52084      +15     
- Misses      20550    20580      +30     
- Partials     2051     2052       +1     
Flag Coverage Δ
hive 53.72% <46.66%> (-0.01%) :arrow_down:
javascript 57.17% <12.12%> (-0.05%) :arrow_down:
mysql 78.00% <80.00%> (-0.02%) :arrow_down:
postgres 78.13% <80.00%> (+<0.01%) :arrow_up:
presto 53.67% <46.66%> (-0.01%) :arrow_down:
python 83.16% <80.00%> (+<0.01%) :arrow_up:
sqlite 77.57% <80.00%> (+<0.01%) :arrow_up:
unit 56.54% <46.66%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 26 '24 15:02 codecov[bot]

I'm not up to speed on the controls changes happening here, but if they're JUST for this plugin, any new controls should be added in that plugin src. If it's a shared control and new functionality, it should be in the superset-ui package(s). In general, we should not be adding code to the superset-frontend codebase, as that should be migrated to external packages for enhanced reusability. Also, if the plugin is intended to be published as an npm package (which I would think we should do for all plugins) then this code can't be modified/published as part of that package release.

rusackas avatar Feb 26 '24 18:02 rusackas

IMO, the time comparison hundred percent frontend changes enough, I post my thoughts in the PR: https://github.com/apache/superset/pull/27145/files#r1499727676

The key point of design for the date time expression is that just needs frontend to build a expression.

zhaoyongjie avatar Feb 27 '24 08:02 zhaoyongjie

@rusackas good points, thank you! yes this control is just for that 1 plugin. I moved it to src/explore/components so that we could use dateFilterUtils, but maybe we should simply move those utils to @superset-ui/core

kgabryje avatar Feb 27 '24 14:02 kgabryje

@kgabryje I opened a PR for fetching multiple time range https://github.com/apache/superset/pull/27370/files

zhaoyongjie avatar Mar 03 '24 15:03 zhaoyongjie

/testenv up

kgabryje avatar Mar 12 '24 14:03 kgabryje

@kgabryje Ephemeral environment spinning up at http://34.222.22.95:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Mar 12 '24 15:03 github-actions[bot]

/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true

Antonio-RiveroMartnez avatar Apr 04 '24 00:04 Antonio-RiveroMartnez

@Antonio-RiveroMartnez Ephemeral environment spinning up at http://35.162.209.131:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Apr 04 '24 01:04 github-actions[bot]

/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true

kgabryje avatar Apr 24 '24 15:04 kgabryje

@kgabryje Ephemeral environment spinning up at http://34.217.114.83:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

github-actions[bot] avatar Apr 24 '24 15:04 github-actions[bot]