2021-01-18 02:18:49 +05:30
|
|
|
import React from "react";
|
2021-06-24 22:28:32 +05:30
|
|
|
import { Card, Space, Tabs, Typography } from "antd";
|
|
|
|
|
import styled from "styled-components";
|
2021-08-19 22:53:33 +05:30
|
|
|
import { pushDStree } from "store/actions";
|
2021-06-24 22:28:32 +05:30
|
|
|
|
2021-01-03 18:15:44 +05:30
|
|
|
const { TabPane } = Tabs;
|
|
|
|
|
|
2021-06-28 21:32:41 +05:30
|
|
|
const { Text, Title, Paragraph } = Typography;
|
2021-01-03 18:15:44 +05:30
|
|
|
|
|
|
|
|
interface SelectedSpanDetailsProps {
|
2021-06-27 08:47:46 +05:30
|
|
|
data: pushDStree;
|
2021-01-03 18:15:44 +05:30
|
|
|
}
|
|
|
|
|
|
2021-06-28 21:32:41 +05:30
|
|
|
// Check this discussion for antd with styled components
|
|
|
|
|
// https://gist.github.com/newswim/fa916c66477ddd5952f7d6548e6a0605
|
|
|
|
|
|
|
|
|
|
const CustomTitle = styled(Title)`
|
|
|
|
|
&&& {
|
|
|
|
|
color: #f2f2f2;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
2021-06-24 22:28:32 +05:30
|
|
|
`;
|
|
|
|
|
|
2021-06-28 21:32:41 +05:30
|
|
|
const CustomText = styled(Text)`
|
|
|
|
|
&&& {
|
|
|
|
|
color: #2d9cdb;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
2021-06-24 22:28:32 +05:30
|
|
|
|
2021-06-28 21:32:41 +05:30
|
|
|
const CustomSubTitle = styled(Title)`
|
|
|
|
|
&&& {
|
|
|
|
|
color: #bdbdbd;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const CustomSubText = styled(Paragraph)`
|
|
|
|
|
&&& {
|
|
|
|
|
background: #4f4f4f;
|
|
|
|
|
color: #2d9cdb;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
padding: 6px 8px;
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
}
|
2021-06-24 22:28:32 +05:30
|
|
|
`;
|
|
|
|
|
|
2021-08-19 23:04:15 +05:30
|
|
|
const CardContainer = styled(Card)`
|
|
|
|
|
.ant-card-body {
|
|
|
|
|
max-height: 90vh;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2021-01-03 18:15:44 +05:30
|
|
|
const SelectedSpanDetails = (props: SelectedSpanDetailsProps) => {
|
2021-07-02 14:26:42 +05:30
|
|
|
const spanTags = props.data?.tags;
|
2021-06-28 21:32:41 +05:30
|
|
|
const service = props.data?.name?.split(":")[0];
|
|
|
|
|
const operation = props.data?.name?.split(":")[1];
|
2021-01-18 02:18:49 +05:30
|
|
|
|
|
|
|
|
return (
|
2021-08-19 23:04:15 +05:30
|
|
|
<CardContainer>
|
2021-06-24 22:28:32 +05:30
|
|
|
<Space direction="vertical">
|
|
|
|
|
<strong> Details for selected Span </strong>
|
|
|
|
|
<Space direction="vertical" size={2}>
|
2021-06-28 21:32:41 +05:30
|
|
|
<CustomTitle style={{ marginTop: "18px" }}>Service</CustomTitle>
|
|
|
|
|
<CustomText>{service}</CustomText>
|
2021-06-24 22:28:32 +05:30
|
|
|
</Space>
|
|
|
|
|
<Space direction="vertical" size={2}>
|
2021-06-28 21:32:41 +05:30
|
|
|
<CustomTitle>Operation</CustomTitle>
|
|
|
|
|
<CustomText>{operation}</CustomText>
|
2021-06-24 22:28:32 +05:30
|
|
|
</Space>
|
|
|
|
|
</Space>
|
|
|
|
|
<Tabs defaultActiveKey="1">
|
2021-01-18 02:18:49 +05:30
|
|
|
<TabPane tab="Tags" key="1">
|
2021-06-27 08:47:46 +05:30
|
|
|
{spanTags &&
|
|
|
|
|
spanTags.map((tags, index) => {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
{tags.value && (
|
|
|
|
|
<>
|
2021-06-28 21:32:41 +05:30
|
|
|
<CustomSubTitle>{tags.key}</CustomSubTitle>
|
|
|
|
|
<CustomSubText>
|
2021-06-27 08:47:46 +05:30
|
|
|
{tags.key === "error" ? "true" : tags.value}
|
2021-06-28 21:32:41 +05:30
|
|
|
</CustomSubText>
|
2021-06-27 08:47:46 +05:30
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</TabPane>
|
|
|
|
|
<TabPane tab="Errors" key="2">
|
|
|
|
|
{spanTags &&
|
|
|
|
|
spanTags
|
|
|
|
|
.filter((tags) => tags.key === "error")
|
|
|
|
|
.map((error) => (
|
|
|
|
|
<>
|
2021-06-28 21:32:41 +05:30
|
|
|
<CustomSubTitle>{error.key}</CustomSubTitle>
|
|
|
|
|
<CustomSubText>true</CustomSubText>
|
2021-06-27 08:47:46 +05:30
|
|
|
</>
|
|
|
|
|
))}
|
2021-01-18 02:18:49 +05:30
|
|
|
</TabPane>
|
|
|
|
|
</Tabs>
|
2021-08-19 23:04:15 +05:30
|
|
|
</CardContainer>
|
2021-01-18 02:18:49 +05:30
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default SelectedSpanDetails;
|