// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { I18n } from '@aws-amplify/core'; import { useState } from 'react'; import Button from 'react-bootstrap/Button'; import Col from 'react-bootstrap/Col'; import Form from 'react-bootstrap/Form'; import Jumbotron from 'react-bootstrap/Jumbotron'; import Modal from 'react-bootstrap/Modal'; import Row from 'react-bootstrap/Row'; import Table from 'react-bootstrap/Table'; import { LoadingProgressBar } from '../../components/Loading'; import MessageModal from '../../components/MessageModal'; import { ConnectionLogsHook } from '../../hooks/ConnectionHook'; import { ConnectionLogsModalProps, ListLogsItem, MessageModalType, PaginationType } from '../../util/types'; /** * Renders the connection logs modal. * @param props The connection logs modal properties * @returns The connection logs modal */ export default function ConnectionLogsModal(props: ConnectionLogsModalProps): JSX.Element { const { show, hide, connectionName } = props; const [showMessageMessageModal, setShowMessageMessageModal] = useState(false); const { getLogs, messageModalMessage, loading, logs, pageIndex, pageToken } = ConnectionLogsHook({ connectionName, setShowMessageMessageModal }); /** * Renders the message of the empty logs. * @returns Empty logs component */ function EmptyLogs(): JSX.Element { return (

{I18n.get('info.message.no.logs')}

); } return ( <> hide()} id="connection-log-modal" animation={false} size="xl"> {I18n.get('connection.logs')}: {connectionName} {!loading && logs.length === 0 && } {!loading && logs.length > 0 && ( <> {logs.map((log: ListLogsItem, index: number) => ( ))}
{I18n.get('message')} {I18n.get('log.type')} {I18n.get('date')}
{log.logType} {new Date(log.timestamp).toISOString()}
)}
setShowMessageMessageModal(false)} message={messageModalMessage} modalType={MessageModalType.MESSAGE} /> ); }