mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Display tooltips for long tags, even if there are less than 3 total tags (#132528)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
6383b42e5d
commit
ccb25d048c
1 changed files with 15 additions and 2 deletions
|
@ -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[];
|
||||
|
@ -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>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue