Skip to content

Commit

Permalink
Ensure AggConfigResult.rawData is preserved in legacy table response …
Browse files Browse the repository at this point in the history
…handler.
  • Loading branch information
lukeelmers committed Oct 23, 2018
1 parent db78edc commit 766f0df
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/ui/public/vis/response_handlers/legacy_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ function splitTable(columns, rows, $parent) {
return [{
$parent,
columns: columns.map(column => ({ title: column.name, ...column })),
rows: rows.map(row => {
return columns.map(column => {
return new AggConfigResult(column.aggConfig, $parent, row[column.id], row[column.id]);
rows: rows.map((row, rowIndex) => {
return columns.map((column, columnIndex) => {
const aggConfigResult = new AggConfigResult(column.aggConfig, $parent, row[column.id], row[column.id]);
aggConfigResult.rawData = {
table: { columns, rows },
columnIndex,
rowIndex,
};
return aggConfigResult;
});
})
}];
Expand All @@ -67,8 +73,14 @@ function splitTable(columns, rows, $parent) {
.filter((column, i) => i !== splitColumnIndex)
.map(column => ({ title: column.name, ...column }));

return splitRows.results.map(splitValue => {
const $newParent = new AggConfigResult(splitColumn.aggConfig, $parent, splitValue, splitValue);
return splitRows.results.map((splitValue, rowIndex) => {
const aggConfigResult = new AggConfigResult(splitColumn.aggConfig, $parent, splitValue, splitValue);
aggConfigResult.rawData = {
table: { columns, rows },
columnIndex: splitColumnIndex,
rowIndex,
};
const $newParent = aggConfigResult;
return {
$parent: $newParent,
aggConfig: splitColumn.aggConfig,
Expand Down

0 comments on commit 766f0df

Please sign in to comment.