Skip to content

Commit

Permalink
[aggTable] format values for table titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Spencer Alger committed Nov 4, 2014
1 parent 643743b commit ae35f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define(function (require) {
if (group) {
table.aggConfig = agg;
table.key = key;
table.title = agg.makeLabel() + ': ' + key;
table.title = agg.makeLabel() + ': ' + table.fieldFormat(key);
}

var parent = this.splitStack[0];
Expand Down
11 changes: 11 additions & 0 deletions src/kibana/components/agg_response/tabify/_table_group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
define(function (require) {
return function TableGroupProvider() {
var _ = require('lodash');

/**
* Simple object that wraps multiple tables. It contains information about the aggConfig
* and bucket that created this group and a list of the tables within it.
Expand All @@ -11,6 +13,15 @@ define(function (require) {
this.tables = [];
}

TableGroup.prototype.field = function () {
return this.aggConfig && this.aggConfig.params && this.aggConfig.params.field;
};

TableGroup.prototype.fieldFormat = function () {
var field = this.field();
return field ? field.format.convert : _.identity;
};

return TableGroup;
};
});

0 comments on commit ae35f7d

Please sign in to comment.