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

[Fleet] wrapping long tags on agent details page #136656

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
import { EuiToolTip } from '@elastic/eui';
import { take } from 'lodash';
import React from 'react';
import styled from 'styled-components';

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

const Wrapped = styled.div`
.wrappedText {
white-space: pre-wrap;
}
`;

interface Props {
tags: string[];
}
Expand All @@ -22,13 +29,16 @@ export const Tags: React.FunctionComponent<Props> = ({ tags }) => {
return (
<>
{tags.length > MAX_TAGS_TO_DISPLAY ? (
<>
<EuiToolTip content={<span data-test-subj="agentTagsTooltip">{tags.join(', ')}</span>}>
<Wrapped>
<EuiToolTip
anchorClassName={'wrappedText'}
content={<span data-test-subj="agentTagsTooltip">{tags.join(', ')}</span>}
>
<span data-test-subj="agentTags">
{take(tags, 3).map(truncateTag).join(', ')} + {tags.length - MAX_TAGS_TO_DISPLAY} more
</span>
</EuiToolTip>
</>
</Wrapped>
) : (
<span data-test-subj="agentTags">
{tags.map((tag, index) => (
Expand Down