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

53 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-01-18 02:18:49 +05:30
import React from "react";
import { Card, Tabs } from "antd";
2021-01-03 18:15:44 +05:30
const { TabPane } = Tabs;
interface spanTagItem {
2021-01-18 02:18:49 +05:30
key: string;
type: string;
value: string;
}
2021-01-03 18:15:44 +05:30
interface SelectedSpanDetailsProps {
2021-01-18 02:18:49 +05:30
clickedSpanTags: spanTagItem[];
2021-01-03 18:15:44 +05:30
}
const SelectedSpanDetails = (props: SelectedSpanDetailsProps) => {
2021-01-18 02:18:49 +05:30
const callback = (key: any) => {};
return (
<Card style={{ height: 320 }}>
<Tabs defaultActiveKey="1" onChange={callback}>
<TabPane tab="Tags" key="1">
<strong> Details for selected Span </strong>
{props.clickedSpanTags.map((tags, index) => (
<li
key={index}
style={{ color: "grey", fontSize: "13px", listStyle: "none" }}
>
<span className="mr-1">{tags.key}</span>:
<span className="ml-1">
{tags.key === "error" ? "true" : tags.value}
</span>
</li>
))}{" "}
</TabPane>
<TabPane tab="Errors" key="2">
{props.clickedSpanTags
.filter((tags) => tags.key === "error")
.map((error) => (
<div className="ml-5">
<p style={{ color: "grey", fontSize: "10px" }}>
<span className="mr-1">{error.key}</span>:
<span className="ml-1">true</span>
</p>
</div>
))}
</TabPane>
</Tabs>
</Card>
);
};
export default SelectedSpanDetails;