@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
41 lines (33 loc) • 976 B
JavaScript
define(function (require) {
return function TableProvider() {
var _ = require('lodash');
/**
* Simple table class that is used to contain the rows and columns that create
* a table. This is usually found at the root of the response or within a TableGroup
*/
function Table() {
this.columns = null; // written with the first row
this.rows = [];
}
Table.prototype.title = function () {
if (this.$parent) {
return this.$parent.title;
} else {
return '';
}
};
Table.prototype.aggConfig = function (col) {
if (!col.aggConfig) {
throw new TypeError('Column is missing the aggConfig property');
}
return col.aggConfig;
};
Table.prototype.field = function (col) {
return this.aggConfig(col).field();
};
Table.prototype.fieldFormatter = function (col) {
return this.aggConfig(col).fieldFormatter();
};
return Table;
};
});