2023-07-06 14:22:44 +03:00
|
|
|
import { Drawer, Tabs } from 'antd';
|
|
|
|
|
import JSONView from 'container/LogDetailedView/JsonView';
|
|
|
|
|
import TableView from 'container/LogDetailedView/TableView';
|
2023-07-17 18:25:55 +05:30
|
|
|
import { useMemo } from 'react';
|
2023-07-06 14:22:44 +03:00
|
|
|
|
|
|
|
|
import { LogDetailProps } from './LogDetail.interfaces';
|
|
|
|
|
|
2023-07-11 16:53:15 +03:00
|
|
|
function LogDetail({
|
|
|
|
|
log,
|
|
|
|
|
onClose,
|
|
|
|
|
onAddToQuery,
|
2023-07-13 15:55:43 +03:00
|
|
|
onClickActionItem,
|
2023-07-11 16:53:15 +03:00
|
|
|
}: LogDetailProps): JSX.Element {
|
2023-07-17 18:25:55 +05:30
|
|
|
const items = useMemo(
|
|
|
|
|
() => [
|
|
|
|
|
{
|
|
|
|
|
label: 'Table',
|
|
|
|
|
key: '1',
|
|
|
|
|
children: log && (
|
|
|
|
|
<TableView
|
|
|
|
|
logData={log}
|
|
|
|
|
onAddToQuery={onAddToQuery}
|
|
|
|
|
onClickActionItem={onClickActionItem}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'JSON',
|
|
|
|
|
key: '2',
|
|
|
|
|
children: log && <JSONView logData={log} />,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
[log, onAddToQuery, onClickActionItem],
|
|
|
|
|
);
|
2023-07-06 14:22:44 +03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Drawer
|
|
|
|
|
width="60%"
|
|
|
|
|
title="Log Details"
|
|
|
|
|
placement="right"
|
|
|
|
|
closable
|
2023-07-30 14:02:18 +03:00
|
|
|
onClose={onClose}
|
2023-07-06 14:22:44 +03:00
|
|
|
open={log !== null}
|
|
|
|
|
style={{ overscrollBehavior: 'contain' }}
|
|
|
|
|
destroyOnClose
|
|
|
|
|
>
|
|
|
|
|
<Tabs defaultActiveKey="1" items={items} />
|
|
|
|
|
</Drawer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default LogDetail;
|