- do not set a default value for the aggregate with property since it is

dependent on the field
- added tooltips for "aggregate with" and "size" parameters
This commit is contained in:
Stéphane Campinas 2016-12-21 23:04:12 +00:00
parent d19ba5698c
commit 66d3b31778
No known key found for this signature in database
GPG key ID: 8272664236A42C2F
4 changed files with 21 additions and 29 deletions

View file

@ -21,14 +21,7 @@ describe('metric vis', function () {
$scope.processTableGroups({
tables: [{
columns: [{ title: 'Count' }],
rows: [[ { toString: () => formatter(4301021) } ]],
aggConfig: function () {
return {
fieldFormatter: function () {
return formatter;
}
};
}
rows: [[ { toString: () => formatter(4301021) } ]]
}]
});
@ -44,14 +37,7 @@ describe('metric vis', function () {
{ title: '1st percentile of bytes' },
{ title: '99th percentile of bytes' }
],
rows: [[ { toString: () => formatter(182) }, { toString: () => formatter(445842.4634666484) } ]],
aggConfig: function () {
return {
fieldFormatter: function () {
return formatter;
}
};
}
rows: [[ { toString: () => formatter(182) }, { toString: () => formatter(445842.4634666484) } ]]
}]
});

View file

@ -2,18 +2,28 @@
<div class="form-group">
<label>
Aggregate With
<kbn-info
info="Choose a strategy for combining multiple hits or a multi-valued field into a single metric."
placement="right">
</kbn-info>
</label>
<select
required
name="aggregate"
ng-model="agg.params.aggregate"
ng-options="opt as opt.display disable when opt.disabled for opt in options| orderBy: 'display'"
ng-options="opt as opt.display disable when opt.disabled for opt in options| orderBy: 'display' track by opt.val"
class="form-control"
></select>
</div>
<div class="form-group">
<label>Size</label>
<label>
Size
<kbn-info
info="Request top-K hits. Multiple hits will be combined via 'aggregate with'."
placement="right">
</kbn-info>
</label>
<input
required

View file

@ -23,7 +23,7 @@
name="sortOrder"
ng-model="agg.params.sortOrder"
required
ng-options="opt as opt.display for opt in aggParam.options"
ng-options="opt as opt.display for opt in aggParam.options track by opt.val"
class="form-control">
</select>
</div>

View file

@ -57,7 +57,6 @@ export default function AggTypeMetricTopProvider(Private) {
{
name: 'aggregate',
type: 'optioned',
default: 'concat',
editor: aggregateAndSizeEditor,
options: [
{
@ -169,16 +168,13 @@ export default function AggTypeMetricTopProvider(Private) {
return null;
}
const path = agg.params.field.name;
let values = [];
for (const hit of hits) {
const hitValues = path === '_source' ? hit._source : agg.vis.indexPattern.flattenHit(hit, true)[path];
if (_.isArray(hitValues)) {
values.push(...hitValues);
} else {
values.push(hitValues);
}
}
let values = _(hits).map(hit => {
return path === '_source' ? hit._source : agg.vis.indexPattern.flattenHit(hit, true)[path];
})
.flatten()
.value();
if (values.length === 1) {
values = values[0];
}