Skip to content

Commit ef53762

Browse files
committed
Update Trace header styles
1 parent cfe765d commit ef53762

File tree

5 files changed

+67
-36
lines changed

5 files changed

+67
-36
lines changed

packages/jaeger-ui/src/components/TracePage/TracePageHeader/AltViewOptions.tsx

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -71,41 +71,39 @@ export default function AltViewOptions(props: Props) {
7171
onTraceViewChange(item);
7272
};
7373

74-
const menu = () => {
75-
const baseUrl = window.baseUrl ?? window.apiBaseUrl;
74+
const baseUrl = window.baseUrl ?? window.apiBaseUrl;
7675

77-
return (
78-
<Menu>
79-
{MENU_ITEMS.filter(item => item.viewType !== viewType).map(item => (
80-
<Menu.Item key={item.viewType}>
81-
<a onClick={() => handleSelectView(item.viewType)} role="button">
82-
{item.label}
83-
</a>
84-
</Menu.Item>
85-
))}
86-
<Menu.Item>
87-
<a
88-
href={`${baseUrl}/api/traces/${traceID}?prettyPrint=true`}
89-
rel="noopener noreferrer"
90-
target="_blank"
91-
onClick={trackJsonView}
92-
>
93-
Trace JSON
76+
const menu = (
77+
<Menu>
78+
{MENU_ITEMS.filter(item => item.viewType !== viewType).map(item => (
79+
<Menu.Item key={item.viewType}>
80+
<a onClick={() => handleSelectView(item.viewType)} role="button">
81+
{item.label}
9482
</a>
9583
</Menu.Item>
96-
<Menu.Item>
97-
<a
98-
href={`${baseUrl}/api/traces/${traceID}?raw=true&prettyPrint=true`}
99-
rel="noopener noreferrer"
100-
target="_blank"
101-
onClick={trackRawJsonView}
102-
>
103-
Trace JSON (unadjusted)
104-
</a>
105-
</Menu.Item>
106-
</Menu>
107-
);
108-
};
84+
))}
85+
<Menu.Item>
86+
<a
87+
href={`${baseUrl}/api/traces/${traceID}?prettyPrint=true`}
88+
rel="noopener noreferrer"
89+
target="_blank"
90+
onClick={trackJsonView}
91+
>
92+
Trace JSON
93+
</a>
94+
</Menu.Item>
95+
<Menu.Item>
96+
<a
97+
href={`${baseUrl}/api/traces/${traceID}?raw=true&prettyPrint=true`}
98+
rel="noopener noreferrer"
99+
target="_blank"
100+
onClick={trackRawJsonView}
101+
>
102+
Trace JSON (unadjusted)
103+
</a>
104+
</Menu.Item>
105+
</Menu>
106+
);
109107

110108
const currentItem = MENU_ITEMS.find(item => item.viewType === viewType);
111109
const dropdownText = currentItem ? currentItem.label : 'Alternate Views';

packages/jaeger-ui/src/components/TracePage/TracePageHeader/TracePageHeader.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ limitations under the License.
5858
color: var(--tx-color-title);
5959
display: flex;
6060
flex: 1;
61+
min-width: 120px;
62+
overflow: hidden;
6163
}
6264

6365
.TracePageHeader--titleLink:hover * {
@@ -85,6 +87,9 @@ limitations under the License.
8587
line-height: 1em;
8688
margin: 0 0 0 0.5em;
8789
padding: 0.5em 0;
90+
white-space: nowrap;
91+
overflow: hidden;
92+
text-overflow: ellipsis;
8893
}
8994

9095
.TracePageHeader--title.is-collapsible {
@@ -110,5 +115,6 @@ limitations under the License.
110115
}
111116

112117
.TracePageHeader--zoomControls {
118+
flex-shrink: 0;
113119
margin-left: 0.5em;
114120
}

packages/jaeger-ui/src/components/TracePage/TracePageHeader/TracePageHeader.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@ export function TracePageHeaderFn(props: TracePageHeaderEmbedProps & { forwarded
151151
return { ...rest, value: renderer(trace) };
152152
});
153153

154+
const traceName = getTraceName(trace.spans);
155+
154156
const title = (
155157
<h1 className={`TracePageHeader--title ${canCollapse ? 'is-collapsible' : ''}`}>
156-
<TraceName traceName={getTraceName(trace.spans)} />{' '}
158+
<TraceName traceName={traceName} breakable={false} />{' '}
157159
<small className="u-tx-muted">{trace.traceID.slice(0, 7)}</small>
158160
</h1>
159161
);

packages/jaeger-ui/src/components/common/TraceName.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ limitations under the License.
1717
.TraceName.is-error {
1818
color: #c00;
1919
}
20+
21+
.TraceName .TraceName--name {
22+
display: block;
23+
padding-bottom: 0.2em;
24+
text-overflow: ellipsis;
25+
overflow: hidden;
26+
}

packages/jaeger-ui/src/components/common/TraceName.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import * as React from 'react';
16+
import { Tooltip } from 'antd';
1617

1718
import BreakableText from './BreakableText';
1819
import LoadingIndicator from './LoadingIndicator';
@@ -23,15 +24,32 @@ import { ApiError } from '../../types/api-error';
2324

2425
import './TraceName.css';
2526

27+
type TitleProps = {
28+
text: string;
29+
breakable: boolean;
30+
};
31+
2632
type Props = {
2733
className?: string;
2834
error?: ApiError | TNil;
2935
state?: FetchedState | TNil;
3036
traceName?: string | TNil;
37+
breakable?: boolean;
38+
};
39+
40+
const Title = (props: TitleProps) => {
41+
const { text, breakable } = props;
42+
return breakable ? (
43+
<BreakableText text={text} />
44+
) : (
45+
<Tooltip title={text} placement="bottom">
46+
<span className="TraceName--name">{text}</span>
47+
</Tooltip>
48+
);
3149
};
3250

3351
export default function TraceName(props: Props) {
34-
const { className, error, state, traceName } = props;
52+
const { className, error, state, traceName, breakable = true } = props;
3553
const isErred = state === fetchedState.ERROR;
3654
let title: string | React.ReactNode = traceName || FALLBACK_TRACE_NAME;
3755
let errorCssClass = '';
@@ -45,12 +63,12 @@ export default function TraceName(props: Props) {
4563
titleStr = 'Error: Unknown error';
4664
}
4765
title = titleStr;
48-
title = <BreakableText text={titleStr} />;
66+
title = <Title text={titleStr} breakable={breakable} />;
4967
} else if (state === fetchedState.LOADING) {
5068
title = <LoadingIndicator small />;
5169
} else {
5270
const text: string = String(traceName || FALLBACK_TRACE_NAME);
53-
title = <BreakableText text={text} />;
71+
title = <Title text={text} breakable={breakable} />;
5472
}
5573
return <span className={`TraceName ${errorCssClass} ${className || ''}`}>{title}</span>;
5674
}

0 commit comments

Comments
 (0)