-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve whitespace in discover table cells for added fields #4102
Conversation
<td <%= timefield ? 'class="discover-table-timefield" width="1%"' : '' %>><%= formatted %></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure there are other templates that need to have the whitespace stripped from them (like src/kibana/components/doc_table/components/table_row/details.html). Consider using the no_white_space utility to accomplish this rather than turning them all into single-line templates.
@spalger I've used the |
@@ -104,10 +105,10 @@ define(function (require) { | |||
} | |||
|
|||
$scope.columns.forEach(function (column) { | |||
newHtmls.push(cellTemplate({ | |||
newHtmls.push(noWhiteSpace(cellTemplate({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need the noWhiteSpace
filter here. The cellTemplate
was already stripped of whitespace so any that shows up in the results is from the value and should be shown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the noWhiteSpace
filter here causes this display for the _source
column:
Adding the filter back fixes the display:
I too think its odd that I need to apply this filter over here. I'm guessing there's another way to fix the _source
display issue (when the filter is removed) but I haven't been able to figure out how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say that the _source field shouldn't have significant white-space. It if does then a couple new lines will hide the rest of the fields. What do you think @rashidkpc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found a better fix. It still involves using noWhiteSpace
in two places but I think its the right way to use it. Please hold while I commit.
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'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
LGTM! |
Preserve whitespace in discover table cells for added fields
Fixes #3993.