mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-15 00:36:08 +08:00
fix: pr comments - used useSafeNavigate hook
This commit is contained in:
parent
9a580915e6
commit
afb18b8142
@ -32,9 +32,6 @@
|
|||||||
border: 1px solid var(--bg-vanilla-400);
|
border: 1px solid var(--bg-vanilla-400);
|
||||||
background: var(--bg-vanilla-400);
|
background: var(--bg-vanilla-400);
|
||||||
|
|
||||||
.ant-btn-default {
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy-span-btn {
|
.copy-span-btn {
|
||||||
border-color: var(--bg-vanilla-400) !important;
|
border-color: var(--bg-vanilla-400) !important;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import { themeColors } from 'constants/theme';
|
|||||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||||
import SpanLineActionButtons from 'container/TraceWaterfall/SpanLineActionButtons';
|
import SpanLineActionButtons from 'container/TraceWaterfall/SpanLineActionButtons';
|
||||||
import { IInterestedSpan } from 'container/TraceWaterfall/TraceWaterfall';
|
import { IInterestedSpan } from 'container/TraceWaterfall/TraceWaterfall';
|
||||||
|
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||||
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||||
import {
|
import {
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
@ -28,7 +30,6 @@ import {
|
|||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { useHistory, useLocation } from 'react-router-dom';
|
|
||||||
import { Span } from 'types/api/trace/getTraceV2';
|
import { Span } from 'types/api/trace/getTraceV2';
|
||||||
import { toFixed } from 'utils/toFixed';
|
import { toFixed } from 'utils/toFixed';
|
||||||
|
|
||||||
@ -169,9 +170,8 @@ function SpanDuration({
|
|||||||
const leftOffset = ((span.timestamp - traceMetadata.startTime) * 1e2) / spread;
|
const leftOffset = ((span.timestamp - traceMetadata.startTime) * 1e2) / spread;
|
||||||
const width = (span.durationNano * 1e2) / (spread * 1e6);
|
const width = (span.durationNano * 1e2) / (spread * 1e6);
|
||||||
|
|
||||||
const { search } = useLocation();
|
const urlQuery = useUrlQuery();
|
||||||
const history = useHistory();
|
const { safeNavigate } = useSafeNavigate();
|
||||||
const searchParams = new URLSearchParams(search);
|
|
||||||
|
|
||||||
let color = generateColor(span.serviceName, themeColors.traceDetailColors);
|
let color = generateColor(span.serviceName, themeColors.traceDetailColors);
|
||||||
|
|
||||||
@ -199,8 +199,11 @@ function SpanDuration({
|
|||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
onClick={(): void => {
|
onClick={(): void => {
|
||||||
setSelectedSpan(span);
|
setSelectedSpan(span);
|
||||||
searchParams.set('spanId', span.spanId);
|
if (span?.spanId) {
|
||||||
history.replace({ search: searchParams.toString() });
|
urlQuery.set('spanId', span?.spanId);
|
||||||
|
}
|
||||||
|
|
||||||
|
safeNavigate({ search: urlQuery.toString() });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user