Commit 427629b4 by michael-az Committed by GitHub

TablePanel: display multi-line text (#20210)

* TablePanel: display multi-line text

* Fix tests
parent ffe0a1f9
......@@ -305,26 +305,23 @@ export class TableRenderer {
cellClasses.push('table-panel-cell-link');
columnHtml += `
<a href="${sanitizedCellLink}" target="${cellTarget}" data-link-tooltip data-original-title="${cellLinkTooltip}" data-placement="right"${cellStyle}>
${value}
</a>
`;
columnHtml += `<a href="${sanitizedCellLink}" target="${cellTarget}" data-link-tooltip data-original-title="${cellLinkTooltip}" data-placement="right"${cellStyle}>`;
columnHtml += `${value}`;
columnHtml += `</a>`;
} else {
columnHtml += value;
}
if (column.filterable) {
cellClasses.push('table-panel-cell-filterable');
columnHtml += `
<a class="table-panel-filter-link" data-link-tooltip data-original-title="Filter out value" data-placement="bottom"
data-row="${rowIndex}" data-column="${columnIndex}" data-operator="!=">
<i class="fa fa-search-minus"></i>
</a>
<a class="table-panel-filter-link" data-link-tooltip data-original-title="Filter for value" data-placement="bottom"
data-row="${rowIndex}" data-column="${columnIndex}" data-operator="=">
<i class="fa fa-search-plus"></i>
</a>`;
columnHtml += `<a class="table-panel-filter-link" data-link-tooltip data-original-title="Filter out value" data-placement="bottom"
data-row="${rowIndex}" data-column="${columnIndex}" data-operator="!=">`;
columnHtml += `<i class="fa fa-search-minus"></i>`;
columnHtml += `</a>`;
columnHtml += `<a class="table-panel-filter-link" data-link-tooltip data-original-title="Filter for value" data-placement="bottom"
data-row="${rowIndex}" data-column="${columnIndex}" data-operator="=">`;
columnHtml += `<i class="fa fa-search-plus"></i>`;
columnHtml += `</a>`;
}
if (cellClasses.length) {
......
......@@ -317,12 +317,9 @@ describe('when rendering table', () => {
it('link should render as', () => {
const html = renderer.renderCell(7, 0, 'host1');
const expectedHtml = `
<td class="table-panel-cell-link">
<a href="/dashboard?param=host1&param_1=1230&param_2=40"
target="_blank" data-link-tooltip data-original-title="host1 1230 my.host.com" data-placement="right">
host1
</a>
</td>
<td class="table-panel-cell-link"><a href="/dashboard?param=host1&param_1=1230&param_2=40"
target="_blank" data-link-tooltip data-original-title="host1 1230 my.host.com"
data-placement="right">host1</a></td>
`;
expect(normalize(html)).toBe(normalize(expectedHtml));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment