// 终端审计 — 会话命令子面板 // Logan.Li import { useMemo, useState } from 'react'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import { Search, RefreshCw } from 'lucide-react'; import { useSessionCommands } from '@/hooks/api'; import { formatSize } from './helpers'; export function SessionCommandsPanel() { const [keyword, setKeyword] = useState(''); const [sessionIdInput, setSessionIdInput] = useState(''); const queryParams = useMemo( () => ({ page: 1, page_size: 200, ...(sessionIdInput ? { session_id: Number(sessionIdInput) } : {}), }), [sessionIdInput], ); const { data: commands = [], isLoading, refetch } = useSessionCommands(queryParams); const filtered = commands.filter((c) => { const kw = keyword.toLowerCase(); return ( !kw || (c.username || '').toLowerCase().includes(kw) || (c.command || '').toLowerCase().includes(kw) ); }); return ( <>
暂无会话命令记录