Preserve rawData to fix filtering on split tables. (#33886)

When the legacy response handler was created specifically for table vis,
`rawData` was no longer attached to the `AggConfigResult`s returned from
the handler. This caused filtering on individual table cells to fail
when using split rows/tables, because `vis_filters` could not find the
`rawData` it needed to generate the filter.

This issue only affects 6.6/6.7, as the response handler was removed in
subsequent versions.

Fixes #32529.
This commit is contained in:
Luke Elmers 2019-04-04 10:12:25 -06:00 committed by GitHub
parent 20c9530e39
commit 03d92314d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -128,6 +128,16 @@ describe('Table Vis Legacy Response Handler', () => {
expect(actual.map(i => i.title)).to.eql(expected);
});
it('should return the correct rawData', () => {
const expected = {
table: { columns, rows },
column: 0,
row: -1,
};
const actual = splitTable(columns, rows, null);
expect(actual.map(i => i.$parent.rawData)).to.eql([expected, expected, expected]);
});
it('should return nested split tables with the correct number of entries', () => {
const expected = [2, 1, 3];
const actual = splitTable(columns, rows, null);

View file

@ -89,6 +89,11 @@ export function splitTable(columns, rows, $parent) {
return splitRows.results.map(splitValue => {
const $newParent = new AggConfigResult(splitColumn.aggConfig, $parent, splitValue, splitValue);
$newParent.rawData = {
table: { columns, rows },
column: splitColumnIndex,
row: -1, // For split buckets, we don't need the actual row for filters, just the provided value.
};
return {
$parent: $newParent,
aggConfig: splitColumn.aggConfig,