[explore] fix autocomplete on verbose names (#5204)

* [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
This commit is contained in:
Maxime Beauchemin
2018-06-15 15:56:05 -07:00
committed by GitHub
parent de0aaf42ed
commit d5ebc430c2
4 changed files with 23 additions and 4 deletions

View File

@@ -224,7 +224,7 @@ describe('MetricsControl', () => {
expect(!!wrapper.instance().selectFilterOption(
{ type: 'VARCHAR(255)', column_name: 'source', optionName: '_col_source' },
'Sou',
'sou',
)).to.be.true;
expect(!!wrapper.instance().selectFilterOption(
@@ -233,6 +233,15 @@ describe('MetricsControl', () => {
)).to.be.true;
});
it('includes columns based on verbose_name', () => {
const { wrapper } = setup();
expect(!!wrapper.instance().selectFilterOption(
{ metric_name: 'sum__num', verbose_name: 'babies', optionName: '_col_sum_num' },
'bab',
)).to.be.true;
});
it('excludes auto generated avg metrics for sqla', () => {
const { wrapper } = setup();