mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 16:14:42 +00:00
* feat: new trace detail page flame graph * feat: new trace detail page layout * test: trace detail is wip * chore: trace details in wip * feat: trace detail page timeline component * chore: spantoTree is updated * chore: gantchart is updated * chore: onClick is added * chore: isSpanPresentInSearchString util is added * chore: trace graph is updated * chore: added the hack to work * feat: is span present util is added * chore: in span ms is added * chore: tooltip is updated * WIP: chore: trace details changes are updated * feat: getTraceItem is added * feat: trace detail page is updated * feat: trace detail styling changes * feat: trace detail page is updated * feat: implement span hover, select, focus and reset * feat: reset focus * feat: spanId as query table and unfurling * feat: trace details is updated * chore: remove lodash * chore: remove lodash * feat: trace details is updated * feat: new trace detail page styling changes * feat: new trace detail page styling changes * feat: improved styling * feat: remove horizontal scrolling * feat: new trace detail page modify caret icon * chore styles are updated * Revert "chore: Trace styles" * chore styles are updated * feat: timeline normalisation * chore: remove mock data * chore: sort tree data util is added and selected span component is updated * chore: trace changes are updated * chore: trace changes are updated * chore: trace changes are updated * feat: refactored time units for new trace detail page * chore: remove mockdata * feat: new trace detail page themeing and interval loop fix * chore: error tag is updated * chore: error tag is updated * chore: error tag is updated * chore: error tag is updated * chore: console is removed * fix: error tag expand button * chore: expanded panel is updated * feat: scroll span from gantt chart intoview * chore: trace detail is removed Co-authored-by: Pranshu Chittora <pranshu@signoz.io>
88 lines
2.2 KiB
TypeScript
88 lines
2.2 KiB
TypeScript
import React, { useEffect, useState } from 'react';
|
|
import Trace from './Trace';
|
|
import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons'
|
|
import { Wrapper, CardWrapper, CardContainer, CollapseButton } from './styles';
|
|
import { getSpanPath } from './utils';
|
|
import { IIntervalUnit } from 'container/TraceDetail/utils'
|
|
import { ITraceTree } from 'types/api/trace/getTraceItem';
|
|
|
|
const GanttChart = (props: GanttChartProps): JSX.Element => {
|
|
const {
|
|
data,
|
|
traceMetaData,
|
|
activeHoverId,
|
|
setActiveHoverId,
|
|
activeSelectedId,
|
|
setActiveSelectedId,
|
|
spanId,
|
|
intervalUnit
|
|
} = props;
|
|
|
|
const { globalStart, spread: globalSpread } = traceMetaData;
|
|
|
|
const [isExpandAll, setIsExpandAll] = useState<boolean>(false);
|
|
const [activeSpanPath, setActiveSpanPath] = useState<string[]>([]);
|
|
|
|
useEffect(() => {
|
|
setActiveSpanPath(getSpanPath(data, spanId))
|
|
}, [spanId]);
|
|
|
|
useEffect(() => {
|
|
setActiveSpanPath(getSpanPath(data, activeSelectedId))
|
|
}, [activeSelectedId]);
|
|
|
|
const handleCollapse = () => {
|
|
setIsExpandAll((prev) => !prev);
|
|
};
|
|
return (
|
|
<>
|
|
<Wrapper>
|
|
<CardContainer>
|
|
<CollapseButton onClick={handleCollapse} style={{ fontSize: '1.2rem' }} title={isExpandAll ? 'Collapse All' : "Expand All"}>
|
|
{isExpandAll ? <MinusSquareOutlined /> : <PlusSquareOutlined />}
|
|
</CollapseButton>
|
|
<CardWrapper>
|
|
<Trace
|
|
activeHoverId={activeHoverId}
|
|
activeSpanPath={activeSpanPath}
|
|
setActiveHoverId={setActiveHoverId}
|
|
key={data.id}
|
|
{...{
|
|
...data,
|
|
globalSpread,
|
|
globalStart,
|
|
setActiveSelectedId,
|
|
activeSelectedId,
|
|
}}
|
|
level={0}
|
|
isExpandAll={isExpandAll}
|
|
intervalUnit={intervalUnit}
|
|
/>
|
|
</CardWrapper>
|
|
</CardContainer>
|
|
</Wrapper>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export interface ITraceMetaData {
|
|
globalEnd: number;
|
|
globalStart: number;
|
|
levels: number;
|
|
spread: number;
|
|
totalSpans: number;
|
|
}
|
|
|
|
export interface GanttChartProps {
|
|
data: ITraceTree;
|
|
traceMetaData: ITraceMetaData;
|
|
activeSelectedId: string;
|
|
activeHoverId: string;
|
|
setActiveHoverId: React.Dispatch<React.SetStateAction<string>>;
|
|
setActiveSelectedId: React.Dispatch<React.SetStateAction<string>>;
|
|
spanId: string;
|
|
intervalUnit: IIntervalUnit
|
|
}
|
|
|
|
export default GanttChart;
|