Skip to content

[Cloud Security] Improve graph node label ellipsis logic#204580

Merged
kfirpeled merged 6 commits intoelastic:mainfrom
kfirpeled:cspm/improve-graph-node-label-ellipsis-logic
Dec 19, 2024
Merged

[Cloud Security] Improve graph node label ellipsis logic#204580
kfirpeled merged 6 commits intoelastic:mainfrom
kfirpeled:cspm/improve-graph-node-label-ellipsis-logic

Conversation

@kfirpeled
Copy link
Copy Markdown
Contributor

@kfirpeled kfirpeled commented Dec 17, 2024

Summary

This PR improves the logic of node's label truncation. It follows the guidelines from design:

  • Set the maximum width for names to 160px
  • Truncate names to max two lines
  • I recommend truncating names in the middle, as entity IDs often differ only in their last characters while starting similarly. This approach will make it easier to identify differences between names
  • Display the full name in a tooltip on hover for better visibility

Before:

After:

Screen.Recording.2024-12-17.at.15.26.46.mov

How to test

To test this PR you can run

yarn storybook cloud_security_posture_packages

Checklist

@kfirpeled kfirpeled added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:prev-minor labels Dec 17, 2024
@kfirpeled kfirpeled changed the title Cspm/improve graph node label ellipsis logic [Cloud Security] Improve graph node label ellipsis logic Dec 17, 2024
@kfirpeled kfirpeled marked this pull request as ready for review December 18, 2024 12:10
@kfirpeled kfirpeled requested a review from a team as a code owner December 18, 2024 12:10
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

@kfirpeled kfirpeled requested a review from maxcold December 18, 2024 12:10
text?: string;
}

const LabelComponent: React.FC<LabelProps> = ({ text = '' }: LabelProps) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was wondering if I should name it Label or NodeLabel.
There's already a node which represents a label and is named LabelNode.

Therefore I wasn't sure.
I'm open for suggestions for better names either for LabelNode or for the Label component

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 6434 6435 +1

Async chunks

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

id before after diff
securitySolution 21.4MB 21.4MB +818.0B

@kfirpeled kfirpeled requested review from a team and opauloh December 18, 2024 16:13
@kfirpeled kfirpeled merged commit f316612 into elastic:main Dec 19, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12413045339

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 19, 2024
)

## Summary

This PR improves the logic of node's label truncation. It follows the
guidelines from design:

> - Set the maximum width for names to 160px
> - Truncate names to max two lines
> - I recommend truncating names in the middle, as entity IDs often
differ only in their last characters while starting similarly. This
approach will make it easier to identify differences between names
> - Display the full name in a tooltip on hover for better visibility

Before:

<img width="150"
src="https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127"
/>
<img width="150"
src="https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f"
/>
<img width="150"
src="https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8"
/>

After:

https://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969

**How to test**

To test this PR you can run

```
yarn storybook cloud_security_posture_packages
```

### Checklist

