corrected display of arrays in the metric vis

This commit is contained in:
Stéphane Campinas 2016-12-17 15:27:36 +00:00
parent 2a2fa67d2a
commit eb70e84a56
No known key found for this signature in database
GPG key ID: 8272664236A42C2F
2 changed files with 9 additions and 8 deletions

View file

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

View file

@ -17,14 +17,11 @@ module.controller('KbnMetricVisController', function ($scope, $element, Private)
$scope.processTableGroups = function (tableGroups) {
tableGroups.tables.forEach(function (table) {
table.columns.forEach(function (column, i) {
const fieldFormatter = table.aggConfig(column).fieldFormatter();
let value = table.rows[0][i];
value = isInvalid(value) ? '?' : fieldFormatter(value);
const value = table.rows[0][i];
metrics.push({
label: column.title,
value: value
value: value.toString('html')
});
});
});
@ -32,8 +29,12 @@ module.controller('KbnMetricVisController', function ($scope, $element, Private)
$scope.$watch('esResponse', function (resp) {
if (resp) {
const options = {
asAggConfigResults: true
};
metrics.length = 0;
$scope.processTableGroups(tabifyAggResponse($scope.vis, resp));
$scope.processTableGroups(tabifyAggResponse($scope.vis, resp, options));
$element.trigger('renderComplete');
}
});