Skip to content
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

[5.x] Speed up rendering of large docs in doc table #9069

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/ui/public/doc_table/components/table_row.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'lodash';
import $ from 'jquery';
import addWordBreaks from 'ui/utils/add_word_breaks';
import 'ui/highlight';
import 'ui/highlight/highlight_tags';
import 'ui/doc_viewer';
Expand Down Expand Up @@ -150,18 +149,14 @@ module.directive('kbnTableRow', function ($compile) {
/**
* Fill an element with the value of a field
*/
function _displayField(row, fieldName, breakWords) {
function _displayField(row, fieldName, truncate) {
let indexPattern = $scope.indexPattern;
let text = indexPattern.formatField(row, fieldName);

if (breakWords) {
text = addWordBreaks(text, MIN_LINE_LENGTH);

if (text.length > MIN_LINE_LENGTH) {
return truncateByHeightTemplate({
body: text
});
}
if (truncate && text.length > MIN_LINE_LENGTH) {
return truncateByHeightTemplate({
body: text
});
}

return text;
Expand Down
10 changes: 10 additions & 0 deletions src/ui/public/doc_table/doc_table.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ doc-table {

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

// break-word is what we really want but it hasn't been added to the standard and adopted by all browsers yet,
// so we provide break-all as a fallback
word-break: break-all;
word-break: break-word;
}

.discover-table-sourcefield {
word-break: break-all;
word-break: break-word;
}

.loading {
Expand Down
25 changes: 0 additions & 25 deletions src/ui/public/utils/__tests__/add_word_breaks.js

This file was deleted.

49 changes: 0 additions & 49 deletions src/ui/public/utils/add_word_breaks.js

This file was deleted.