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

[Discover] Fix suggestions for ES|QL charts #197583

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/functional/apps/discover/group3/_lens_vis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return seriesType;
}

// Failing: See https://github.com/elastic/kibana/issues/197342
describe.skip('discover lens vis', function () {
describe('discover lens vis', function () {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
Expand Down Expand Up @@ -616,8 +615,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await getCurrentVisTitle()).to.be('Pie');
await testSubjects.existOrFail('partitionVisChart');

await discover.chooseLensSuggestion('barVerticalStacked');
await changeVisShape('Line');
await discover.chooseLensSuggestion('waffle');
await changeVisShape('Treemap');

await testSubjects.existOrFail('unsavedChangesBadge');
await discover.saveUnsavedChanges();
Expand All @@ -626,8 +625,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await discover.waitUntilSearchingHasFinished();

await testSubjects.missingOrFail('unsavedChangesBadge');
expect(await getCurrentVisTitle()).to.be('Line');
await testSubjects.existOrFail('xyVisChart');
expect(await getCurrentVisTitle()).to.be('Treemap');
await testSubjects.existOrFail('partitionVisChart');
});

it('should close lens flyout on revert changes', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe('metric suggestions', () => {
breakdownByAccessor: bucketColumn.columnId,
},
title: 'Metric',
hide: false,
hide: true,
previewIcon: IconChartMetric,
score: 0.51,
},
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('metric suggestions', () => {
breakdownByAccessor: bucketColumn.columnId,
},
title: 'Metric',
hide: false,
hide: true,
previewIcon: IconChartMetric,
score: 0.51,
},
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('metric suggestions', () => {
breakdownByAccessor: bucketColumn.columnId,
},
title: 'Metric',
hide: false,
hide: true,
previewIcon: IconChartMetric,
score: 0.52,
},
Expand Down Expand Up @@ -326,7 +326,7 @@ describe('metric suggestions', () => {
breakdownByAccessor: bucketColumn.columnId,
},
title: 'Metric',
hide: false,
hide: true,
previewIcon: IconChartMetric,
score: 0.52,
},
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('metric suggestions', () => {
breakdownByAccessor: bucketColumn.columnId,
},
title: 'Metric',
hide: false,
hide: true,
previewIcon: IconChartMetric,
score: 0.52,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const getSuggestions: Visualization<MetricVisualizationState>['getSuggest

const bucketedColumns = table.columns.filter(({ operation }) => operation.isBucketed);

const hasInterval = bucketedColumns.some(({ operation }) => operation.scale === 'interval');

const unsupportedColumns = table.columns.filter(
({ operation }) => !supportedDataTypes.has(operation.dataType) && !operation.isBucketed
);
Expand Down Expand Up @@ -64,7 +62,7 @@ export const getSuggestions: Visualization<MetricVisualizationState>['getSuggest
title: metricColumns[0]?.operation.label || metricLabel,
previewIcon: IconChartMetric,
score: 0.5,
hide: hasInterval,
hide: !!bucketedColumns.length,
};

const accessorMappings: Pick<MetricVisualizationState, 'metricAccessor' | 'breakdownByAccessor'> =
Expand Down