- [ ] [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

---------

Co-authored-by: Sean Rathier <sean.rathier@elastic.co>
Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
(cherry picked from commit f316612)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 19, 2024
…) (#204933)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Improve graph node label ellipsis logic
(#204580)](#204580)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kfir
Peled","email":"61654899+kfirpeled@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-19T12:51:11Z","message":"[Cloud
Security] Improve graph node label ellipsis logic (#204580)\n\n##
Summary\r\n\r\nThis PR improves the logic of node's label truncation. It
follows the\r\nguidelines from design:\r\n\r\n> - Set the maximum width
for names to 160px\r\n> - Truncate names to max two lines\r\n> - I
recommend truncating names in the middle, as entity IDs often\r\ndiffer
only in their last characters while starting similarly. This\r\napproach
will make it easier to identify differences between names\r\n> - Display
the full name in a tooltip on hover for better visibility\r\n
\r\n\r\nBefore:\r\n\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8\"\r\n/>\r\n\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969\r\n\r\n\r\n**How
to test**\r\n\r\nTo test this PR you can run\r\n\r\n```\r\nyarn
storybook cloud_security_posture_packages\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [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\r\n\r\n---------\r\n\r\nCo-authored-by: Sean Rathier
<sean.rathier@elastic.co>\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"f31661255b366bb2f50a47b9821874bdc0cd1b8e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud
Security","backport:prev-minor"],"title":"[Cloud Security] Improve graph
node label ellipsis
logic","number":204580,"url":"https://github.com/elastic/kibana/pull/204580","mergeCommit":{"message":"[Cloud
Security] Improve graph node label ellipsis logic (#204580)\n\n##
Summary\r\n\r\nThis PR improves the logic of node's label truncation. It
follows the\r\nguidelines from design:\r\n\r\n> - Set the maximum width
for names to 160px\r\n> - Truncate names to max two lines\r\n> - I
recommend truncating names in the middle, as entity IDs often\r\ndiffer
only in their last characters while starting similarly. This\r\napproach
will make it easier to identify differences between names\r\n> - Display
the full name in a tooltip on hover for better visibility\r\n
\r\n\r\nBefore:\r\n\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8\"\r\n/>\r\n\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969\r\n\r\n\r\n**How
to test**\r\n\r\nTo test this PR you can run\r\n\r\n```\r\nyarn
storybook cloud_security_posture_packages\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [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\r\n\r\n---------\r\n\r\nCo-authored-by: Sean Rathier
<sean.rathier@elastic.co>\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"f31661255b366bb2f50a47b9821874bdc0cd1b8e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204580","number":204580,"mergeCommit":{"message":"[Cloud
Security] Improve graph node label ellipsis logic (#204580)\n\n##
Summary\r\n\r\nThis PR improves the logic of node's label truncation. It
follows the\r\nguidelines from design:\r\n\r\n> - Set the maximum width
for names to 160px\r\n> - Truncate names to max two lines\r\n> - I
recommend truncating names in the middle, as entity IDs often\r\ndiffer
only in their last characters while starting similarly. This\r\napproach
will make it easier to identify differences between names\r\n> - Display
the full name in a tooltip on hover for better visibility\r\n
\r\n\r\nBefore:\r\n\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f\"\r\n/>\r\n<img
width=\"150\"\r\nsrc=\"https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8\"\r\n/>\r\n\r\n\r\nAfter:\r\n\r\n\r\nhttps://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969\r\n\r\n\r\n**How
to test**\r\n\r\nTo test this PR you can run\r\n\r\n```\r\nyarn
storybook cloud_security_posture_packages\r\n```\r\n\r\n###
Checklist\r\n\r\n- [ ] [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\r\n\r\n---------\r\n\r\nCo-authored-by: Sean Rathier
<sean.rathier@elastic.co>\r\nCo-authored-by: Brad White
<Ikuni17@users.noreply.github.com>","sha":"f31661255b366bb2f50a47b9821874bdc0cd1b8e"}}]}]
BACKPORT-->

Co-authored-by: Kfir Peled <61654899+kfirpeled@users.noreply.github.com>
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Dec 19, 2024
)

## Summary

This PR improves the logic of node's label truncation. It follows the
guidelines from design:

> - Set the maximum width for names to 160px
> - Truncate names to max two lines
> - I recommend truncating names in the middle, as entity IDs often
differ only in their last characters while starting similarly. This
approach will make it easier to identify differences between names
> - Display the full name in a tooltip on hover for better visibility
 

Before:

<img width="150"
src="https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127"
/>
<img width="150"
src="https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f"
/>
<img width="150"
src="https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8"
/>


After:


https://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969


**How to test**

To test this PR you can run

```
yarn storybook cloud_security_posture_packages
```

### Checklist

- [ ] [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

---------

Co-authored-by: Sean Rathier <sean.rathier@elastic.co>
Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
benakansara pushed a commit to benakansara/kibana that referenced this pull request Jan 2, 2025
)

## Summary

This PR improves the logic of node's label truncation. It follows the
guidelines from design:

> - Set the maximum width for names to 160px
> - Truncate names to max two lines
> - I recommend truncating names in the middle, as entity IDs often
differ only in their last characters while starting similarly. This
approach will make it easier to identify differences between names
> - Display the full name in a tooltip on hover for better visibility
 

Before:

<img width="150"
src="https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127"
/>
<img width="150"
src="https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f"
/>
<img width="150"
src="https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8"
/>


After:


https://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969


**How to test**

To test this PR you can run

```
yarn storybook cloud_security_posture_packages
```

### Checklist

- [ ] [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

---------

Co-authored-by: Sean Rathier <sean.rathier@elastic.co>
Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
)

## Summary

This PR improves the logic of node's label truncation. It follows the
guidelines from design:

> - Set the maximum width for names to 160px
> - Truncate names to max two lines
> - I recommend truncating names in the middle, as entity IDs often
differ only in their last characters while starting similarly. This
approach will make it easier to identify differences between names
> - Display the full name in a tooltip on hover for better visibility
 

Before:

<img width="150"
src="https://github.com/user-attachments/assets/4bc18b98-1e1b-41df-ac69-79b2adf1f127"
/>
<img width="150"
src="https://github.com/user-attachments/assets/69c335f6-3952-44e8-8836-19eab3bff28f"
/>
<img width="150"
src="https://github.com/user-attachments/assets/4ba65932-5af5-4382-b721-41c6ee7388a8"
/>


After:


https://github.com/user-attachments/assets/2ab04809-7599-45ab-9aaa-ae1fcabdf969


**How to test**

To test this PR you can run

```
yarn storybook cloud_security_posture_packages
```

### Checklist

- [ ] [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

---------

Co-authored-by: Sean Rathier <sean.rathier@elastic.co>
Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants