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] fix autocomplete on verbose names #5204

Merged
merged 2 commits into from Jun 15, 2018

Conversation

mistercrunch
Copy link
Member

Currently when searching for metrics or groupbys, the autocomplete
search functionality only matches based on the metric_name, though in
some cases the verbose_name is displayed and disregarded for search
purposes.

Also another issue is that not all pre-defined metrics show up in the
drop down which is confusing. Users may have simple metrics for which
they setup a nice verbose name and/or description and expect to see
those in the dropdown.

This PR addresses it for metric and column-related dropdowns.

@GabeLoins @michellethomas

@@ -224,8 +224,13 @@ export default class MetricsControl extends React.PureComponent {
(option.column_name.toLowerCase().indexOf(valueAfterAggregate.toLowerCase()) >= 0);
}
return option.optionName &&
(!option.metric_name || !this.isAutoGeneratedMetric(option)) &&
Copy link
Member Author

Choose a reason for hiding this comment

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

@GabeLoins I'm trying to understand !option.metric_name why filtering this out?

Copy link
Contributor

Choose a reason for hiding this comment

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

in the metrics control you can select saved_metrics, columns, or aggregates from the dropdown. That's why I use optionName for comparison rather than metric name. In that check I'm saying if the option is not a saved metric, or if it is a saved metric but not an autogenerated saved metric

@gabe-lyons
Copy link
Contributor

@mistercrunch as of this PR:

#5105

we only filter simple metrics with names that are formatted as /^(sum|min|max|avg|count|count_distinct)__.*$/i;

So simple saved metrics with fancy names should still be displayed.

Currently when searching for metrics or groupbys, the autocomplete
search functionality only matches based on the metric_name, though in
some cases the verbose_name is displayed and disregarded for search
purposes.

Also another issue is that not all pre-defined metrics show up in the
drop down which is confusing. Users may have simple metrics for which
they setup a nice verbose name and/or description and expect to see
those in the dropdown.

This PR addresses it for metric and column-related dropdowns.
@mistercrunch
Copy link
Member Author

Got it, let's get the ones with a verbose_name to show up with this PR here.

@codecov-io
Copy link

Codecov Report

Merging #5204 into master will increase coverage by 0.05%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5204      +/-   ##
==========================================
+ Coverage   63.39%   63.45%   +0.05%     
==========================================
  Files         261      261              
  Lines       19838    19842       +4     
  Branches     1995     1998       +3     
==========================================
+ Hits        12577    12591      +14     
+ Misses       7252     7242      -10     
  Partials        9        9
Impacted Files Coverage Δ
.../src/explore/components/controls/SelectControl.jsx 84.74% <ø> (ø) ⬆️
...src/explore/components/controls/MetricsControl.jsx 78.76% <100%> (+0.14%) ⬆️
superset/assets/src/explore/controls.jsx 44.44% <33.33%> (-0.26%) ⬇️
superset/models/core.py 86.54% <0%> (+0.18%) ⬆️
superset/views/core.py 74.66% <0%> (+0.22%) ⬆️
superset/db_engine_specs.py 53.71% <0%> (+1.32%) ⬆️

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 4b7a14d...b29360d. Read the comment docs.

@@ -224,7 +224,7 @@ describe('MetricsControl', () => {

expect(!!wrapper.instance().selectFilterOption(
{ type: 'VARCHAR(255)', column_name: 'source', optionName: '_col_source' },
'Sou',
'sou',
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI react-select always passes lower case strings so I removed the toLowerCase call.

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL!

@mistercrunch
Copy link
Member Author

@GabeLoins please review when you find a moment

@@ -103,6 +103,10 @@ const groupByControl = {
optionRenderer: c => <ColumnOption column={c} showType />,
valueRenderer: c => <ColumnOption column={c} />,
valueKey: 'column_name',
filterOption: (opt, text) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this only apply to the group by control? shouldn't we do the same for metric control?

Copy link
Member Author

Choose a reason for hiding this comment

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

MetricsControl has it's own control that internally defines filterOption in it's own way. I alter MetricsControl.selectFilterOption in this very PR to address this.

@mistercrunch mistercrunch merged commit d5ebc43 into apache:master Jun 15, 2018
@mistercrunch mistercrunch deleted the fix_search branch June 15, 2018 22:56
williaster added a commit that referenced this pull request Jun 16, 2018
john-bodley pushed a commit that referenced this pull request Jun 16, 2018
* Revert "[explore] fix autocomplete on verbose names (#5204)"

This reverts commit d5ebc43.

* Revert "[webpack] setup lazy loading for all visualizations (#4727)"

This reverts commit de0aaf4.
timifasubaa pushed a commit to airbnb/superset-fork that referenced this pull request Jul 25, 2018
* [explore] fix autocomplete on verbose names

Currently when searching for metrics or groupbys, the autocomplete
search functionality only matches based on the metric_name, though in
some cases the verbose_name is displayed and disregarded for search
purposes.

Also another issue is that not all pre-defined metrics show up in the
drop down which is confusing. Users may have simple metrics for which
they setup a nice verbose name and/or description and expect to see
those in the dropdown.

This PR addresses it for metric and column-related dropdowns.

* Add unit test
timifasubaa pushed a commit to airbnb/superset-fork that referenced this pull request Jul 25, 2018
…5219)

* Revert "[explore] fix autocomplete on verbose names (apache#5204)"

This reverts commit d5ebc43.

* Revert "[webpack] setup lazy loading for all visualizations (apache#4727)"

This reverts commit de0aaf4.
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* [explore] fix autocomplete on verbose names

Currently when searching for metrics or groupbys, the autocomplete
search functionality only matches based on the metric_name, though in
some cases the verbose_name is displayed and disregarded for search
purposes.

Also another issue is that not all pre-defined metrics show up in the
drop down which is confusing. Users may have simple metrics for which
they setup a nice verbose name and/or description and expect to see
those in the dropdown.

This PR addresses it for metric and column-related dropdowns.

* Add unit test
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
…5219)

* Revert "[explore] fix autocomplete on verbose names (apache#5204)"

This reverts commit d5ebc43.

* Revert "[webpack] setup lazy loading for all visualizations (apache#4727)"

This reverts commit de0aaf4.
@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.

None yet

3 participants