Merge pull request #4102 from ycombinator/gh-3993

Preserve whitespace in discover table cells for added fields
This commit is contained in:
Spencer 2015-06-04 14:38:54 -07:00
commit dac6df7347
3 changed files with 20 additions and 4 deletions

View file

@ -23,10 +23,11 @@ define(function (require) {
* ```
*/
module.directive('kbnTableRow', function ($compile) {
var noWhiteSpace = require('utils/no_white_space');
var openRowHtml = require('text!components/doc_table/components/table_row/open.html');
var detailsHtml = require('text!components/doc_table/components/table_row/details.html');
var cellTemplate = _.template(require('text!components/doc_table/components/table_row/cell.html'));
var truncateByHeightTemplate = _.template(require('text!partials/truncate_by_height.html'));
var cellTemplate = _.template(noWhiteSpace(require('text!components/doc_table/components/table_row/cell.html')));
var truncateByHeightTemplate = _.template(noWhiteSpace(require('text!partials/truncate_by_height.html')));
return {
restrict: 'A',
@ -106,6 +107,7 @@ define(function (require) {
$scope.columns.forEach(function (column) {
newHtmls.push(cellTemplate({
timefield: false,
sourcefield: (column === '_source'),
formatted: _displayField(row, column, true)
}));
});

View file

@ -1,3 +1,13 @@
<td <%= timefield ? 'class="discover-table-timefield" width="1%"' : '' %>>
<%
var attributes = '';
if (timefield) {
attributes='class="discover-table-timefield" width="1%"';
} else if (sourcefield) {
attributes='class="discover-table-sourcefield"';
} else {
attributes='class="discover-table-datafield"';
}
%>
<td <%= attributes %>>
<%= formatted %>
</td>
</td>

View file

@ -7,6 +7,10 @@ doc-table {
margin: 5px;
.flex(1, 1, 100%);
.discover-table-datafield {
white-space: pre;
}
.loading {
opacity: @loading-opacity;
}