Skip to content

Commit

Permalink
[Discover] Address the flaky histogram code (elastic#201809)
Browse files Browse the repository at this point in the history
- Closes elastic#201744
- Similar to elastic#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 and CAWilson94 committed Dec 12, 2024
1 parent a83dd00 commit 3db924f
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 3db924f

Please sign in to comment.