-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discover] Move truncate-by-height into Discover #114320
Merged
Merged
Changes from 12 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
4a49e61
[Discover] move source field formatter to discover
dimaanj 7024757
[Discover] cleanup source field from field formatters
dimaanj 7714a4e
Merge branch 'master' into move-truncate-by-height
kibanamachine 66c0f9d
[Discover] return source field format
dimaanj 254d5ca
[Discover] move truncate by height to discover settings category, app…
dimaanj 9cfeb8e
Merge branch 'master' into move-truncate-by-height
kibanamachine 5a201c4
[Discover] improve code readability, fix i18n
dimaanj a610b67
[Discover] fix remaining i18n
dimaanj 8b163ca
[Discover] fix unit tests
dimaanj 57ff582
[Discover] return truncate-by-height setting to general
dimaanj 2dabce6
[Discover] return i18n naming
dimaanj 7a82ebc
Merge branch 'master' into move-truncate-by-height
kibanamachine a92d021
Merge branch 'master' into move-truncate-by-height
kibanamachine 5f7d2f1
[Discover] apply suggestions
dimaanj 7a9f271
[Discover] fix i18n
dimaanj 262260b
Merge branch 'master' into move-truncate-by-height
kibanamachine a0e86e3
Update src/plugins/discover/server/ui_settings.ts
dimaanj 8c49f95
[Discover] fix embeddable and discover grid truncation styles
dimaanj 5337751
[Discover] fix tests
dimaanj 03ef077
Merge branch 'master' into move-truncate-by-height
dimaanj b5069b0
[Discover] get rid of emotion
dimaanj 855ab1b
Merge branch 'master' into move-truncate-by-height
kibanamachine f296163
Merge branch 'master' into move-truncate-by-height
kibanamachine 010161f
Merge branch 'master' of https://github.com/elastic/kibana into move-…
dimaanj 220ffc7
[Discover] apply suggestions
dimaanj 71af85d
[Discover] inject emotion styles properly
dimaanj 0d9493d
[Discover] remove console.log
dimaanj d3d4372
[Discover] revert react router changes
dimaanj 7f6b878
[Discover] fix truncate max height reset
dimaanj ca1a41f
[Discover] simplify
dimaanj e2b6983
[Discover] return injection to the right place
dimaanj 7b87342
[Discover] remove unused import
dimaanj 09adf01
Merge branch 'master' into move-truncate-by-height
kibanamachine 00a2345
Merge branch 'master' into move-truncate-by-height
dimaanj 4bb8b12
Merge branch 'master' into move-truncate-by-height
kibanamachine 1c5547d
[Discover] apply suggestions
dimaanj 8e4fd8f
Merge branch 'main' into move-truncate-by-height
kibanamachine 5a9c4e4
Merge branch 'main' into move-truncate-by-height
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -103,10 +103,6 @@ | |
text-align: center; | ||
} | ||
|
||
.truncate-by-height { | ||
overflow: hidden; | ||
} | ||
|
||
.table { | ||
// Nesting | ||
.table { | ||
|
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
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
42 changes: 42 additions & 0 deletions
42
...lugins/discover/public/application/apps/main/components/doc_table/lib/formatters/mocks.ts
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,42 @@ | ||
/* | ||
* 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 { IndexPattern } from '../../../../../../../../../data/common'; | ||
import { stubbedSavedObjectIndexPattern } from '../../../../../../../../../data/common/stubs'; | ||
import { fieldFormatsMock } from '../../../../../../../../../field_formats/common/mocks'; | ||
import { DocTableRow } from '../../components/table_row'; | ||
|
||
export const hit = { | ||
_id: 'a', | ||
_type: 'doc', | ||
_score: 1, | ||
_source: { | ||
foo: 'bar', | ||
number: 42, | ||
hello: '<h1>World</h1>', | ||
also: 'with "quotes" or \'single quotes\'', | ||
}, | ||
} as DocTableRow; | ||
|
||
const createIndexPattern = () => { | ||
const id = 'my-index'; | ||
const { | ||
type, | ||
version, | ||
attributes: { timeFieldName, fields, title }, | ||
} = stubbedSavedObjectIndexPattern(id); | ||
|
||
return new IndexPattern({ | ||
spec: { id, type, version, timeFieldName, fields: JSON.parse(fields), title }, | ||
fieldFormats: fieldFormatsMock, | ||
shortDotsEnable: false, | ||
metaFields: [], | ||
}); | ||
}; | ||
|
||
export const indexPattern = createIndexPattern(); |
File renamed without changes.
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
40 changes: 40 additions & 0 deletions
40
...ublic/application/apps/main/components/doc_table/lib/formatters/source_formatter.test.tsx
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,40 @@ | ||
/* | ||
* 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 { formatSource } from './source_formatter'; | ||
import { hit, indexPattern } from './mocks'; | ||
|
||
describe('_source formatter', () => { | ||
it('should format properly', () => { | ||
const element = formatSource({ hit, indexPattern, isShortDots: true }); | ||
expect(element).toMatchInlineSnapshot(` | ||
<TemplateComponent | ||
defPairs={ | ||
Array [ | ||
Array [ | ||
"also", | ||
"with \\"quotes\\" or 'single quotes'", | ||
], | ||
Array [ | ||
"foo", | ||
"bar", | ||
], | ||
Array [ | ||
"hello", | ||
"<h1>World</h1>", | ||
], | ||
Array [ | ||
"number", | ||
42, | ||
], | ||
] | ||
} | ||
/> | ||
`); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding it in this place, might cause some issues. This is the legacy table implementation, which might not be enabled, if users opt-in for datagrid. But we're using the
truncate-by-height
class also outside the legacy implementation in one place - the tabular tab (https://github.com/elastic/kibana/blob/master/src/plugins/discover/public/application/components/table/table_cell_value.tsx#L28) which would still be available even when new data grid is enabled, but then wouldn't get those styles anymore.I think we need to pull this out a layer, and e.g. put it into the discover layout component. cc @kertal Or am I missunderstanding the hierachy of components here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this is correct! excellent catch. However, do we really need to have this configureable in the same way it is handled in table cell? since it's a different use case here. For now I'd say, yes this needs to be pull moved up in the hierarchy ... but then there's the problem, that we would also need this in the embeddable. So maybe it's better to add a similar implementation to the doc viewer table? A doc-viewer-truncate-by-height for this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a problem with embeddable. When we have multiple discover tables in it,
<Global>
emotion styles will be overwritten per each table globally. So to get rid of that, I would suggest to apply inlineemoution
styles to each element which needs truncation, like I did in the last commit.