-
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][DocViewer] Limit the height of long field values by default #183736
Conversation
/ci |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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 haven't tested yet, and I think we definitely need something like this back in the doc viewer for long values, but two thoughts:
- If we intend to migrate doc viewer to EUI data grid, will this be as useful since users will be able to customize the row height anyway?
- With the design in this PR, if a user clicks "view more" and the value turns out to be really long, they have to scroll all the way to the end to get to the "view less" button, which seems like it could be a frustrating UX. Something we might want to consider from the design side.
Hi @davismcphee,
I think it would be still useful. EuiDataGrid allows to truncate all cell values or to auto-show all cell values but there is no option "in between" to show one value while truncating the others for example.
Good point. We could also return the arrow button which would be shown above the value. |
I do agree at the current state I think it is useful at this state and also initially when introducing EuiDataGrid.
Definitely good point! Visually I like the text buttons more than the expand error, but functional-wise, yes it could lead to lots of scrolling. Wdyt @andreadelrio @isaclfreire , back in the days, be fore we removed it it looked like this: |
@kertal @andreadelrio @davismcphee How should we proceed here? By returning the arrow button? |
@jughosta It looks like @andreadelrio is on PTO this week, and it would be great to get her input if we can wait until she's back. Otherwise we could reach out to someone else from design instead. |
Hi team, what if we do something like this? It's borrowing from the proposal I shared when we were going to do #179189. If we choose this direction, I'm happy to add the new icons (plus and minus in square) to EUI. |
@andreadelrio that works for me! |
@andreadelrio yes, much better than the old expand arrow |
…-values # Conflicts: # src/plugins/unified_doc_viewer/public/components/doc_viewer_table/table.scss
In the latest iteration @jughosta suggested an existing plus icon, since the new one in not yet available. For consistency of expanding I'd suggest to go with the arrow like back in the days, because it's also used in the field list. We can easily change to the new icons @andreadelrio suggested. I think with placing the arrow on the left side of the text if screen space allows it, it's already looking better. When testing I've noticed that Chrome / Firefox might need a bit less height, at least in my used example it looked like this |
/ci |
… collapse-long-field-values
/ci |
Ready for review 💫 |
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.
Design changes LGTM. Nice job @jughosta !
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.
The code changes look good and it works well! Just left a couple of minor questions.
src/plugins/unified_doc_viewer/public/components/doc_viewer_table/table_cell_value.test.tsx
Outdated
Show resolved
Hide resolved
const { uiSettings } = getUnifiedDocViewerServices(); | ||
let truncateMaxHeight = uiSettings.get(TRUNCATE_MAX_HEIGHT); | ||
|
||
if (truncateMaxHeight === TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE) { |
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.
Rather than piggybacking off the existing legacy doc table max height, I wonder if we shouldn't just introduce a dedicated setting for the doc viewer flyout to avoid this hidden adjustment which seems a bit magical? Adding a new advanced setting isn't great, but ideally we'll be able to get rid of the legacy grid ones soon anyway.
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.
Okay, agree with your concern. How about making it a fixed configuration in code without introducing another setting and mark the existing one as deprecated?
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.
Yes let's do that 👍 advanced settings suck anyway so not introducing another is good. I thought about it a bit more too and I think it makes more sense to have this as a user/browser level setting instead if needed, like the ES|QL "hide null values" toggle, so we could discuss it with a designer as a potential followup.
const isCollapsible = | ||
!isDetails && | ||
truncateMaxHeight > 0 && | ||
String(rawValue).length > COLLAPSE_LINE_LENGTH && |
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.
Do we need COLLAPSE_LINE_LENGTH
if we're using the div height anyway? Couldn't we base it off only div height instead?
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.
Right, I updated the implementation.
…ble/table_cell_value.test.tsx Co-authored-by: Davis McPhee <[email protected]>
…-values # Conflicts: # src/plugins/unified_doc_viewer/public/components/doc_viewer_table/table.tsx
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.
Another quick test and it's still working great 🙌 much cleaner looking than the old version too, thanks!
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @jughosta |
- Closes #167582 ## Summary This PR removes the code related to the legacy doc table and 2 Advanced Settings: `doc_table:legacy` and `truncate:maxHeight`. The legacy table in Discover was replaced by the new data grid in v8.3. The `doc_table:legacy` Advanced Setting was added to let users switch back to the legacy table if necessary. The removal of the setting and the legacy table entirely would allow us to reduce bundle size, maintenance burden, and code complexity. Also the legacy table does not support many new features which were added to the grid only (e.g. comparing selected documents, context-aware UI based on current solution project, column resizing, bulk row selection, copy actions, new doc viewer flyout, and more). Since v8.15 `doc_table:legacy` is marked as deprecated on Advanced Settings page via #179899 Since v8.16 `truncate:maxHeight` is marked as deprecated too via #183736 The removal of these 2 settings and the associated code is planned for v9. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Closes elastic#167582 ## Summary This PR removes the code related to the legacy doc table and 2 Advanced Settings: `doc_table:legacy` and `truncate:maxHeight`. The legacy table in Discover was replaced by the new data grid in v8.3. The `doc_table:legacy` Advanced Setting was added to let users switch back to the legacy table if necessary. The removal of the setting and the legacy table entirely would allow us to reduce bundle size, maintenance burden, and code complexity. Also the legacy table does not support many new features which were added to the grid only (e.g. comparing selected documents, context-aware UI based on current solution project, column resizing, bulk row selection, copy actions, new doc viewer flyout, and more). Since v8.15 `doc_table:legacy` is marked as deprecated on Advanced Settings page via elastic#179899 Since v8.16 `truncate:maxHeight` is marked as deprecated too via elastic#183736 The removal of these 2 settings and the associated code is planned for v9. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Closes elastic#167582 ## Summary This PR removes the code related to the legacy doc table and 2 Advanced Settings: `doc_table:legacy` and `truncate:maxHeight`. The legacy table in Discover was replaced by the new data grid in v8.3. The `doc_table:legacy` Advanced Setting was added to let users switch back to the legacy table if necessary. The removal of the setting and the legacy table entirely would allow us to reduce bundle size, maintenance burden, and code complexity. Also the legacy table does not support many new features which were added to the grid only (e.g. comparing selected documents, context-aware UI based on current solution project, column resizing, bulk row selection, copy actions, new doc viewer flyout, and more). Since v8.15 `doc_table:legacy` is marked as deprecated on Advanced Settings page via elastic#179899 Since v8.16 `truncate:maxHeight` is marked as deprecated too via elastic#183736 The removal of these 2 settings and the associated code is planned for v9. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
- Closes elastic#167582 ## Summary This PR removes the code related to the legacy doc table and 2 Advanced Settings: `doc_table:legacy` and `truncate:maxHeight`. The legacy table in Discover was replaced by the new data grid in v8.3. The `doc_table:legacy` Advanced Setting was added to let users switch back to the legacy table if necessary. The removal of the setting and the legacy table entirely would allow us to reduce bundle size, maintenance burden, and code complexity. Also the legacy table does not support many new features which were added to the grid only (e.g. comparing selected documents, context-aware UI based on current solution project, column resizing, bulk row selection, copy actions, new doc viewer flyout, and more). Since v8.15 `doc_table:legacy` is marked as deprecated on Advanced Settings page via elastic#179899 Since v8.16 `truncate:maxHeight` is marked as deprecated too via elastic#183736 The removal of these 2 settings and the associated code is planned for v9. ### Checklist - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
This PR adds a default height limit for values in DocViewer. If the value is too long, we visually truncate it and add "View more" button which allows to expand to view the entire value. This way all fields in the flyout are easily accessible (less scrolling required) even if they contain long values.
The height can be configured via the existingIf user expands a value, closes the flyout and opens it again, the value will be shown as expanded again for that field.truncate:maxHeight
Advanced Setting.Related: #164236
Testing
Some cases to check while testing:
Sample long value:
Checklist