-
Notifications
You must be signed in to change notification settings - Fork 67
/
SpanHeader.tsx
41 lines (36 loc) 路 1.34 KB
/
SpanHeader.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {SettingOutlined, ToolOutlined} from '@ant-design/icons';
import {Typography} from 'antd';
import * as SSpanNode from 'components/Visualization/components/DAG/BaseSpanNode/BaseSpanNode.styled';
import {SemanticGroupNamesToText} from 'constants/SemanticGroupNames.constants';
import SpanService from 'services/Span.service';
import Span from 'models/Span.model';
import * as S from './TestSpecDetail.styled';
interface IProps {
onSelectSpan(spanId: string): void;
span?: Span;
}
const SpanHeader = ({onSelectSpan, span}: IProps) => {
const {kind, name, service, system, type} = SpanService.getSpanInfo(span);
return (
<S.Wrapper>
<S.SpanHeaderContainer onClick={() => onSelectSpan(span?.id ?? '')}>
<SSpanNode.BadgeType count={SemanticGroupNamesToText[type]} $type={type} />
<S.HeaderTitle level={3}>{name}</S.HeaderTitle>
<S.HeaderItem>
<SettingOutlined />
<S.HeaderItemText>{`${service} ${kind}`}</S.HeaderItemText>
</S.HeaderItem>
{Boolean(system) && (
<S.HeaderItem>
<ToolOutlined />
<S.HeaderItemText>{system}</S.HeaderItemText>
</S.HeaderItem>
)}
</S.SpanHeaderContainer>
<Typography.Text type="secondary">
<i>{span?.id}</i>
</Typography.Text>
</S.Wrapper>
);
};
export default SpanHeader;