Skip to content
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

[Explore] Handle empty metrics control data #5241

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Jun 18, 2018

when metrics is empty, Explore controls throw exceptions:

screen shot 2018-06-18 at 3 21 57 pm
screen shot 2018-06-18 at 3 38 31 pm

I think js bundle for notify library is also problematic. We probably should remove the usage and replace with other library. But it's out of scope of this issue.

@GabeLoins @timifasubaa @michellethomas @mistercrunch

@@ -223,7 +223,7 @@ export default class AdhocFilterControl extends React.Component {
} else if (option instanceof AdhocMetric) {
return { ...option, filterOptionName: '_adhocmetric_' + option.label };
}
return null;
return '';
Copy link
Member

@john-bodley john-bodley Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to return an empty string here? Generally checking for null is preferable to an empty string.

Copy link
Author

@graceguo-supercat graceguo-supercat Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caller for these 2 optionsForSelect functions expecting a string array result, and don't handle null in the array. if i return null and caller brought result to do sort, another exception will be thrown.

So i come up another solution that combines filter (empty metrics) + map metrics to new attribute name.

@codecov-io
Copy link

codecov-io commented Jun 19, 2018

Codecov Report

Merging #5241 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5241      +/-   ##
==========================================
+ Coverage   60.76%   60.78%   +0.01%     
==========================================
  Files         258      258              
  Lines       19701    19700       -1     
  Branches     1970     1970              
==========================================
+ Hits        11972    11974       +2     
+ Misses       7720     7717       -3     
  Partials        9        9
Impacted Files Coverage Δ
...explore/components/controls/AdhocFilterControl.jsx 78.72% <ø> (+1.06%) ⬆️
...src/explore/components/controls/MetricsControl.jsx 80% <100%> (+1.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70679d4...b1c6771. Read the comment docs.

Copy link
Contributor

@gabe-lyons gabe-lyons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@john-bodley john-bodley merged commit 13cbf80 into apache:master Jun 20, 2018
john-bodley pushed a commit to john-bodley/superset that referenced this pull request Jun 20, 2018
timifasubaa pushed a commit to airbnb/superset-fork that referenced this pull request Jul 25, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@graceguo-supercat graceguo-supercat deleted the gg-ExploreControlsNotifyJS branch March 14, 2019 22:52
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.26.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.26.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants