Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/public/filter_bar/filter_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<li ng-if="changeTimeFilter" class="changeTimeFilter filter" ng-click="changeTimeFilter.meta.apply = !changeTimeFilter.meta.apply"><input type="checkbox" ng-checked="changeTimeFilter.meta.apply"/> <strong>Change time to:</strong> {{changeTimeFilter.meta.value}} </li>
<li>
<div class="kuiButtonGroup">
<button class="kuiButton kuiButton--primary kuiButton--small">
<button class="kuiButton kuiButton--primary kuiButton--small" data-test-subj="filterBarApplyFilters">
Apply Now
</button>

Expand Down
9 changes: 7 additions & 2 deletions src/ui/public/vis/response_handlers/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,19 @@ const LegacyResponseHandlerProvider = function () {
}

let previousSplitAgg = new AggConfigResult(splitAgg, null, splitValue, splitValue);
previousSplitAgg.rawData = {
table: table,
column: splitColumnIndex,
row: rowIndex,
};
const tableIndex = splitMap[splitValue];
const newRow = _.map(converted.tables[tableIndex].tables[0].columns, column => {
const value = row[column.id];
const aggConfigResult = new AggConfigResult(column.aggConfig, previousSplitAgg, value, value);
aggConfigResult.rawData = {
table: table,
columnIndex: table.columns.findIndex(c => c.id === column.id),
rowIndex: rowIndex,
column: table.columns.findIndex(c => c.id === column.id),
row: rowIndex,
};
if (column.aggConfig.type.type === 'buckets') {
previousSplitAgg = aggConfigResult;
Expand Down
72 changes: 72 additions & 0 deletions test/functional/apps/visualize/_pie_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,77 @@ export default function ({ getService, getPageObjects }) {
expect(legends).to.eql(expectedLegends);
});
});

describe('split chart', () => {
before(async () => {
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickPieChart();
await PageObjects.visualize.clickNewSearch();
log.debug('Set absolute time range from \"' + fromTime + '\" to \"' + toTime + '\"');
await PageObjects.header.setAbsoluteRange(fromTime, toTime);
log.debug('select bucket Split Slices');
await PageObjects.visualize.clickBucket('Split Chart');
await PageObjects.visualize.selectAggregation('Terms');
await PageObjects.visualize.selectField('machine.os.raw');
await PageObjects.visualize.toggleAggregationEditor(2);
log.debug('Add a new series');
await PageObjects.visualize.clickAddBucket();
log.debug('select bucket Split Slices');
await PageObjects.visualize.clickBucket('Split Slices');
await PageObjects.visualize.selectAggregation('Terms');
await PageObjects.visualize.selectField('geo.src');
await PageObjects.visualize.clickGo();
await PageObjects.visualize.waitForVisualization();
});

it ('shows correct split chart', async () => {
const expectedTableData = [
[ 'win 8', '2,904', 'CN', '560' ],
[ 'win 8', '2,904', 'IN', '489' ],
[ 'win 8', '2,904', 'US', '223' ],
[ 'win 8', '2,904', 'ID', '100' ],
[ 'win 8', '2,904', 'BR', '89' ],
[ 'win xp', '2,858', 'CN', '526' ],
[ 'win xp', '2,858', 'IN', '467' ],
[ 'win xp', '2,858', 'US', '250' ],
[ 'win xp', '2,858', 'ID', '98' ],
[ 'win xp', '2,858', 'BR', '84' ],
[ 'win 7', '2,814', 'CN', '537' ],
[ 'win 7', '2,814', 'IN', '460' ],
[ 'win 7', '2,814', 'US', '260' ],
[ 'win 7', '2,814', 'ID', '102' ],
[ 'win 7', '2,814', 'BR', '74' ],
[ 'ios', '2,784', 'IN', '494' ],
[ 'ios', '2,784', 'CN', '478' ],
[ 'ios', '2,784', 'US', '222' ],
[ 'ios', '2,784', 'ID', '96' ],
[ 'ios', '2,784', 'BR', '84' ],
[ 'osx', '1,322', 'IN', '242' ],
[ 'osx', '1,322', 'CN', '228' ],
[ 'osx', '1,322', 'US', '130' ],
[ 'osx', '1,322', 'ID', '56' ],
[ 'osx', '1,322', 'BR', '30' ]
];
await PageObjects.visualize.openInspector();
await PageObjects.visualize.setInspectorTablePageSize(50);
const data = await PageObjects.visualize.getInspectorTableData();
await PageObjects.visualize.closeInspector();
log.debug(data);
expect(data).to.eql(expectedTableData);
});

it ('correctly applies filter', async () => {
const expectedTableData = [[ 'win 8', '100', 'ID', '100' ]];
await PageObjects.visualize.filterPieSlice('ID');
await PageObjects.visualize.applyFilters();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.visualize.openInspector();
await PageObjects.visualize.setInspectorTablePageSize(50);
const data = await PageObjects.visualize.getInspectorTableData();
await PageObjects.visualize.closeInspector();
log.debug(data);
expect(data).to.eql(expectedTableData);
});
});
});
}
3 changes: 3 additions & 0 deletions test/functional/page_objects/visualize_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
await PageObjects.common.sleep(500);
}

async applyFilters() {
return await testSubjects.click('filterBarApplyFilters');
}
/**
* Set the test for a filter aggregation.
* @param {*} filterValue the string value of the filter
Expand Down