Skip to content

Commit

Permalink
corrected display of arrays in the metric vis
Browse files Browse the repository at this point in the history
  • Loading branch information
scampi committed Dec 17, 2016
1 parent 2a2fa67 commit eb70e84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 () {
Expand Down
13 changes: 7 additions & 6 deletions src/core_plugins/metric_vis/public/metric_vis_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ 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')
});
});
});
};

$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');
}
});
Expand Down

0 comments on commit eb70e84

Please sign in to comment.