mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.12`: - [[UnifiedDataTable] Fix rendering of multi-line content (#173524)](https://github.com/elastic/kibana/pull/173524) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2023-12-20T08:33:07Z","message":"[UnifiedDataTable] Fix rendering of multi-line content (#173524)\n\n- Resolves https://github.com/elastic/kibana/issues/173019 \r\n\r\n## Summary\r\n\r\nThis PR fixes a recent bug with multi line content and adds functional\r\ntests.\r\n\r\n50x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4608\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"d773cfbf83765c849cbdf6013c5b4614842967fe","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:fix","Team:DataDiscovery","backport:prev-minor","v8.13.0"],"number":173524,"url":"https://github.com/elastic/kibana/pull/173524","mergeCommit":{"message":"[UnifiedDataTable] Fix rendering of multi-line content (#173524)\n\n- Resolves https://github.com/elastic/kibana/issues/173019 \r\n\r\n## Summary\r\n\r\nThis PR fixes a recent bug with multi line content and adds functional\r\ntests.\r\n\r\n50x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4608\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"d773cfbf83765c849cbdf6013c5b4614842967fe"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173524","number":173524,"mergeCommit":{"message":"[UnifiedDataTable] Fix rendering of multi-line content (#173524)\n\n- Resolves https://github.com/elastic/kibana/issues/173019 \r\n\r\n## Summary\r\n\r\nThis PR fixes a recent bug with multi line content and adds functional\r\ntests.\r\n\r\n50x\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4608\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"d773cfbf83765c849cbdf6013c5b4614842967fe"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
parent
14aa279d6f
commit
606db2f2e0
3 changed files with 116 additions and 1 deletions
|
@ -54,6 +54,11 @@
|
|||
.euiDataGrid__scrollOverlay .euiDataGrid__scrollBarOverlayRight {
|
||||
background-color: transparent; // otherwise the grid scrollbar border visually conflicts with the grid toolbar controls
|
||||
}
|
||||
|
||||
.euiDataGridRowCell__autoHeight,
|
||||
.euiDataGridRowCell__lineCountHeight {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.unifiedDataTable__table {
|
||||
|
@ -169,4 +174,4 @@
|
|||
[data-euiportal='true'],
|
||||
[data-euiportal='true'] *) {
|
||||
z-index: unset !important;
|
||||
}
|
||||
}
|
||||
|
|
109
test/functional/apps/discover/group2/_data_grid_new_line.ts
Normal file
109
test/functional/apps/discover/group2/_data_grid_new_line.ts
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
const INDEX_NAME = 'newline';
|
||||
const VALUE_WITH_NEW_LINES = "Newline!\nHere's a newline.\nHere's a newline again.";
|
||||
const VALUE_WITHOUT_NEW_LINES = VALUE_WITH_NEW_LINES.replaceAll('\n', ' ');
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const browser = getService('browser');
|
||||
const es = getService('es');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const dataGrid = getService('dataGrid');
|
||||
const PageObjects = getPageObjects([
|
||||
'settings',
|
||||
'common',
|
||||
'discover',
|
||||
'header',
|
||||
'timePicker',
|
||||
'unifiedFieldList',
|
||||
]);
|
||||
const defaultSettings = { defaultIndex: 'logstash-*' };
|
||||
const security = getService('security');
|
||||
|
||||
describe('discover data grid new line support', function describeIndexTests() {
|
||||
before(async () => {
|
||||
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
|
||||
await browser.setWindowSize(1200, 2000);
|
||||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
|
||||
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');
|
||||
|
||||
await es.transport.request({
|
||||
path: `/${INDEX_NAME}/_doc`,
|
||||
method: 'POST',
|
||||
body: {
|
||||
message: VALUE_WITH_NEW_LINES,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await es.transport.request({
|
||||
path: `/${INDEX_NAME}`,
|
||||
method: 'DELETE',
|
||||
});
|
||||
|
||||
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover');
|
||||
await kibanaServer.uiSettings.replace({});
|
||||
await kibanaServer.savedObjects.cleanStandardList();
|
||||
});
|
||||
|
||||
beforeEach(async function () {
|
||||
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
|
||||
await kibanaServer.uiSettings.update(defaultSettings);
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
await PageObjects.discover.createAdHocDataView(INDEX_NAME, false);
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
});
|
||||
|
||||
it('should not show new lines for Document column', async () => {
|
||||
const rows = await dataGrid.getDocTableRows();
|
||||
expect(rows.length).to.be.above(0);
|
||||
|
||||
const cell = await dataGrid.getCellElement(0, 2);
|
||||
const content = await cell.findByCssSelector('.unifiedDataTable__descriptionListDescription');
|
||||
expect(await content.getVisibleText()).to.be(VALUE_WITHOUT_NEW_LINES);
|
||||
expect(await content.getComputedStyle('white-space')).to.be('normal');
|
||||
});
|
||||
|
||||
it('should show new lines for "message" column except for Single row height setting', async () => {
|
||||
await PageObjects.unifiedFieldList.clickFieldListItemAdd('message');
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
|
||||
let cell = await dataGrid.getCellElement(0, 2);
|
||||
let content = await cell.findByCssSelector('.unifiedDataTable__cellValue');
|
||||
expect(await content.getVisibleText()).to.be(VALUE_WITH_NEW_LINES);
|
||||
expect(await content.getComputedStyle('white-space')).to.be('pre-wrap');
|
||||
|
||||
await dataGrid.clickGridSettings();
|
||||
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom');
|
||||
await dataGrid.changeRowHeightValue('Auto fit');
|
||||
await dataGrid.clickGridSettings();
|
||||
|
||||
cell = await dataGrid.getCellElement(0, 2);
|
||||
content = await cell.findByCssSelector('.unifiedDataTable__cellValue');
|
||||
expect(await content.getVisibleText()).to.be(VALUE_WITH_NEW_LINES);
|
||||
expect(await content.getComputedStyle('white-space')).to.be('pre-wrap');
|
||||
|
||||
await dataGrid.clickGridSettings();
|
||||
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit');
|
||||
await dataGrid.changeRowHeightValue('Single');
|
||||
await dataGrid.clickGridSettings();
|
||||
|
||||
cell = await dataGrid.getCellElement(0, 2);
|
||||
content = await cell.findByCssSelector('.unifiedDataTable__cellValue');
|
||||
expect(await content.getVisibleText()).to.be(VALUE_WITHOUT_NEW_LINES);
|
||||
expect(await content.getComputedStyle('white-space')).to.be('nowrap');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -28,6 +28,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./_data_grid_doc_table'));
|
||||
loadTestFile(require.resolve('./_data_grid_copy_to_clipboard'));
|
||||
loadTestFile(require.resolve('./_data_grid_row_height'));
|
||||
loadTestFile(require.resolve('./_data_grid_new_line'));
|
||||
loadTestFile(require.resolve('./_data_grid_sample_size'));
|
||||
loadTestFile(require.resolve('./_data_grid_pagination'));
|
||||
loadTestFile(require.resolve('./_data_grid_footer'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue