From 708075f17eca68e42f9500416bc34b8bc03e504a Mon Sep 17 00:00:00 2001 From: imeepos Date: Mon, 14 Jul 2025 16:51:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=99=BA=E8=83=BD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=88=86=E7=B1=BB=20=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/AiAnalysisLogViewer.tsx | 84 +++++-------------- 1 file changed, 20 insertions(+), 64 deletions(-) diff --git a/apps/desktop/src/components/AiAnalysisLogViewer.tsx b/apps/desktop/src/components/AiAnalysisLogViewer.tsx index af651ec..88228f8 100644 --- a/apps/desktop/src/components/AiAnalysisLogViewer.tsx +++ b/apps/desktop/src/components/AiAnalysisLogViewer.tsx @@ -1,18 +1,19 @@ import React, { useState, useEffect } from 'react'; import { invoke } from '@tauri-apps/api/core'; -import { - Search, - Download, - RefreshCw, - AlertCircle, - CheckCircle, - Clock, +import { + Search, + Download, + RefreshCw, + AlertCircle, + CheckCircle, + Clock, XCircle, Eye, RotateCcw } from 'lucide-react'; import { LoadingSpinner } from './LoadingSpinner'; import { ErrorMessage } from './ErrorMessage'; +import { CustomSelect } from './CustomSelect'; // 类型定义 interface AiAnalysisLogItem { @@ -67,7 +68,7 @@ export const AiAnalysisLogViewer: React.FC = ({ projec const [stats, setStats] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); - + // 查询参数 const [logType, setLogType] = useState<'records' | 'tasks'>('records'); const [statusFilter, setStatusFilter] = useState(''); @@ -112,7 +113,7 @@ export const AiAnalysisLogViewer: React.FC = ({ projec }; const response: AiAnalysisLogResponse = await invoke('get_ai_analysis_logs', { query }); - + setLogs(response.logs); setTotalCount(response.total_count); setTotalPages(response.total_pages); @@ -128,8 +129,8 @@ export const AiAnalysisLogViewer: React.FC = ({ projec if (!projectId) return; try { - const statsData: AiAnalysisLogStats = await invoke('get_ai_analysis_stats', { - projectId + const statsData: AiAnalysisLogStats = await invoke('get_ai_analysis_stats', { + projectId }); setStats(statsData); } catch (err) { @@ -157,20 +158,6 @@ export const AiAnalysisLogViewer: React.FC = ({ projec loadLogs(); }; - // 导出日志 - const handleExport = async (format: 'csv' | 'json') => { - try { - const result = await invoke('export_ai_analysis_logs', { - projectId, - format, - }); - console.log('导出结果:', result); - // TODO: 处理导出结果,可能需要保存文件 - } catch (err) { - console.error('导出失败:', err); - } - }; - // 重试失败任务 const handleRetryTask = async (taskId: string) => { try { @@ -260,21 +247,19 @@ export const AiAnalysisLogViewer: React.FC = ({ projec
@@ -296,21 +281,9 @@ export const AiAnalysisLogViewer: React.FC = ({ projec {/* 状态过滤 */} {filterOptions && ( - + setStatusFilter(e)} /> )}
- - {/* 操作按钮 */} -
- -
@@ -386,7 +348,7 @@ export const AiAnalysisLogViewer: React.FC = ({ projec - + {/* 操作按钮 */}
{log.log_type === 'task' && log.status.includes('Failed') && ( @@ -398,12 +360,6 @@ export const AiAnalysisLogViewer: React.FC = ({ projec )} -