Skip to content

Commit

Permalink
[APM] Long service names are not being truncated (#80804) (#80962)
Browse files Browse the repository at this point in the history
* truncate service names

* using styled-components

* reverting code

* fixing unit test
  • Loading branch information
cauemarcondes authored Oct 19, 2020
1 parent 8da06a4 commit c7e46ec
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ const AppLink = styled(TransactionOverviewLink)`
${truncate('100%')};
`;

const ToolTipWrapper = styled.span`
width: 100%;
.apmServiceList__serviceNameTooltip {
width: 100%;
.apmServiceList__serviceNameContainer {
// removes 24px referent to the icon placed on the left side of the text.
width: calc(100% - 24px);
}
}
`;

export const SERVICE_COLUMNS: Array<ITableColumn<ServiceListItem>> = [
{
field: 'healthStatus',
Expand All @@ -77,24 +88,27 @@ export const SERVICE_COLUMNS: Array<ITableColumn<ServiceListItem>> = [
width: '40%',
sortable: true,
render: (_, { serviceName, agentName }) => (
<EuiToolTip
delay="long"
content={formatString(serviceName)}
id="service-name-tooltip"
>
<EuiFlexGroup gutterSize="s" alignItems="center">
{agentName && (
<EuiFlexItem grow={false}>
<AgentIcon agentName={agentName} />
<ToolTipWrapper>
<EuiToolTip
delay="long"
content={formatString(serviceName)}
id="service-name-tooltip"
anchorClassName="apmServiceList__serviceNameTooltip"
>
<EuiFlexGroup gutterSize="s" alignItems="center">
{agentName && (
<EuiFlexItem grow={false}>
<AgentIcon agentName={agentName} />
</EuiFlexItem>
)}
<EuiFlexItem className="apmServiceList__serviceNameContainer">
<AppLink serviceName={serviceName} className="eui-textTruncate">
{formatString(serviceName)}
</AppLink>
</EuiFlexItem>
)}
<EuiFlexItem>
<AppLink serviceName={serviceName}>
{formatString(serviceName)}
</AppLink>
</EuiFlexItem>
</EuiFlexGroup>
</EuiToolTip>
</EuiFlexGroup>
</EuiToolTip>
</ToolTipWrapper>
),
},
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7e46ec

Please sign in to comment.