Skip to content

Commit

Permalink
[Discover] Address the flaky histogram code (#201809)
Browse files Browse the repository at this point in the history
- Closes #201744
- Similar to #184600

## Summary

This PR fixes the issues with the transition from a data view without a
time field to a data view with a time field.

Previously reported error:
![management Index patterns on aliases discover verify hits should be
able to
disc-4da8c0b87362e3312cae00dc943a984acfda9af98d821decb6f48164eaca21ae](https://github.com/user-attachments/assets/652096ef-70c1-4394-a665-6b2b15d976ec)
  • Loading branch information
jughosta authored Nov 28, 2024
1 parent 3e899e7 commit f50b93c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,13 @@ export class LensVisService {
queryParams: QueryParams;
timeInterval: string | undefined;
breakdownField: DataViewField | undefined;
}): Suggestion => {
}): Suggestion | undefined => {
const { dataView } = queryParams;

if (!dataView.isTimeBased() || !dataView.timeFieldName) {
return undefined;
}

const showBreakdown = breakdownField && fieldSupportsBreakdown(breakdownField);

let columnOrder = ['date_column', 'count_column'];
Expand All @@ -343,7 +348,7 @@ export class LensVisService {
date_column: {
dataType: 'date',
isBucketed: true,
label: dataView.timeFieldName ?? '',
label: dataView.timeFieldName,
operationType: 'date_histogram',
scale: 'interval',
sourceField: dataView.timeFieldName,
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/management/data_views/_handle_alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'home', 'settings', 'discover', 'timePicker']);
const kibanaServer = getService('kibanaServer');

// Failing: See https://github.com/elastic/kibana/issues/201744
describe.skip('Index patterns on aliases', function () {
describe('Index patterns on aliases', function () {
before(async function () {
await kibanaServer.savedObjects.cleanStandardList();
await security.testUser.setRoles(['kibana_admin', 'test_alias_reader']);
Expand Down

0 comments on commit f50b93c

Please sign in to comment.