Skip to content

Commit

Permalink
[TSVB] Enable brush for visualizations created with no index patterns (
Browse files Browse the repository at this point in the history
…elastic#96727)

* [TSVB] Enable brush for visualizations created with no index patterns

* Fix comments typo

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
2 people authored and madirey committed May 11, 2021
1 parent 5066133 commit 4a57e02
Showing 1 changed file with 37 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,44 @@ function TimeseriesVisualization({
const indexPatternValue = model.index_pattern || '';
const { indexPatterns } = getDataStart();
const { indexPattern } = await fetchIndexPattern(indexPatternValue, indexPatterns);
let event;
// trigger applyFilter if no index pattern found, url drilldowns are supported only
// for the index pattern mode
if (indexPattern) {
const tables = indexPattern
? await convertSeriesToDataTable(model, series, indexPattern)
: null;
const table = tables?.[model.series[0].id];

const range: [number, number] = [parseInt(gte, 10), parseInt(lte, 10)];
event = {
data: {
table,
column: X_ACCESSOR_INDEX,
range,
timeFieldName: indexPattern?.timeFieldName,
},
name: 'brush',
};
} else {
event = {
name: 'applyFilter',
data: {
timeFieldName: '*',
filters: [
{
range: {
'*': {
gte,
lte,
},
},
},
],
},
};
}

const tables = indexPattern
? await convertSeriesToDataTable(model, series, indexPattern)
: null;
const table = tables?.[model.series[0].id];

const range: [number, number] = [parseInt(gte, 10), parseInt(lte, 10)];
const event = {
data: {
table,
column: X_ACCESSOR_INDEX,
range,
timeFieldName: indexPattern?.timeFieldName,
},
name: 'brush',
};
handlers.event(event);
},
[handlers, model]
Expand Down

0 comments on commit 4a57e02

Please sign in to comment.