mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
corrected display of arrays in the metric vis
This commit is contained in:
parent
2a2fa67d2a
commit
eb70e84a56
2 changed files with 9 additions and 8 deletions
|
@ -21,7 +21,7 @@ describe('metric vis', function () {
|
||||||
$scope.processTableGroups({
|
$scope.processTableGroups({
|
||||||
tables: [{
|
tables: [{
|
||||||
columns: [{ title: 'Count' }],
|
columns: [{ title: 'Count' }],
|
||||||
rows: [[4301021]],
|
rows: [[ { toString: () => formatter(4301021) } ]],
|
||||||
aggConfig: function () {
|
aggConfig: function () {
|
||||||
return {
|
return {
|
||||||
fieldFormatter: function () {
|
fieldFormatter: function () {
|
||||||
|
@ -44,7 +44,7 @@ describe('metric vis', function () {
|
||||||
{ title: '1st percentile of bytes' },
|
{ title: '1st percentile of bytes' },
|
||||||
{ title: '99th percentile of bytes' }
|
{ title: '99th percentile of bytes' }
|
||||||
],
|
],
|
||||||
rows: [[182, 445842.4634666484]],
|
rows: [[ { toString: () => formatter(182) }, { toString: () => formatter(445842.4634666484) } ]],
|
||||||
aggConfig: function () {
|
aggConfig: function () {
|
||||||
return {
|
return {
|
||||||
fieldFormatter: function () {
|
fieldFormatter: function () {
|
||||||
|
|
|
@ -17,14 +17,11 @@ module.controller('KbnMetricVisController', function ($scope, $element, Private)
|
||||||
$scope.processTableGroups = function (tableGroups) {
|
$scope.processTableGroups = function (tableGroups) {
|
||||||
tableGroups.tables.forEach(function (table) {
|
tableGroups.tables.forEach(function (table) {
|
||||||
table.columns.forEach(function (column, i) {
|
table.columns.forEach(function (column, i) {
|
||||||
const fieldFormatter = table.aggConfig(column).fieldFormatter();
|
const value = table.rows[0][i];
|
||||||
let value = table.rows[0][i];
|
|
||||||
|
|
||||||
value = isInvalid(value) ? '?' : fieldFormatter(value);
|
|
||||||
|
|
||||||
metrics.push({
|
metrics.push({
|
||||||
label: column.title,
|
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) {
|
$scope.$watch('esResponse', function (resp) {
|
||||||
if (resp) {
|
if (resp) {
|
||||||
|
const options = {
|
||||||
|
asAggConfigResults: true
|
||||||
|
};
|
||||||
|
|
||||||
metrics.length = 0;
|
metrics.length = 0;
|
||||||
$scope.processTableGroups(tabifyAggResponse($scope.vis, resp));
|
$scope.processTableGroups(tabifyAggResponse($scope.vis, resp, options));
|
||||||
$element.trigger('renderComplete');
|
$element.trigger('renderComplete');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue