diff --git a/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_table.test.tsx.snap b/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_table.test.tsx.snap
index b48c8a26b..7faec5d3a 100644
--- a/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_table.test.tsx.snap
+++ b/public/components/trace_analytics/components/traces/__tests__/__snapshots__/span_detail_table.test.tsx.snap
@@ -13,7 +13,7 @@ exports[`SpanDetailTable renders the component with data 1`] = `
>
@@ -392,7 +394,7 @@ exports[`SpanDetailTable renders the jaeger component with data 1`] = `
>
@@ -858,7 +862,7 @@ exports[`SpanDetailTableHierarchy renders the jaeger component with data 1`] = `
>
(null);
const [availableWidth, setAvailableWidth] = useState(window.innerWidth);
+ const newNavigation = coreRefs?.chrome?.navGroup.getNavGroupEnabled?.();
- useEffect(() => {
- const updateAvailableWidth = () => {
- if (containerRef.current) {
- setAvailableWidth(containerRef.current.getBoundingClientRect().width);
- } else {
- setAvailableWidth(window.innerWidth);
- }
- };
+ const updateAvailableWidth = () => {
+ if (containerRef.current) {
+ setAvailableWidth(containerRef.current.getBoundingClientRect().width);
+ } else {
+ setAvailableWidth(window.innerWidth);
+ }
+ };
- const handleFullScreenChange = () => {
- const isFullscreenActive = !!document.fullscreenElement;
- setIsFullScreen(isFullscreenActive);
- updateAvailableWidth();
- };
+ const handleFullScreenChange = () => {
+ const isFullscreenActive = !!document.fullscreenElement;
+ setIsFullScreen(isFullscreenActive);
+ updateAvailableWidth();
+ };
+ useEffect(() => {
// Add event listeners for window resize and full-screen toggling
window.addEventListener('resize', updateAvailableWidth);
document.addEventListener('fullscreenchange', handleFullScreenChange);
@@ -99,8 +98,9 @@ export function SpanDetailPanel(props: {
}, []);
const dynamicLayoutAdjustment = useMemo(() => {
- const adjustment = newNavigation ? 350 : 400;
- return isLocked ? availableWidth - adjustment : availableWidth - 150;
+ const adjustment = newNavigation ? 350 : 400; // allows resizing of the window
+ const leftNavAdjustment = newNavigation ? 125 : 75;
+ return isLocked ? availableWidth - adjustment : availableWidth - leftNavAdjustment;
}, [isLocked, availableWidth]);
// Update selectedRange whenever data.ganttMaxX changes to ensure it starts fully zoomed out
@@ -348,6 +348,19 @@ export function SpanDetailPanel(props: {
dragLayer.style.cursor = '';
}, []);
+ const onRelayoutHandler = useCallback(
+ (event) => {
+ // Handle x-axis range update
+ if (event && event['xaxis.range[0]'] && event['xaxis.range[1]']) {
+ const newRange = [event['xaxis.range[0]'], event['xaxis.range[1]']];
+ setSelectedRange(newRange);
+ } else {
+ setSelectedRange(fullRange);
+ }
+ },
+ [setSelectedRange, fullRange]
+ );
+
const toggleOptions = [
{
id: 'timeline',
@@ -380,6 +393,7 @@ export function SpanDetailPanel(props: {
}
}}
dataSourceMDSId={props.dataSourceMDSId}
+ availableWidth={dynamicLayoutAdjustment}
/>
),
@@ -402,6 +416,7 @@ export function SpanDetailPanel(props: {
}
}}
dataSourceMDSId={props.dataSourceMDSId}
+ availableWidth={dynamicLayoutAdjustment}
/>
),
@@ -425,15 +440,7 @@ export function SpanDetailPanel(props: {
onClickHandler={onClick}
onHoverHandler={onHover}
onUnhoverHandler={onUnhover}
- onRelayout={(event) => {
- // Handle x-axis range update
- if (event && event['xaxis.range[0]'] && event['xaxis.range[1]']) {
- const newRange = [event['xaxis.range[0]'], event['xaxis.range[1]']];
- setSelectedRange(newRange);
- } else {
- setSelectedRange(fullRange);
- }
- }}
+ onRelayout={onRelayoutHandler}
/>
),
[data.gantt, layout, onClick, onHover, onUnhover, setSelectedRange]
diff --git a/public/components/trace_analytics/components/traces/span_detail_table.tsx b/public/components/trace_analytics/components/traces/span_detail_table.tsx
index e3971f6ef..1651f2f2c 100644
--- a/public/components/trace_analytics/components/traces/span_detail_table.tsx
+++ b/public/components/trace_analytics/components/traces/span_detail_table.tsx
@@ -34,6 +34,7 @@ interface SpanDetailTableProps {
DSL?: any;
setTotal?: (total: number) => void;
dataSourceMDSId: string;
+ availableWidth?: number;
}
export interface SpanSearchParams {
@@ -300,6 +301,11 @@ export function SpanDetailTable(props: SpanDetailTableProps) {
onChangePage,
}}
style={{
+ width: fullScreenMode
+ ? '100%'
+ : props.availableWidth
+ ? `${props.availableWidth}px`
+ : '100%', // allow page to be resized
height: fullScreenMode ? '100%' : 'auto',
}}
/>
@@ -491,7 +497,15 @@ export function SpanDetailTableHierarchy(props: SpanDetailTableProps) {
showFullScreenSelector: false,
additionalControls: toolbarButtons,
}}
- style={{ height: fullScreenMode ? '100%' : '500px', overflowY: 'auto' }}
+ style={{
+ width: fullScreenMode
+ ? '100%'
+ : props.availableWidth
+ ? `${props.availableWidth}px`
+ : '100%', // allow page to be resized
+ height: fullScreenMode ? '100%' : '500px',
+ overflowY: 'auto',
+ }}
/>
{!fullScreenMode && total === 0 && }