import { Fragment } from "react"; import { faFile, faInfoCircle } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Button, EmptyState, Table, TableContainer, TableSkeleton, TBody, Td, Th, THead, Tooltip, Tr } from "@app/components/v2"; import { useGetAuditLogs } from "@app/hooks/api"; import { TGetAuditLogsFilter } from "@app/hooks/api/auditLogs/types"; import { LogsTableRow } from "./LogsTableRow"; type Props = { filter?: TGetAuditLogsFilter; refetchInterval?: number; }; const AUDIT_LOG_LIMIT = 15; export const LogsTable = ({ filter, refetchInterval }: Props) => { // Determine the project ID for filtering const filterProjectId = // Use the projectId from the filter if it exists filter?.projectId || null; const { data, isPending, isFetchingNextPage, hasNextPage, fetchNextPage } = useGetAuditLogs( { ...filter, limit: AUDIT_LOG_LIMIT }, filterProjectId, { refetchInterval } ); const isEmpty = !isPending && !data?.pages?.[0].length; return (
{!isPending && data?.pages?.map((group, i) => ( {group.map((auditLog, index) => ( ))} ))} {isPending && } {isEmpty && ( )}
Timestamp Event
{!isEmpty && ( )}
); };