feat: 增加错误信息显示

This commit is contained in:
tigermren 2025-08-17 23:26:59 +08:00
parent 256e263cff
commit 84499f52ea
1 changed files with 46 additions and 1 deletions

View File

@ -16,8 +16,9 @@ import {
DialogContent,
DialogActions,
Typography,
Tooltip,
} from '@mui/material';
import { Download as DownloadIcon, Delete as DeleteIcon } from '@mui/icons-material';
import { Download as DownloadIcon, Delete as DeleteIcon, Error as ErrorIcon } from '@mui/icons-material';
import { File, FileStatus } from '../types/file';
import { api } from '../services/api';
@ -172,6 +173,50 @@ const FileList: React.FC<FileListProps> = ({ files, onFileStatusChange }) => {
color={getStatusColor(file.status) as any}
size="small"
/>
{file.status === FileStatus.FAILED && file.error_message && (
<div style={{ marginTop: '4px' }}>
<Tooltip
title={file.error_message}
placement="top-start"
arrow
sx={{ maxWidth: '400px' }}
>
<div
style={{
display: 'flex',
alignItems: 'flex-start',
gap: '4px',
padding: '4px 8px',
backgroundColor: '#ffebee',
borderRadius: '4px',
border: '1px solid #ffcdd2'
}}
>
<ErrorIcon
color="error"
sx={{ fontSize: '16px', marginTop: '1px', flexShrink: 0 }}
/>
<Typography
variant="caption"
color="error"
sx={{
display: 'block',
wordBreak: 'break-word',
maxWidth: '300px',
lineHeight: '1.2',
cursor: 'help',
fontWeight: 500
}}
>
{file.error_message.length > 50
? `${file.error_message.substring(0, 50)}...`
: file.error_message
}
</Typography>
</div>
</Tooltip>
</div>
)}
</TableCell>
<TableCell>
{new Date(file.created_at).toLocaleString()}