feat(client): rename FailedOcrPage to DocumentManagementPage
This commit is contained in:
parent
4e34992cb5
commit
e8a7d7bf0f
|
|
@ -15,7 +15,7 @@ import DocumentDetailsPage from './pages/DocumentDetailsPage';
|
|||
import SettingsPage from './pages/SettingsPage';
|
||||
import SourcesPage from './pages/SourcesPage';
|
||||
import WatchFolderPage from './pages/WatchFolderPage';
|
||||
import FailedOcrPage from './pages/FailedOcrPage';
|
||||
import DocumentManagementPage from './pages/DocumentManagementPage';
|
||||
import LabelsPage from './pages/LabelsPage';
|
||||
import IgnoredFilesPage from './pages/IgnoredFilesPage';
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ function App(): React.ReactElement {
|
|||
<Route path="/sources" element={<SourcesPage />} />
|
||||
<Route path="/watch" element={<WatchFolderPage />} />
|
||||
<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="/profile" element={<div>Profile Page - Coming Soon</div>} />
|
||||
</Routes>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ const navigationItems: NavigationItem[] = [
|
|||
{ text: 'Labels', icon: LabelIcon, path: '/labels' },
|
||||
{ text: 'Sources', icon: StorageIcon, path: '/sources' },
|
||||
{ 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' },
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ interface DuplicatesResponse {
|
|||
};
|
||||
}
|
||||
|
||||
const FailedOcrPage: React.FC = () => {
|
||||
const DocumentManagementPage: React.FC = () => {
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
const [currentTab, setCurrentTab] = useState(0);
|
||||
|
|
@ -1743,4 +1743,4 @@ const FailedOcrPage: React.FC = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export default FailedOcrPage;
|
||||
export default DocumentManagementPage;
|
||||
|
|
@ -3,7 +3,7 @@ import { describe, test, expect } from 'vitest';
|
|||
// Regression tests that validate the code patterns we implemented
|
||||
// without interfering with existing component tests
|
||||
|
||||
describe('FailedOcrPage - Code Pattern Validation', () => {
|
||||
describe('DocumentManagementPage - Code Pattern Validation', () => {
|
||||
test('validates null-safe access pattern for statistics', () => {
|
||||
// This test ensures the null-safe pattern is working correctly
|
||||
// Pattern: statistics?.failure_categories?.map(...) || fallback
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { describe, test, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
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
|
||||
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>;
|
||||
};
|
||||
|
||||
describe('FailedOcrPage', () => {
|
||||
describe('DocumentManagementPage', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('renders page structure without crashing', () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// Basic check that the component renders without throwing errors
|
||||
|
|
@ -57,9 +57,9 @@ describe('FailedOcrPage', () => {
|
|||
|
||||
test('renders page title', async () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// Wait for the page to load and show the title
|
||||
|
|
@ -70,9 +70,9 @@ describe('FailedOcrPage', () => {
|
|||
|
||||
test('renders refresh button', async () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
|
|
@ -82,9 +82,9 @@ describe('FailedOcrPage', () => {
|
|||
|
||||
test('renders tabs structure', async () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// Wait for tabs to appear
|
||||
|
|
@ -103,16 +103,16 @@ describe('FailedOcrPage', () => {
|
|||
// test('refreshes data when refresh button is clicked', async () => { ... });
|
||||
});
|
||||
|
||||
describe('FailedOcrPage - Low Confidence Deletion', () => {
|
||||
describe('DocumentManagementPage - Low Confidence Deletion', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('renders low confidence deletion tab', async () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// 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 () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// 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 () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// Navigate to Low Quality Manager tab
|
||||
|
|
@ -177,9 +177,9 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
|
|||
|
||||
test('shows informational alert about low confidence deletion', async () => {
|
||||
render(
|
||||
<FailedOcrPageWrapper>
|
||||
<FailedOcrPage />
|
||||
</FailedOcrPageWrapper>
|
||||
<DocumentManagementPageWrapper>
|
||||
<DocumentManagementPage />
|
||||
</DocumentManagementPageWrapper>
|
||||
);
|
||||
|
||||
// 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 () => {
|
||||
// const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence);
|
||||
//
|
||||
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>);
|
||||
// render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
|
||||
//
|
||||
// // Navigate to tab and click preview
|
||||
// const lowConfidenceTab = screen.getByText(/Low Confidence/i);
|
||||
|
|
@ -219,7 +219,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
|
|||
// });
|
||||
|
||||
// test('validates confidence threshold input values', async () => {
|
||||
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>);
|
||||
// render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
|
||||
//
|
||||
// const lowConfidenceTab = screen.getByText(/Low Confidence/i);
|
||||
// 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
|
||||
// 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 () => {
|
||||
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>);
|
||||
// render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
|
||||
//
|
||||
// const lowConfidenceTab = screen.getByText(/Low Confidence/i);
|
||||
// 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);
|
||||
// fireEvent.click(lowConfidenceTab);
|
||||
|
|
@ -308,7 +308,7 @@ describe('FailedOcrPage - Low Confidence Deletion', () => {
|
|||
// const mockDeleteLowConfidence = vi.mocked(documentService.deleteLowConfidence);
|
||||
// mockDeleteLowConfidence.mockRejectedValueOnce(new Error('Network error'));
|
||||
//
|
||||
// render(<FailedOcrPageWrapper><FailedOcrPage /></FailedOcrPageWrapper>);
|
||||
// render(<DocumentManagementPageWrapper><DocumentManagementPage /></DocumentManagementPageWrapper>);
|
||||
//
|
||||
// const lowConfidenceTab = screen.getByText(/Low Confidence/i);
|
||||
// fireEvent.click(lowConfidenceTab);
|
||||
Loading…
Reference in New Issue