UNPKG

@spalger/kibana

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

31 lines (26 loc) 998 B
define(function (require) { // get the kibana/metric_vis module, and make sure that it requires the "kibana" module if it // didn't already var module = require('ui/modules').get('kibana/metric_vis', ['kibana']); module.controller('KbnMetricVisController', function ($scope, Private) { var tabifyAggResponse = Private(require('ui/agg_response/tabify/tabify')); var metrics = $scope.metrics = []; $scope.processTableGroups = function (tableGroups) { tableGroups.tables.forEach(function (table) { table.columns.forEach(function (column, i) { var fieldFormatter = table.aggConfig(column).fieldFormatter(); metrics.push({ label: column.title, value: fieldFormatter(table.rows[0][i]) }); }); }); }; $scope.$watch('esResponse', function (resp) { if (resp) { metrics.length = 0; $scope.processTableGroups(tabifyAggResponse($scope.vis, resp)); } }); }); });