-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Remove Over time suggestions for numeric intervals #78442
Changes from 18 commits
c70ca5e
405c05d
aa4aad1
9f33112
b328ff8
9265253
3eb6809
49f7458
24a2d61
ef21c11
7614d1d
988aeec
6f1448a
73ead33
05f68da
eefab3b
ae5406f
6224b9d
4909c52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,6 +455,10 @@ export function getDatasourceSuggestionsFromCurrentState( | |
({ name }) => name === indexPattern.timeFieldName | ||
); | ||
|
||
const hasNumericDimension = | ||
buckets.length === 1 && | ||
buckets.some((columnId) => layer.columns[columnId].dataType === 'number'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of looking for numeric operations, which can include the number range aggregation too, could you filter for any existing |
||
|
||
const suggestions: Array<DatasourceSuggestion<IndexPatternPrivateState>> = []; | ||
if (metrics.length === 0) { | ||
// intermediary chart without metric, don't try to suggest reduced versions | ||
|
@@ -482,7 +486,9 @@ export function getDatasourceSuggestionsFromCurrentState( | |
} else { | ||
suggestions.push(...createSimplifiedTableSuggestions(state, layerId)); | ||
|
||
if (!timeDimension && timeField) { | ||
// base range intervals are of number dataType. | ||
// Custom range/intervals have a different dataType so they still receive the Over Time suggestion | ||
if (!timeDimension && timeField && !hasNumericDimension) { | ||
// suggest current configuration over time if there is a default time field | ||
// and no time dimension yet | ||
suggestions.push(createSuggestionWithDefaultDateHistogram(state, layerId, timeField)); | ||
|
@@ -653,9 +659,13 @@ function createSuggestionWithDefaultDateHistogram( | |
field: timeField, | ||
suggestedPriority: undefined, | ||
}); | ||
|
||
const updatedLayer = { | ||
indexPatternId: layer.indexPatternId, | ||
columns: { ...layer.columns, [newId]: timeColumn }, | ||
columns: { | ||
...layer.columns, | ||
[newId]: timeColumn, | ||
}, | ||
columnOrder: [...buckets, newId, ...metrics], | ||
}; | ||
return buildSuggestion({ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,8 +126,6 @@ function flipSeriesType(seriesType: SeriesType) { | |
return 'bar_stacked'; | ||
case 'bar': | ||
return 'bar_horizontal'; | ||
case 'bar_horizontal_stacked': | ||
return 'bar_stacked'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look right to me, why was this removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a duplicate. At line 116 there's exactly the same case. |
||
case 'bar_horizontal_percentage_stacked': | ||
return 'bar_percentage_stacked'; | ||
case 'bar_percentage_stacked': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test when the aggregation is the "Custom ranges" mode?