fix(client): updated frontend and at least compiles
This commit is contained in:
parent
9df81d8463
commit
ff4819b4b0
|
|
@ -5,7 +5,6 @@ import {
|
||||||
Chip,
|
Chip,
|
||||||
Stack,
|
Stack,
|
||||||
Paper,
|
Paper,
|
||||||
Grid,
|
|
||||||
Accordion,
|
Accordion,
|
||||||
AccordionSummary,
|
AccordionSummary,
|
||||||
AccordionDetails,
|
AccordionDetails,
|
||||||
|
|
@ -13,6 +12,7 @@ import {
|
||||||
IconButton,
|
IconButton,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
|
import Grid from '@mui/material/GridLegacy';
|
||||||
import {
|
import {
|
||||||
ExpandMore as ExpandMoreIcon,
|
ExpandMore as ExpandMoreIcon,
|
||||||
PhotoCamera as CameraIcon,
|
PhotoCamera as CameraIcon,
|
||||||
|
|
@ -341,9 +341,9 @@ const MetadataParser: React.FC<MetadataParserProps> = ({
|
||||||
{parsedSections.slice(0, 2).map((section, index) => (
|
{parsedSections.slice(0, 2).map((section, index) => (
|
||||||
<Box key={index} sx={{ mb: 2 }}>
|
<Box key={index} sx={{ mb: 2 }}>
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
||||||
{React.cloneElement(section.icon, {
|
<Box sx={{ fontSize: 16, mr: 1, color: modernTokens.colors.primary[500], display: 'inline-flex' }}>
|
||||||
sx: { fontSize: 16, mr: 1, color: modernTokens.colors.primary[500] }
|
{section.icon}
|
||||||
})}
|
</Box>
|
||||||
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}>
|
<Typography variant="subtitle2" sx={{ fontWeight: 600 }}>
|
||||||
{section.category}
|
{section.category}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
@ -393,9 +393,9 @@ const MetadataParser: React.FC<MetadataParserProps> = ({
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{React.cloneElement(section.icon, {
|
<Box sx={{ fontSize: 20, mr: 1, color: modernTokens.colors.primary[500], display: 'inline-flex' }}>
|
||||||
sx: { fontSize: 20, mr: 1, color: modernTokens.colors.primary[500] }
|
{section.icon}
|
||||||
})}
|
</Box>
|
||||||
<Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
|
<Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
|
||||||
{section.category}
|
{section.category}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ const ProcessingTimeline: React.FC<ProcessingTimelineProps> = ({
|
||||||
setLoadingHistory(true);
|
setLoadingHistory(true);
|
||||||
try {
|
try {
|
||||||
// Note: This endpoint might not exist yet, it's for future implementation
|
// Note: This endpoint might not exist yet, it's for future implementation
|
||||||
const response = await documentService.getRetryHistory?.(documentId);
|
const response = await documentService.getDocumentRetryHistory(documentId);
|
||||||
if (response?.data?.retry_history) {
|
if (response?.data?.retry_history) {
|
||||||
setRetryHistory(response.data.retry_history);
|
setRetryHistory(response.data.retry_history);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ import {
|
||||||
Speed as SpeedIcon,
|
Speed as SpeedIcon,
|
||||||
MoreVert as MoreIcon,
|
MoreVert as MoreIcon,
|
||||||
} from '@mui/icons-material';
|
} from '@mui/icons-material';
|
||||||
import { documentService, OcrResponse } from '../services/api';
|
import { documentService, OcrResponse, type Document } from '../services/api';
|
||||||
import DocumentViewer from '../components/DocumentViewer';
|
import DocumentViewer from '../components/DocumentViewer';
|
||||||
import LabelSelector from '../components/Labels/LabelSelector';
|
import LabelSelector from '../components/Labels/LabelSelector';
|
||||||
import { type LabelData } from '../components/Labels/Label';
|
import { type LabelData } from '../components/Labels/Label';
|
||||||
|
|
@ -59,23 +59,6 @@ import { RetryHistoryModal } from '../components/RetryHistoryModal';
|
||||||
import { modernTokens, glassEffect } from '../theme';
|
import { modernTokens, glassEffect } from '../theme';
|
||||||
import api from '../services/api';
|
import api from '../services/api';
|
||||||
|
|
||||||
interface Document {
|
|
||||||
id: string;
|
|
||||||
original_filename: string;
|
|
||||||
filename?: string;
|
|
||||||
file_size: number;
|
|
||||||
mime_type: string;
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
user_id: string;
|
|
||||||
file_hash?: string;
|
|
||||||
has_ocr_text?: boolean;
|
|
||||||
tags?: string[];
|
|
||||||
original_created_at?: string;
|
|
||||||
original_modified_at?: string;
|
|
||||||
source_metadata?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DocumentDetailsPage: React.FC = () => {
|
const DocumentDetailsPage: React.FC = () => {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -520,9 +503,9 @@ const DocumentDetailsPage: React.FC = () => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{React.cloneElement(getFileIcon(document.mime_type), {
|
<Box sx={{ fontSize: 120, color: modernTokens.colors.primary[400], display: 'flex' }}>
|
||||||
sx: { fontSize: 120, color: modernTokens.colors.primary[400] }
|
{getFileIcon(document.mime_type)}
|
||||||
})}
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
@ -664,7 +647,6 @@ const DocumentDetailsPage: React.FC = () => {
|
||||||
userId={document.user_id}
|
userId={document.user_id}
|
||||||
ocrStatus={document.has_ocr_text ? 'completed' : 'pending'}
|
ocrStatus={document.has_ocr_text ? 'completed' : 'pending'}
|
||||||
ocrCompletedAt={ocrData?.ocr_completed_at}
|
ocrCompletedAt={ocrData?.ocr_completed_at}
|
||||||
ocrRetryCount={ocrData?.ocr_retry_count}
|
|
||||||
ocrError={ocrData?.ocr_error}
|
ocrError={ocrData?.ocr_error}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,11 @@ const DocumentsPage: React.FC = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchDocuments();
|
fetchDocuments();
|
||||||
fetchLabels();
|
fetchLabels();
|
||||||
}, [pagination.limit, pagination.offset, ocrFilter]);
|
}, [pagination?.limit, pagination?.offset, ocrFilter]);
|
||||||
|
|
||||||
const fetchDocuments = async (): Promise<void> => {
|
const fetchDocuments = async (): Promise<void> => {
|
||||||
|
if (!pagination) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await documentService.listWithPagination(
|
const response = await documentService.listWithPagination(
|
||||||
|
|
@ -151,8 +153,8 @@ const DocumentsPage: React.FC = () => {
|
||||||
pagination.offset,
|
pagination.offset,
|
||||||
ocrFilter || undefined
|
ocrFilter || undefined
|
||||||
);
|
);
|
||||||
setDocuments(response.data.documents);
|
setDocuments(response.data.documents || []);
|
||||||
setPagination(response.data.pagination);
|
setPagination(response.data.pagination || { total: 0, limit: 20, offset: 0, has_more: false });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError('Failed to load documents');
|
setError('Failed to load documents');
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
@ -258,7 +260,7 @@ const DocumentsPage: React.FC = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const filteredDocuments = documents.filter(doc =>
|
const filteredDocuments = (documents || []).filter(doc =>
|
||||||
doc.original_filename.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
doc.original_filename.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
doc.tags.some(tag => tag.toLowerCase().includes(searchQuery.toLowerCase()))
|
doc.tags.some(tag => tag.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,18 @@ export interface Document {
|
||||||
mime_type: string
|
mime_type: string
|
||||||
tags: string[]
|
tags: string[]
|
||||||
created_at: string
|
created_at: string
|
||||||
|
updated_at?: string
|
||||||
|
user_id?: string
|
||||||
|
file_hash?: string
|
||||||
has_ocr_text: boolean
|
has_ocr_text: boolean
|
||||||
ocr_confidence?: number
|
ocr_confidence?: number
|
||||||
ocr_word_count?: number
|
ocr_word_count?: number
|
||||||
ocr_processing_time_ms?: number
|
ocr_processing_time_ms?: number
|
||||||
ocr_status?: string
|
ocr_status?: string
|
||||||
|
// New metadata fields
|
||||||
|
original_created_at?: string
|
||||||
|
original_modified_at?: string
|
||||||
|
source_metadata?: Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchRequest {
|
export interface SearchRequest {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ export interface Document {
|
||||||
mime_type: string
|
mime_type: string
|
||||||
tags: string[]
|
tags: string[]
|
||||||
created_at: string
|
created_at: string
|
||||||
|
updated_at?: string
|
||||||
|
user_id?: string
|
||||||
|
file_hash?: string
|
||||||
has_ocr_text: boolean
|
has_ocr_text: boolean
|
||||||
ocr_confidence?: number
|
ocr_confidence?: number
|
||||||
ocr_word_count?: number
|
ocr_word_count?: number
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue