Skip to content

Commit

Permalink
Merge pull request elastic#4102 from ycombinator/elasticgh-3993
Browse files Browse the repository at this point in the history
Preserve whitespace in discover table cells for added fields
  • Loading branch information
spalger committed Jun 4, 2015
2 parents 029360a + 46aea33 commit dac6df7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/kibana/components/doc_table/components/table_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)
}));
});
Expand Down
14 changes: 12 additions & 2 deletions src/kibana/components/doc_table/components/table_row/cell.html
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 4 additions & 0 deletions src/kibana/components/doc_table/doc_table.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ doc-table {
margin: 5px;
.flex(1, 1, 100%);

.discover-table-datafield {
white-space: pre;
}

.loading {
opacity: @loading-opacity;
}
Expand Down

0 comments on commit dac6df7

Please sign in to comment.