diff --git a/public/app/plugins/panel/table/editor.html b/public/app/plugins/panel/table/editor.html index 9206795c0d8..c9e0bad5d9a 100644 --- a/public/app/plugins/panel/table/editor.html +++ b/public/app/plugins/panel/table/editor.html @@ -103,11 +103,6 @@ -
@@ -163,7 +158,6 @@
- diff --git a/public/app/plugins/panel/table/editor.ts b/public/app/plugins/panel/table/editor.ts index 0a6f695d34b..65c8b51cab8 100644 --- a/public/app/plugins/panel/table/editor.ts +++ b/public/app/plugins/panel/table/editor.ts @@ -112,7 +112,6 @@ export class TablePanelEditorCtrl { pattern: '/.*/', dateFormat: 'YYYY-MM-DD HH:mm:ss', thresholds: [], - escapeHtml: true }; this.panel.styles.push(angular.copy(columnStyleDefaults)); diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index c39f1d42bcf..2a022d578c9 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -24,16 +24,16 @@ export class TableRenderer { return _.first(style.colors); } - defaultCellFormater(value) { - if (value === null || value === void 0 || value === undefined) { + defaultCellFormater(v) { + if (v === null || v === void 0 || v === undefined) { return ''; } - if (_.isArray(value)) { - value = value.join(', '); + if (_.isArray(v)) { + v = v.join(', '); } - return value; + return v; } createColumnFormater(style) { @@ -96,7 +96,7 @@ export class TableRenderer { renderCell(columnIndex, value, addWidthHack = false) { value = this.formatColumnValue(columnIndex, value); - value = encodeHtml(value); + value = this.encodeHtml(value); var style = ''; if (this.colorState.cell) { style = ' style="background-color:' + this.colorState.cell + ';color: white"'; @@ -141,16 +141,16 @@ export class TableRenderer { return html; } -} -function encodeHtml(unsafe) { - return unsafe.replace(/[&<>"']/g, function(m) { - return ({ - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''' - })[m]; - }); + encodeHtml(unsafe) { + return unsafe.replace(/[&<>"']/g, function(m) { + return ({ + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''' + })[m]; + }); + } } diff --git a/public/app/plugins/panel/table/specs/renderer_specs.ts b/public/app/plugins/panel/table/specs/renderer_specs.ts index e5c3d343435..75a6b03af98 100644 --- a/public/app/plugins/panel/table/specs/renderer_specs.ts +++ b/public/app/plugins/panel/table/specs/renderer_specs.ts @@ -11,8 +11,7 @@ describe('when rendering table', () => { {text: 'Value'}, {text: 'Colored'}, {text: 'Undefined'}, - {text: 'String'}, - {text: 'UnescapedString' } + {text: 'String'} ]; var panel = { @@ -41,10 +40,6 @@ describe('when rendering table', () => { { pattern: 'String', type: 'string', - }, - { - pattern: 'UnescapedString', - type: 'string' } ] }; @@ -92,7 +87,7 @@ describe('when rendering table', () => { }); it('undefined formater should return escaped html', () => { - var html = renderer.renderCell(4, "&breaking
the
row"); + var html = renderer.renderCell(3, "&breaking
the
row"); expect(html).to.be('&breaking <br /> the <br /> row'); });