2022-08-19 17:16:04 +05:30
|
|
|
/* eslint-disable no-nested-ternary */
|
|
|
|
|
import { Typography } from 'antd';
|
2022-08-11 11:45:28 +05:30
|
|
|
import LogItem from 'components/Logs/LogItem';
|
|
|
|
|
import Spinner from 'components/Spinner';
|
2023-01-11 14:39:06 +05:30
|
|
|
import map from 'lodash-es/map';
|
2022-11-23 13:42:36 +05:30
|
|
|
import React, { memo } from 'react';
|
|
|
|
|
import { useSelector } from 'react-redux';
|
2022-08-11 11:45:28 +05:30
|
|
|
import { AppState } from 'store/reducers';
|
2022-08-19 17:16:04 +05:30
|
|
|
import { ILogsReducer } from 'types/reducer/logs';
|
2022-08-11 11:45:28 +05:30
|
|
|
|
|
|
|
|
import { Container, Heading } from './styles';
|
|
|
|
|
|
2022-11-23 13:42:36 +05:30
|
|
|
function LogsTable(): JSX.Element {
|
|
|
|
|
const { logs, isLoading, liveTail } = useSelector<AppState, ILogsReducer>(
|
|
|
|
|
(state) => state.logs,
|
2022-08-11 11:45:28 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (isLoading) {
|
|
|
|
|
return <Spinner height={20} tip="Getting Logs" />;
|
|
|
|
|
}
|
2022-11-12 11:37:52 +05:30
|
|
|
|
2022-08-11 11:45:28 +05:30
|
|
|
return (
|
2022-08-19 17:16:04 +05:30
|
|
|
<Container flex="auto">
|
2022-08-11 11:45:28 +05:30
|
|
|
<Heading>
|
2023-01-11 14:39:06 +05:30
|
|
|
<Typography.Text>Event</Typography.Text>
|
2022-08-11 11:45:28 +05:30
|
|
|
</Heading>
|
|
|
|
|
{Array.isArray(logs) && logs.length > 0 ? (
|
|
|
|
|
map(logs, (log) => <LogItem key={log.id} logData={log} />)
|
|
|
|
|
) : liveTail === 'PLAYING' ? (
|
|
|
|
|
<span>Getting live logs...</span>
|
|
|
|
|
) : (
|
|
|
|
|
<span>No log lines found</span>
|
|
|
|
|
)}
|
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-23 13:42:36 +05:30
|
|
|
export default memo(LogsTable);
|