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

[APM] ellipsis truncation issue - dependencies and service section #122203

Merged
merged 26 commits into from
May 4, 2022

Conversation

gayathrir1172
Copy link
Contributor

@gayathrir1172 gayathrir1172 commented Jan 3, 2022

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:

Screenshot 2022-01-05 at 10 15 38 AM

After:

Dependencies section :
Screenshot 2021-12-28 at 2 28 39 PM

Services section:
Screenshot 2021-12-28 at 2 28 27 PM

For maintainers

@gayathrir1172 gayathrir1172 requested a review from a team as a code owner January 3, 2022 07:00
@kibanamachine
Copy link
Contributor

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?

@botelastic botelastic bot added the Team:APM - DEPRECATED Use Team:obs-ux-infra_services. label Jan 3, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

@cla-checker-service
Copy link

cla-checker-service bot commented Jan 3, 2022

💚 CLA has been signed

@gayathrir1172
Copy link
Contributor Author

I have signed in the contributor agreement

@gayathrir1172 gayathrir1172 changed the title APM ellipsis truncation issue - dependencies and service section [APM] ellipsis truncation issue - dependencies and service section Jan 5, 2022
@gayathrir1172
Copy link
Contributor Author

Hi @sqren can you please review this PR ?

Copy link
Contributor

@kpatticha kpatticha left a 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

@gayathrir1172
Copy link
Contributor Author

@elasticmachine merge upstream

@gayathrir1172
Copy link
Contributor Author

gayathrir1172 commented Jan 5, 2022

Thanks @kpatticha for reviewing the PR. I tried commenting @elasticmachine merge upstream, but still the PR seems to be outdated. Can you please help here ?

@kpatticha
Copy link
Contributor

@elasticmachine merge upstream

@kpatticha
Copy link
Contributor

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?

@kpatticha
Copy link
Contributor

kpatticha commented Jan 5, 2022

Also, in my screen (16-inch) found that dependency name and the service name overflows
image

image

The text-overflow property doesn't force an overflow to occur. To make text overflow its container you have to set the overflow css property

@gayathrir1172
Copy link
Contributor Author

Hey @kpatticha
a quick question, are you using miqdigital:112976 branch to check this ?

@kpatticha
Copy link
Contributor

@gayathrir1172 I fetched this PR (with the changes) locally and tested.

Taking current pull from kibana main
@gayathrir1172
Copy link
Contributor Author

Hey @kpatticha the PR is not outdated now, I have taken the current pull.
Will look into the truncation issue which you have reported and get back to you.

@gayathrir1172 gayathrir1172 marked this pull request as draft January 7, 2022 08:03

const StyledLink = euiStyled(EuiLink)`${truncate('100%')};`;
const StyledLink = euiStyled(EuiLink)`min-width: 0`;
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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/

Copy link
Contributor

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 />

Copy link
Contributor Author

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.

Copy link
Contributor

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
Screenshot 2022-03-31 at 14 47 46

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@gayathrir1172
Copy link
Contributor Author

@kpatticha I have updated the PR with the file name changes you have mentioned. Kindly check. Thanks !

Copy link
Contributor

@cauemarcondes cauemarcondes left a 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.

Comment on lines 56 to 60
<EuiFlexItem>
<TruncationWrapper>
<TruncateWithoutTooltip text={serviceName} content={serviceName} />
</TruncationWrapper>
</EuiFlexItem>
Copy link
Contributor

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:

Suggested change
<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

Copy link
Contributor Author

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 !

Copy link
Contributor Author

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 !

Copy link
Contributor

@cauemarcondes cauemarcondes left a 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

@gayathrir1172
Copy link
Contributor Author

@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 !

@kpatticha kpatticha enabled auto-merge (squash) May 3, 2022 14:15
@kpatticha
Copy link
Contributor

@gayathrir1172 thanks for your contribution 👍 . Once the CI passes it will be merged

@cauemarcondes
Copy link
Contributor

@elasticmachine merge upstream

@gbamparop
Copy link
Contributor

@elasticmachine run elasticsearch-ci/docs

@gbamparop
Copy link
Contributor

Buildkite, test this

@cauemarcondes
Copy link
Contributor

@elasticmachine run elasticsearch-ci/docs

@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
apm 2.8MB 2.8MB +166.0B

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

@kpatticha kpatticha merged commit 4f88950 into elastic:main May 4, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 4, 2022
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
…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
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 💝community release_note:fix Team:APM - DEPRECATED Use Team:obs-ux-infra_services. v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Long dependency names are cut off without using ellipsis (...)
7 participants