-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(explore): Make metric title respond to changes immediately #12747
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12747 +/- ##
==========================================
- Coverage 67.00% 66.81% -0.20%
==========================================
Files 1022 1022
Lines 50047 50071 +24
Branches 4914 4930 +16
==========================================
- Hits 33533 33453 -80
- Misses 16390 16494 +104
Partials 124 124
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
componentDidUpdate(prevProps, prevState) { | ||
if ( | ||
prevState.adhocMetric?.label !== this.state.adhocMetric?.label || | ||
prevState.savedMetric?.metric_name !== this.state.savedMetric?.metric_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add a prevState.savedMetric?.verbose_name !== this.state.savedMetric?.verbose_name
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so - metric_name
check is used only to determine whether a different saved metric has been chosen. metric_name
is unique, so it's sufficient to compare only this field.
newMetric: AdhocMetric | Record<string, any>, | ||
oldMetric: AdhocMetric | Record<string, any>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Record<string, any>
for saved metrics here? Could this be savedMetricType
? (Unrelated bycatch, this type should probably be called SavedMetricType
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe import { Metric } from '@superset-ui/core';
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ktmud Good idea! 👍
I guess name used once should not be cached when metric was modified. |
My second concern is whether SAVED METRICS Value chosen should reset custom name and set valid for this SAVED METRIC. Nagranie.z.ekranu.2021-01-26.o.21.35.28.mov |
thank you @adam-stasiak, yes this seems to be an issue. we should address it in this same PR. |
this one as well. |
bd98427
to
72a5e44
Compare
Tested after changes 🟢 |
Thanks @adam-stasiak 🙂 |
* Make metric title respond to changes immediately * Bug fix * Change type to Metric * Bug fix
SUMMARY
When changes are made in metrics popover, the title should show current value immediately rather than after saving and reopening the popover. When there is no custom title set - display title based on current metric value. If there is a custom title set - always display that title, ignore changes in metric values.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Nagranie.z.ekranu.2021-01-25.o.21.46.58.mov
TEST PLAN
ADDITIONAL INFORMATION
CC @villebro @junlincc @adam-stasiak @ktmud