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

feat: truncate very long lines in traces explorer list view #6987

Merged
merged 6 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion frontend/src/container/TracesExplorer/ListView/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getMs } from 'container/Trace/Filters/Panel/PanelBody/Duration/util';
import { formUrlParams } from 'container/TraceDetail/utils';
import { TimestampInput } from 'hooks/useTimezoneFormatter/useTimezoneFormatter';
import { RowData } from 'lib/query/createTableColumnsFromQuery';
import LineClampedText from 'periscope/components/LineClampedText/LineClampedText';
import { Link } from 'react-router-dom';
import { ILog } from 'types/api/logs/log';
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
Expand Down Expand Up @@ -113,7 +114,9 @@ export const getListColumns = (

return (
<BlockLink to={getTraceLink(item)} openInNewTab={false}>
<Typography data-testid={key}>{value}</Typography>
<Typography data-testid={key}>
<LineClampedText text={value} lines={3} />
</Typography>
</BlockLink>
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.line-clamped-text {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
.line-clamped-wrapper {
max-height: 300px;
overflow-y: auto;
&__text {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function LineClampedText({
const content = (
<div
ref={textRef}
className="line-clamped-text"
className="line-clamped-wrapper__text"
style={{
WebkitLineClamp: lines,
}}
Expand All @@ -46,7 +46,9 @@ function LineClampedText({

return isOverflowing ? (
<Tooltip
title={text}
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
title={<div onClick={(e): void => e.stopPropagation()}>{text}</div>}
overlayClassName="line-clamped-wrapper"
// eslint-disable-next-line react/jsx-props-no-spreading
{...tooltipProps}
>
Expand Down
Loading