feat(client): rename FailedOcrPage to DocumentManagementPage

This commit is contained in:
perf3ct 2025-06-29 21:48:44 +00:00
parent 4e34992cb5
commit e8a7d7bf0f
5 changed files with 40 additions and 40 deletions

View File

@ -15,7 +15,7 @@ import DocumentDetailsPage from './pages/DocumentDetailsPage';
import SettingsPage from './pages/SettingsPage'; import SettingsPage from './pages/SettingsPage';
import SourcesPage from './pages/SourcesPage'; import SourcesPage from './pages/SourcesPage';
import WatchFolderPage from './pages/WatchFolderPage'; import WatchFolderPage from './pages/WatchFolderPage';
import FailedOcrPage from './pages/FailedOcrPage'; import DocumentManagementPage from './pages/DocumentManagementPage';
import LabelsPage from './pages/LabelsPage'; import LabelsPage from './pages/LabelsPage';
import IgnoredFilesPage from './pages/IgnoredFilesPage'; import IgnoredFilesPage from './pages/IgnoredFilesPage';
@ -75,7 +75,7 @@ function App(): React.ReactElement {
<Route path="/sources" element={<SourcesPage />} /> <Route path="/sources" element={<SourcesPage />} />
<Route path="/watch" element={<WatchFolderPage />} /> <Route path="/watch" element={<WatchFolderPage />} />
<Route path="/settings" element={<SettingsPage />} /> <Route path="/settings" element={<SettingsPage />} />
<Route path="/failed-ocr" element={<FailedOcrPage />} /> <Route path="/documents/management" element={<DocumentManagementPage />} />
<Route path="/ignored-files" element={<IgnoredFilesPage />} /> <Route path="/ignored-files" element={<IgnoredFilesPage />} />
<Route path="/profile" element={<div>Profile Page - Coming Soon</div>} /> <Route path="/profile" element={<div>Profile Page - Coming Soon</div>} />
</Routes> </Routes>

View File

@ -70,7 +70,7 @@ const navigationItems: NavigationItem[] = [
{ text: 'Labels', icon: LabelIcon, path: '/labels' }, { text: 'Labels', icon: LabelIcon, path: '/labels' },
{ text: 'Sources', icon: StorageIcon, path: '/sources' }, { text: 'Sources', icon: StorageIcon, path: '/sources' },
{ text: 'Watch Folder', icon: FolderIcon, path: '/watch' }, { text: 'Watch Folder', icon: FolderIcon, path: '/watch' },
{ text: 'Document Management', icon: ManageIcon, path: '/failed-ocr' }, { text: 'Document Management', icon: ManageIcon, path: '/documents/management' },
{ text: 'Ignored Files', icon: BlockIcon, path: '/ignored-files' }, { text: 'Ignored Files', icon: BlockIcon, path: '/ignored-files' },
]; ];

View File

@ -131,7 +131,7 @@ interface DuplicatesResponse {
}; };
} }
const FailedOcrPage: React.FC = () => { const DocumentManagementPage: React.FC = () => {
const theme = useTheme(); const theme = useTheme();
const navigate = useNavigate(); const navigate = useNavigate();
const [currentTab, setCurrentTab] = useState(0); const [currentTab, setCurrentTab] = useState(0);
@ -1743,4 +1743,4 @@ const FailedOcrPage: React.FC = () => {
); );
}; };
export default FailedOcrPage; export default DocumentManagementPage;

View File

