Skip to content
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] Truncate table header to 3 lines #171013

Merged
merged 16 commits into from
Jan 11, 2024

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Nov 10, 2023

Truncates table headers to 3 lines:

image

@mbondyra mbondyra added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.12.0 labels Nov 10, 2023
@mbondyra mbondyra force-pushed the discover/multiline_table branch 3 times, most recently from 1b472b0 to 0a8fc25 Compare November 10, 2023 15:07
@mbondyra mbondyra marked this pull request as ready for review November 13, 2023 08:54
@mbondyra mbondyra requested review from a team as code owners November 13, 2023 08:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@mbondyra mbondyra added loe:small Small Level of Effort impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. labels Nov 13, 2023
@mbondyra mbondyra marked this pull request as draft November 14, 2023 10:17
@kertal
Copy link
Member

kertal commented Nov 15, 2023

Thx a lot for this POC @mbondyra 🎉 , I've a question, would it be possible to limit the height of the table header to e.g. 3 lines and on top of that apply truncation? Thx

@mbondyra
Copy link
Contributor Author

@kertal it is possible and simple to implement if you want to apply truncation at the end of the string. IF you want to middle truncate in multi-line string, that's unfortunately not possible atm.

@mbondyra mbondyra changed the title [Discover] test - make the table header to wrap in multilines instead of truncate [Discover] test - truncate table header to 3 lines Nov 29, 2023
@mbondyra mbondyra force-pushed the discover/multiline_table branch from 0a8fc25 to 8425a64 Compare November 29, 2023 12:54
@mbondyra mbondyra changed the title [Discover] test - truncate table header to 3 lines [Discover] Truncate table header to 3 lines Nov 29, 2023
@mbondyra mbondyra force-pushed the discover/multiline_table branch from 8425a64 to ffe11dd Compare December 1, 2023 12:26
@mbondyra mbondyra marked this pull request as ready for review December 1, 2023 14:41
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great, thanks! We're going to discuss merging this early next week.

@opauloh
Copy link
Contributor

opauloh commented Dec 5, 2023

Hi @mbondyra, I'm testing it locally from a plugin that uses the UnifiedDataTable, is it intended to truncate only when passing the showColumnTokens to the UnifiedDataTable?

with showColumnTokens = true

image

with showColumnTokens = false
image

@opauloh
Copy link
Contributor

opauloh commented Dec 5, 2023

I think it's a good idea that we can show more header information, particularly useful for longer ECS fields, I only think that the Icons are taking up unneeded space on lines 2 and 3, and if that space could be filled with text would be more valuable.

image

What do you think about making the Token Icon inline as suggested below, so we have more space to show the column header?

image

Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we include this feature as an optional property (i.e headerRowHeight)in the <UnifiedDataTable/> component and fallback it to 1, so plugins that use the Table (such as cloud_security_posture can opt for enabling that feature and also have more control over how much to truncate?

Usage suggestion (on Discovers page to apply the 3 row truncate):

<UnifiedDataTable
   //...
  headerRowHeight={3}
/>

@mbondyra
Copy link
Contributor Author

mbondyra commented Dec 5, 2023

Hi @opauloh!

is it intended to truncate only when passing the showColumnTokens to the UnifiedDataTable?

No, that's a bug, thank you for finding it!

I think it's a good idea that we can show more header information, particularly useful for longer ECS fields, I only think that the Icons are taking up unneeded space on lines 2 and 3, and if that space could be filled with text would be more valuable.

I like it, but I would like a designer's opinion too! @andreadelrio, could you let us know what you think?

Could we include this feature as an optional property (i.e headerRowHeight)in the component and fallback it to 1

Sure, that's a good idea, I'll add it 👌🏼

@kertal
Copy link
Member

kertal commented Dec 5, 2023

thx for the feedback @opauloh, I've a question. While those field tokens make sense in the Discover context (exploring the structure of the data, providing quick visual feedback about field types), I wonder if the are useful in the Security / Findings context, where I assume the type of the field might be redundant information?

@mbondyra mbondyra force-pushed the discover/multiline_table branch 2 times, most recently from 6b4dec8 to 15183ab Compare December 5, 2023 11:07
@mbondyra mbondyra force-pushed the discover/multiline_table branch from f1cb1ab to 9468980 Compare January 3, 2024 11:02
@mbondyra
Copy link
Contributor Author

mbondyra commented Jan 3, 2024

@davismcphee I added the inline icon! I also noticed I didn't update the timestamp column header so I added that too. For numeric columns, the text is aligned to the right and it looks weird, but if we want to wrap it to 3 lines, I don't see other option.

Screenshot 2024-01-03 at 12 04 57

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great overall, just about ready to merge!

For numeric columns, the text is aligned to the right and it looks weird, but if we want to wrap it to 3 lines, I don't see other option.

I played around with this a bit and found that if we use float: right instead of text-align: right it allows us to right align the header content but still have the text wrap from the left. I think this should solve the issue for us.

Since I made the changes in my local branch anyway, I figured I'd just open a PR against yours here: mbondyra#9. I was also going to leave a couple of other very minor nits, but figured since I was in here anyway I'd just take care of them too.

If you could take a sec to test and confirm that the change works, and merge it into this branch if it does, this PR will be all good to go on my end. Thanks for all the work on this!

@jughosta
Copy link
Contributor

jughosta commented Jan 5, 2024

Fyi: there are some updates coming to Eui data grid header #173569
Would be great to see how it works together.

[Discover] Improve numeric column text wrapping and some minor touchups
@mbondyra
Copy link
Contributor Author

mbondyra commented Jan 5, 2024

@jughosta thanks for the heads up! I'll wait for the eui update to be merged and test again.
@davismcphee thanks for stepping in and a wonderful float:right solution, TIL 😀

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noooo, we were so close to being good to merge and now there's conflicts from the EUI upgrade 😢 But this is all ready to go on my end now, so once you get a chance to resolve the conflicts I'll do a super quick test again and click the approve button 👍

mbondyra and others added 4 commits January 7, 2024 21:58
…/multiline_table

# Conflicts:
#	packages/kbn-unified-data-table/src/components/__snapshots__/data_table_columns.test.tsx.snap
#	packages/kbn-unified-data-table/src/components/data_table.scss
#	packages/kbn-unified-data-table/src/components/data_table_columns.tsx
Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested one final time and it's still working as expected after the EUI upgrade 👍 The new three dots icon on hover causes things to look a little odd when the header text wraps since it shifts the text, but I don't think there's much we can do about that.

Thanks for the patience and all the work on this @mbondyra! Now quick, let's merge this before they change things on us again 😄

@mbondyra
Copy link
Contributor Author

@andreadelrio @MichaelMarcialis if you could take a look too that would be great!

Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design changes LGTM. Thanks @mbondyra !

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cloudSecurityPosture 414.1KB 414.9KB +837.0B
discover 558.6KB 559.5KB +901.0B
total +1.7KB
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 111 112 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @mbondyra

@mbondyra mbondyra merged commit 4842e42 into elastic:main Jan 11, 2024
19 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 11, 2024
@mbondyra mbondyra deleted the discover/multiline_table branch January 11, 2024 12:23
@achyutjhunjhunwala
Copy link
Contributor

@mbondyra I use font size large on my chrome. Due to this i see the scrollbar appearing on the table header which is quite weird. Not sure if its a bug but should be checked from accessibility perspective

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Discover Discover Application impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.