feat: 增加错误信息显示
This commit is contained in:
parent
256e263cff
commit
84499f52ea
|
|
@ -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()}
|
||||
|
|
|
|||
Loading…
Reference in New Issue