-
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
[APM] ellipsis truncation issue - dependencies and service section #122203
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Pinging @elastic/apm-ui (Team:apm) |
💚 CLA has been signed |
I have signed in the contributor agreement |
Hi @sqren can you please review this PR ? |
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.
Thanks for you contribution @gayathrir1172 . The change looks good to me but the PR is a bit outdated and as a result one of the checks is failing.
You can easily update your PR by adding the following @elasticmachine merge upstream
as a comment
@elasticmachine merge upstream |
Thanks @kpatticha for reviewing the PR. I tried commenting |
@elasticmachine merge upstream |
sorry for the inconvenience, it seems that bot doesn't respond. I'm not sure why 🤔 Can you please try to rebase and update your branch manually? |
Hey @kpatticha |
@gayathrir1172 I fetched this PR (with the changes) locally and tested. |
Taking current pull from kibana main
Hey @kpatticha the PR is not outdated now, I have taken the current pull. |
|
||
const StyledLink = euiStyled(EuiLink)`${truncate('100%')};`; | ||
const StyledLink = euiStyled(EuiLink)`min-width: 0`; |
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.
What's the purpose of min-width
if is set to 0
?
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.
Hey @kpatticha, the min width is required here because it is a flex item. Flex items takes content width by default, so giving min-width is necessary here.
Reference : https://css-tricks.com/flexbox-truncated-text/
const truncateAnchorClassname = '_apm_truncate_anchor_'; | ||
|
||
const TruncationWrapper = euiStyled.div` | ||
width: 50px; |
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.
How do you determine the width?
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.
Here, some fixed width is required for ellipsis truncation to work.
Reference : https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/
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 <BackendLink />
is a shared component, there might be an issue by setting the width:50px
.
Can you please make sure how it affects the components that use <BackendLink />
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.
Hey @kpatticha I have already checked this, I do not find this affects other components. Only service and dependency sections use this, and I have handled the scenarios accordingly.
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.
One quick and easy way to find where the component is used, you can run the following command from APM folder (kibana/x-pack/plugins/apm)
grep -rn "<BackendLink" .
./public/components/app/backend_inventory/backend_inventory_dependencies_table/index.tsx:66: <BackendLink
./public/components/app/service_overview/service_overview_dependencies_table/index.tsx:85: <BackendLink
./public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/sticky_span_properties.tsx:108: <BackendLink
./public/components/shared/backend_link.stories.tsx:30: return <BackendLink {...args} />;
The given width works for the dependency section in the service overview page (services/SERVICE_NAME/overview
) but when I check the dependencies table while I have enough space, it truncates the dependency name
The same applies for the span_flyout
.
Screen.Recording.2022-03-31.at.14.53.18.mov
@@ -45,3 +45,9 @@ export function TruncateWithTooltip(props: Props) { | |||
</TooltipWrapper> | |||
); | |||
} | |||
|
|||
export function TruncateWithoutTooltip(props: Props) { |
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.
can you please help me understanding why we need another component without a tooltip?
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.
@kpatticha We need another component here because earlier truncation was happening at group level. Now, I have modified it in a way that truncation would be applied on item level.
created a new component for truncation without tooltip
@kpatticha I have updated the PR with the file name changes you have mentioned. Kindly check. Thanks ! |
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.
@gayathrir1172 thanks for your work on this issue. I have added a small comment. take a look and let me know what you think.
<EuiFlexItem> | ||
<TruncationWrapper> | ||
<TruncateWithoutTooltip text={serviceName} content={serviceName} /> | ||
</TruncationWrapper> | ||
</EuiFlexItem> |
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.
@gayathrir1172 It looks like the problem described on this issue is fixed by only changing this part of code:
<EuiFlexItem> | |
<TruncationWrapper> | |
<TruncateWithoutTooltip text={serviceName} content={serviceName} /> | |
</TruncationWrapper> | |
</EuiFlexItem> | |
<EuiFlexItem className="eui-textTruncate"> | |
<span className="eui-textTruncate">{serviceName}</span> | |
</EuiFlexItem> |
You only need to apply the same change at public/components/shared/backend_link.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.
Hey @cauemarcondes sure, will try as you have suggested and update the PR. Thanks !
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.
Hey @cauemarcondes I have implemented as you have suggested. Please check. thanks !
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.
LGTM, thanks for your help @gayathrir1172
@kpatticha can you please review and approve this PR ? And if you are also good with the code changes, can you please merge this PR too ? Thanks ! |
@gayathrir1172 thanks for your contribution 👍 . Once the CI passes it will be merged |
@elasticmachine merge upstream |
@elasticmachine run elasticsearch-ci/docs |
Buildkite, test this |
@elasticmachine run elasticsearch-ci/docs |
…lastic#122203) * Added ellipsis truncation to apm dependency * Added ellipsis truncation to apm service * Removed un-used variable * Added ellipsis truncation * removing unused import * modified css classname * created a new component for truncation without tooltip * using text truncate styling and removed truncatewithouttooltip component * restored styledlink
Summary
This PR will resolve ellipsis truncation issue which is mentioned here. The following screenshots clearly show that the ellipsis has been applied on dependency and service name section.
Fixes #112976
Before:
After:
Dependencies section :
![Screenshot 2021-12-28 at 2 28 39 PM](https://user-images.githubusercontent.com/24849645/147905815-2ff3c7df-e517-4af7-887e-bf61c50b88c5.png)
Services section:
![Screenshot 2021-12-28 at 2 28 27 PM](https://user-images.githubusercontent.com/24849645/147905844-f6080582-62f1-4923-b534-285fb87a53dd.png)
For maintainers