@ -3,7 +3,7 @@ import { describe, test, expect } from 'vitest';
// Regression tests that validate the code patterns we implemented // Regression tests that validate the code patterns we implemented
// without interfering with existing component tests // without interfering with existing component tests
describe('FailedOcrPage - Code Pattern Validation', () => { describe('DocumentManagementPage - Code Pattern Validation', () => {
test('validates null-safe access pattern for statistics', () => { test('validates null-safe access pattern for statistics', () => {
// This test ensures the null-safe pattern is working correctly // This test ensures the null-safe pattern is working correctly
// Pattern: statistics?.failure_categories?.map(...) || fallback // Pattern: statistics?.failure_categories?.map(...) || fallback

View File

@ -1,7 +1,7 @@
import { describe, test, expect, vi, beforeEach } from 'vitest'; import { describe, test, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react'; import { render, screen, waitFor } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import FailedOcrPage from '../FailedOcrPage'; import DocumentManagementPage from '../DocumentManagementPage';
// Simple mock that just returns promises to avoid the component crashing // Simple mock that just returns promises to avoid the component crashing
vi.mock('../../services/api', () => ({ vi.mock('../../services/api', () => ({
@ -35,20 +35,20 @@ vi.mock('../../services/api', () => ({
}, },
})); }));
const FailedOcrPageWrapper = ({ children }: { children: React.ReactNode }) => { const DocumentManagementPageWrapper = ({ children }: { children: React.ReactNode }) => {
return <BrowserRouter>{children}</BrowserRouter>; return <BrowserRouter>{children}</BrowserRouter>;
}; };
describe('FailedOcrPage', () => { describe('DocumentManagementPage', () => {
beforeEach(() => { beforeEach(() => {
vi.clearAllMocks(); vi.clearAllMocks();
}); });
test('renders page structure without crashing', () => { test('renders page structure without crashing', () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Basic check that the component renders without throwing errors // Basic check that the component renders without throwing errors
@ -57,9 +57,9 @@ describe('FailedOcrPage', () => {
test('renders page title', async () => { test('renders page title', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Wait for the page to load and show the title // Wait for the page to load and show the title
@ -70,9 +70,9 @@ describe('FailedOcrPage', () => {
test('renders refresh button', async () => { test('renders refresh button', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
await waitFor(() => { await waitFor(() => {
@ -82,9 +82,9 @@ describe('FailedOcrPage', () => {
test('renders tabs structure', async () => { test('renders tabs structure', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Wait for tabs to appear // Wait for tabs to appear
@ -103,16 +103,16 @@ describe('FailedOcrPage', () => {
// test('refreshes data when refresh button is clicked', async () => { ... }); // test('refreshes data when refresh button is clicked', async () => { ... });
}); });
describe('FailedOcrPage - Low Confidence Deletion', () => { describe('DocumentManagementPage - Low Confidence Deletion', () => {
beforeEach(() => { beforeEach(() => {
vi.clearAllMocks(); vi.clearAllMocks();
}); });
test('renders low confidence deletion tab', async () => { test('renders low confidence deletion tab', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Wait for tabs to load // Wait for tabs to load
@ -130,9 +130,9 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
test('displays confidence threshold input when low confidence tab is active', async () => { test('displays confidence threshold input when low confidence tab is active', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Wait for component to load // Wait for component to load
@ -154,9 +154,9 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
test('displays preview and delete buttons in low confidence tab', async () => { test('displays preview and delete buttons in low confidence tab', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Navigate to Low Quality Manager tab // Navigate to Low Quality Manager tab
@ -177,9 +177,9 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
test('shows informational alert about low confidence deletion', async () => { test('shows informational alert about low confidence deletion', async () => {
render( render(
<FailedOcrPageWrapper> <DocumentManagementPageWrapper>
<FailedOcrPage /> <DocumentManagementPage />
</FailedOcrPageWrapper> </DocumentManagementPageWrapper>
); );
// Navigate to Low Quality Manager tab // Navigate to Low Quality Manager tab
@ -204,7 +204,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// test('calls deleteLowConfidence API when preview button is clicked', async () => { // test('calls deleteLowConfidence API when preview button is clicked', async () => {
// const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence); // const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence);
// //
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// // Navigate to tab and click preview // // Navigate to tab and click preview
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
@ -219,7 +219,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// }); // });
// test('validates confidence threshold input values', async () => { // test('validates confidence threshold input values', async () => {
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
// fireEvent.click(lowConfidenceTab); // fireEvent.click(lowConfidenceTab);
@ -245,7 +245,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// } // }
// }); // });
// //
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// // Navigate to tab, preview, then try to delete // // Navigate to tab, preview, then try to delete
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
@ -267,7 +267,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// }); // });
// test('disables delete button when no preview data available', async () => { // test('disables delete button when no preview data available', async () => {
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
// fireEvent.click(lowConfidenceTab); // fireEvent.click(lowConfidenceTab);
@ -290,7 +290,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// } // }
// }); // });
// //
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
// fireEvent.click(lowConfidenceTab); // fireEvent.click(lowConfidenceTab);
@ -308,7 +308,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
// const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence); // const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence);
// mockDeleteLowConfidence.mockRejectedValueOnce(new Error('Network error')); // mockDeleteLowConfidence.mockRejectedValueOnce(new Error('Network error'));
// //
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>); // render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
// //
// const lowConfidenceTab = screen.getByText(/Low Confidence/i); // const lowConfidenceTab = screen.getByText(/Low Confidence/i);
// fireEvent.click(lowConfidenceTab); // fireEvent.click(lowConfidenceTab);