Skip to content

Commit

Permalink
Display tooltips for long tags, even if there are less than 3 total t…
Browse files Browse the repository at this point in the history
…ags (#132528)

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
kpollich and kibanamachine authored May 19, 2022
1 parent 6383b42 commit ccb25d0
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EuiToolTip } from '@elastic/eui';
import { take } from 'lodash';
import React from 'react';

import { truncateTag } from '../utils';
import { truncateTag, MAX_TAG_DISPLAY_LENGTH } from '../utils';

interface Props {
tags: string[];
Expand All @@ -30,7 +30,20 @@ export const Tags: React.FunctionComponent<Props> = ({ tags }) => {
</EuiToolTip>
</>
) : (
<span data-test-subj="agentTags">{tags.map(truncateTag).join(', ')}</span>
<span data-test-subj="agentTags">
{tags.map((tag, index) => (
<>
{index > 0 && ', '}
{tag.length > MAX_TAG_DISPLAY_LENGTH ? (
<EuiToolTip content={<span>{tag}</span>} key={tag}>
<span>{truncateTag(tag)}</span>
</EuiToolTip>
) : (
<span key={tag}>{tag}</span>
)}
</>
))}
</span>
)}
</>
);
Expand Down

0 comments on commit ccb25d0

Please sign in to comment.