parent
89af63c3be
commit
2b1dacccfd
5 changed files with 27 additions and 4 deletions
|
@ -148,7 +148,7 @@ export const termsBucketAgg = new BucketAggType({
|
|||
makeOrderAgg: function (termsAgg, state) {
|
||||
state = state || {};
|
||||
state.schema = orderAggSchema;
|
||||
const orderAgg = this.aggConfigs.createAggConfig(state);
|
||||
const orderAgg = termsAgg.aggConfigs.createAggConfig(state, { addToAggConfigs: false });
|
||||
orderAgg.id = termsAgg.id + '-orderAgg';
|
||||
return orderAgg;
|
||||
},
|
||||
|
|
|
@ -10,14 +10,15 @@
|
|||
<option
|
||||
ng-repeat="respAgg in responseValueAggs track by respAgg.id"
|
||||
value="{{respAgg.id}}"
|
||||
data-test-subj="visEditorOrder{{agg.id}}-{{respAgg.id}}"
|
||||
ng-disabled="rejectAgg(respAgg)"
|
||||
ng-selected="agg.params.orderBy === respAgg.id">
|
||||
metric: {{safeMakeLabel(respAgg)}}
|
||||
</option>
|
||||
<option value="custom" ng-selected="agg.params.orderBy === 'custom'">
|
||||
<option value="custom" data-test-subj="visEditorOrder{{agg.id}}-custom" ng-selected="agg.params.orderBy === 'custom'">
|
||||
Custom Metric
|
||||
</option>
|
||||
<option value="_key" ng-selected="agg.params.orderBy === '_key'">
|
||||
<option value="_key" data-test-subj="visEditorOrder{{agg.id}}-key" ng-selected="agg.params.orderBy === '_key'">
|
||||
Alphabetical
|
||||
</option>
|
||||
</select>
|
||||
|
|
|
@ -96,7 +96,7 @@ class AggConfigs extends IndexedArray {
|
|||
updateAggTimeRange(param);
|
||||
}
|
||||
});
|
||||
if (agg.type.name === 'date_histogram') {
|
||||
if (_.get(agg, 'type.name') === 'date_histogram') {
|
||||
agg.params.timeRange = timeRange;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -208,6 +208,17 @@ export default function ({ getService, getPageObjects }) {
|
|||
const legendEntries = await PageObjects.visualize.getLegendEntries();
|
||||
expect(legendEntries).to.eql(expectedEntries);
|
||||
});
|
||||
|
||||
it('should allow custom sorting of series', async () => {
|
||||
await PageObjects.visualize.toggleOpenEditor(1, 'false');
|
||||
await PageObjects.visualize.selectCustomSortMetric(3, 'Min', 'bytes');
|
||||
await PageObjects.visualize.clickGo();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
const expectedEntries = ['404', '200', '503'];
|
||||
const legendEntries = await PageObjects.visualize.getLegendEntries();
|
||||
expect(legendEntries).to.eql(expectedEntries);
|
||||
});
|
||||
});
|
||||
|
||||
describe('vertical bar with multiple splits', function () {
|
||||
|
|
|
@ -1132,6 +1132,17 @@ export function VisualizePageProvider({ getService, getPageObjects }) {
|
|||
const pieSlices = await this.getAllPieSlices(name);
|
||||
return await Promise.all(pieSlices.map(async pieSlice => await pieSlice.getAttribute('style')));
|
||||
}
|
||||
|
||||
async selectSortMetric(agg, metric) {
|
||||
const sortMetric = await find.byCssSelector(`[data-test-subj="visEditorOrder${agg}-${metric}"]`);
|
||||
return await sortMetric.click();
|
||||
}
|
||||
|
||||
async selectCustomSortMetric(agg, metric, field) {
|
||||
await this.selectSortMetric(agg, 'custom');
|
||||
await this.selectAggregation(metric, 'groupName');
|
||||
await this.selectField(field, 'groupName');
|
||||
}
|
||||
}
|
||||
|
||||
return new VisualizePage();
|
||||
|
|
Loading…
Reference in a new issue