-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Fix multiline display in classic table (#103499)
* Restore CSS that broke multiline display * Add functional test
- Loading branch information
Showing
6 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/plugins/discover/public/application/angular/doc_table/components/table_row/_cell.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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 { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
const kibanaServer = getService('kibanaServer'); | ||
const PageObjects = getPageObjects(['common', 'discover']); | ||
const find = getService('find'); | ||
const log = getService('log'); | ||
const retry = getService('retry'); | ||
const security = getService('security'); | ||
|
||
describe('discover doc table newline handling', function describeIndexTests() { | ||
before(async function () { | ||
await security.testUser.setRoles(['kibana_admin', 'kibana_message_with_newline']); | ||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/message_with_newline'); | ||
await kibanaServer.uiSettings.replace({ | ||
defaultIndex: 'newline-test', | ||
'doc_table:legacy': true, | ||
}); | ||
await PageObjects.common.navigateToApp('discover'); | ||
}); | ||
after(async () => { | ||
await security.testUser.restoreDefaults(); | ||
esArchiver.unload('test/functional/fixtures/es_archiver/message_with_newline'); | ||
await kibanaServer.uiSettings.unset('defaultIndex'); | ||
await kibanaServer.uiSettings.unset('doc_table:legacy'); | ||
}); | ||
|
||
it('should break text on newlines', async function () { | ||
await PageObjects.discover.clickFieldListItemToggle('message'); | ||
const dscTableRows = await find.allByCssSelector('.kbnDocTable__row'); | ||
|
||
await retry.waitFor('height of multi-line content > single-line content', async () => { | ||
const heightWithoutNewline = await dscTableRows[0].getAttribute('clientHeight'); | ||
const heightWithNewline = await dscTableRows[1].getAttribute('clientHeight'); | ||
log.debug(`Without newlines: ${heightWithoutNewline}, With newlines: ${heightWithNewline}`); | ||
return Number(heightWithNewline) > Number(heightWithoutNewline); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
test/functional/fixtures/es_archiver/message_with_newline/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"type": "doc", | ||
"value": { | ||
"id": "index-pattern:newline-test", | ||
"index": ".kibana", | ||
"source": { | ||
"index-pattern": { | ||
"fields": "[]", | ||
"title": "newline-test" | ||
}, | ||
"type": "index-pattern" | ||
} | ||
} | ||
} | ||
|
||
{ | ||
"type": "doc", | ||
"value": { | ||
"id": "1", | ||
"index": "newline-test", | ||
"source": { | ||
"message" : "no new line" | ||
} | ||
} | ||
} | ||
|
||
{ | ||
"type": "doc", | ||
"value": { | ||
"id": "2", | ||
"index": "newline-test", | ||
"source": { | ||
"message" : "two\nnew\nlines" | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/functional/fixtures/es_archiver/message_with_newline/mappings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"type": "index", | ||
"value": { | ||
"index": "newline-test", | ||
"settings": { | ||
"index": { | ||
"number_of_replicas": "0", | ||
"number_of_shards": "1" | ||
} | ||
} | ||
} | ||
} |