Skip to content

Table: don't eat multiple consecutive spaces in fields Edit #778

Closed

Description

The kibana table display includes strings in the <td> elements from messages that are merely escaped but spaces are untouched. In HTML, two consecutive spaces are interpreted as a single space. This is bad because I am trying to display sets of log lines that are to be viewed together and they are formatted in a grid. In this text grid, multiple spaces are inserted for alignment purposes, and I need to have them preserved in the Web interface.

I came up with this small change to replace each space with  , and it seems to fix the issue for me.

(I also changed the css to display the table in Monospace font, but that's another issue.)

diff --git a/src/app/panels/table/module.js b/src/app/panels/table/module.js
index 20b0736..8a535e6 100644
--- a/src/app/panels/table/module.js
+++ b/src/app/panels/table/module.js
@@ -380,7 +380,9 @@ function (angular, app, _, kbn, moment) {
   module.filter('tableTruncate', function() {
     return function(text,length,factor) {
       if (!_.isUndefined(text) && !_.isNull(text) && text.toString().length > 0) {
-        return text.length > length/factor ? text.substr(0,length/factor)+'...' : text;
+         text = text.length > length/factor ? text.substr(0,length/factor)+'...' : text;
+         text = text.replace(/ /g, "&nbsp;");
+         return text;
       }
       return '';
     };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugFixes for quality problems that affect the customer experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions