forked from SigNoz/signoz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show trace details on hover (SigNoz#4241)
* feat: show trace details on hover * feat: handle sider anchor styles in dark and light mode
- Loading branch information
Showing
11 changed files
with
197 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.span-container { | ||
.spanDetails { | ||
position: absolute; | ||
height: 50px; | ||
padding: 8px; | ||
min-width: 150px; | ||
background: lightcyan; | ||
color: black; | ||
bottom: 24px; | ||
left: 0; | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import '../GantChart.styles.scss'; | ||
|
||
import { Popover, Typography } from 'antd'; | ||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils'; | ||
import dayjs from 'dayjs'; | ||
import { useIsDarkMode } from 'hooks/useDarkMode'; | ||
import { useEffect } from 'react'; | ||
import { toFixed } from 'utils/toFixed'; | ||
|
||
import { SpanBorder, SpanLine, SpanText, SpanWrapper } from './styles'; | ||
|
||
interface SpanLengthProps { | ||
globalStart: number; | ||
startTime: number; | ||
name: string; | ||
width: string; | ||
leftOffset: string; | ||
bgColor: string; | ||
inMsCount: number; | ||
} | ||
|
||
function Span(props: SpanLengthProps): JSX.Element { | ||
const { | ||
width, | ||
leftOffset, | ||
bgColor, | ||
inMsCount, | ||
startTime, | ||
name, | ||
globalStart, | ||
} = props; | ||
const isDarkMode = useIsDarkMode(); | ||
const { time, timeUnitName } = convertTimeToRelevantUnit(inMsCount); | ||
|
||
useEffect(() => { | ||
document.documentElement.scrollTop = document.documentElement.clientHeight; | ||
document.documentElement.scrollLeft = document.documentElement.clientWidth; | ||
}, []); | ||
|
||
const getContent = (): JSX.Element => { | ||
const timeStamp = dayjs(startTime).format('h:mm:ss:SSS A'); | ||
const startTimeInMs = startTime - globalStart; | ||
return ( | ||
<div> | ||
<Typography.Text style={{ marginBottom: '8px' }}> | ||
{' '} | ||
Duration : {inMsCount} | ||
</Typography.Text> | ||
<br /> | ||
<Typography.Text style={{ marginBottom: '8px' }}> | ||
Start Time: {startTimeInMs}ms [{timeStamp}]{' '} | ||
</Typography.Text> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<SpanWrapper className="span-container"> | ||
<SpanLine | ||
className="spanLine" | ||
isDarkMode={isDarkMode} | ||
bgColor={bgColor} | ||
leftOffset={leftOffset} | ||
width={width} | ||
/> | ||
|
||
<div> | ||
<Popover | ||
style={{ | ||
left: `${leftOffset}%`, | ||
}} | ||
title={name} | ||
content={getContent()} | ||
trigger="hover" | ||
placement="left" | ||
autoAdjustOverflow | ||
> | ||
<SpanBorder | ||
className="spanTrack" | ||
isDarkMode={isDarkMode} | ||
bgColor={bgColor} | ||
leftOffset={leftOffset} | ||
width={width} | ||
/> | ||
</Popover> | ||
</div> | ||
|
||
<SpanText isDarkMode={isDarkMode} leftOffset={leftOffset}>{`${toFixed( | ||
time, | ||
2, | ||
)} ${timeUnitName}`}</SpanText> | ||
</SpanWrapper> | ||
); | ||
} | ||
|
||
export default Span; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/src/container/TraceDetail/TraceDetails.styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.span-details-sider { | ||
&.dark { | ||
.ant-layout-sider-trigger { | ||
background-color: black !important; | ||
} | ||
} | ||
|
||
&.light { | ||
.ant-layout-sider-trigger { | ||
background-color: white !important; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.