signoz/frontend/src/modules/Traces/SelectedSpanDetails.tsx

100 lines
2.4 KiB
TypeScript
Raw Normal View History

2021-01-18 02:18:49 +05:30
import React from "react";
import { Card, Space, Tabs, Typography } from "antd";
import styled from "styled-components";
import { pushDStree } from "../../store/actions";
2021-01-03 18:15:44 +05:30
const { TabPane } = Tabs;
const { Text } = Typography;
2021-01-03 18:15:44 +05:30
interface SelectedSpanDetailsProps {
data: pushDStree
2021-01-03 18:15:44 +05:30
}
const Title = styled(Text)`
color: "#2D9CDB",
fontSize: '12px',
`;
2021-01-03 18:15:44 +05:30
const SelectedSpanDetails = (props: SelectedSpanDetailsProps) => {
let spanTags = props.data.tags;
let service = props.data?.name?.split(":")[0];
let operation = props.data?.name?.split(":")[1];
2021-01-18 02:18:49 +05:30
return (
<Card style={{ border: "none", background: "transparent", padding: 0 }} bodyStyle={{ padding: 0 }}>
<Space direction="vertical">
<strong> Details for selected Span </strong>
<Space direction="vertical" size={2}>
<Text style={{ marginTop: "18px" }}>
Service
</Text>
<Title style={{ color: "#2D9CDB", fontSize: "12px" }}>
{service}
</Title>
</Space>
<Space direction="vertical" size={2}>
<Text>
Operation
</Text>
<Text style={{ color: "#2D9CDB", fontSize: "12px" }}>
{operation}
</Text>
</Space>
</Space>
<Tabs defaultActiveKey="1">
2021-01-18 02:18:49 +05:30
<TabPane tab="Tags" key="1">
{spanTags && spanTags.map((tags, index) => {
return (
<>
{tags.value && (
<>
<Text style={{ color: "#BDBDBD", fontSize: "12px", marginBottom: "8px" }}>
{tags.key}
</Text>
<div style={{
background: "#4F4F4F",
color: "#2D9CDB",
fontSize: "12px",
padding: "6px 8px",
wordBreak: "break-all",
marginBottom: "16px",
}}>
{tags.key === "error" ? "true" : tags.value}
</div>
</>
)}
</>
);
})}
2021-01-18 02:18:49 +05:30
</TabPane>
<TabPane tab="Errors" key="2">
{spanTags && spanTags
2021-01-18 02:18:49 +05:30
.filter((tags) => tags.key === "error")
.map((error) => (
<>
<Text style={{ color: "#BDBDBD", fontSize: "12px", marginBottom: "8px" }}>
{error.key}
</Text>
<div style={{
background: "#4F4F4F",
color: "#2D9CDB",
fontSize: "12px",
padding: "6px 8px",
wordBreak: "break-all",
marginBottom: "16px",
}}>
true
</div>
</>
2021-01-18 02:18:49 +05:30
))}
</TabPane>
</Tabs>
</Card>
);
};
export default SelectedSpanDetails;