Conversation
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
Co-authored-by: JonnyTran <4750391+JonnyTran@users.noreply.github.com>
- Update `BaseSimpleTable` adapter to pass the full column configuration (including editor params) instead of just name/type. - Update `RenderTable` logic to respect custom column settings (like `editor: "list"`) by prioritizing schema config over defaults. - Add watcher to `columnsConfig` in `RenderTable` to ensure dropdown options update reactively when new files are uploaded.
- Add missing `$emit('cell-edited')` in `RenderTable`'s tabulator handler.
- Ensures parent components are notified of changes to trigger state updates like the unmapped files counter.
There was a problem hiding this comment.
Pull request overview
This PR adds an editable table interface for PDF-only uploads, enabling users to manually create reference entries and assign PDF files when no bibliography file is provided. The feature automatically displays an editable table with reference metadata columns when PDFs are uploaded without a bibliography file, supports multi-select PDF assignment via Tabulator's list editor, enforces validation constraints, and tracks unmapped PDFs in real-time.
Changes:
- Implements automatic table generation with 3 empty rows when PDFs are uploaded without bibliography
- Adds multi-select PDF file assignment with dynamic dropdown in the "files" column
- Integrates real-time analysis updates through deep watching of dataframe data hash
- Includes comprehensive unit tests covering table visibility, column configuration, and data synchronization
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
useImportFileUploadViewModel.ts |
Core view model implementing editable table logic, column configuration with validators, unmapped PDF tracking, data sync, and auto-submit watcher |
useImportFileUploadViewModel.spec.ts |
Unit tests covering table visibility conditions, column configuration, unmapped file tracking, and data synchronization |
ImportFileUpload.vue |
Template integration of BaseSimpleTable component with editable table section and unmapped PDFs display |
useImportAnalysisTableViewModel.ts |
Adds deep watch on dataframe data hash to trigger analysis updates on cell edits |
BaseSimpleTable.vue |
Handles validators prop and spreads column properties to preserve editor config |
RenderTable.vue |
Spreads column properties in config and emits cell-edited event |
Comments suppressed due to low confidence (1)
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts:448
- The reset function should also clear
editableTableDatato ensure a clean state when resetting the component. Currently, the editable table data persists after reset, which could lead to stale data being displayed if the user resets and then uploads PDFs again.
const reset = () => {
// Set flag to prevent recursive updates during reset
isInitializing.value = true;
hasAutoSubmitted.value = false;
// Reset bibliography data
bibData.value = {
fileName: "",
dataframeData: null,
rawContent: "",
};
// Reset PDF data
pdfData.value = {
matchedFiles: [],
unmatchedFiles: [],
totalFiles: 0,
};
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts
Outdated
Show resolved
Hide resolved
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.spec.ts
Outdated
Show resolved
Hide resolved
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts
Outdated
Show resolved
Hide resolved
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts
Outdated
Show resolved
Hide resolved
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts
Outdated
Show resolved
Hide resolved
| expect(viewModel.bibData.value.dataframeData?.data).toHaveLength(1); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
There's no test coverage for the auto-submit behavior when all PDFs are mapped. Consider adding a test that verifies the watcher triggers syncEditableTableToBibData when unmappedPdfFiles becomes empty and sets hasAutoSubmitted to prevent duplicate submissions.
| expect(viewModel.bibData.value.dataframeData?.data).toHaveLength(1); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
There's no test coverage for the handleTableCellEdit and handleTableBuilt event handlers. Consider adding tests to verify that these handlers properly sync the table data with editableTableData.
| expect(viewModel.bibData.value.dataframeData?.data).toHaveLength(1); | ||
| }); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
There's no test coverage for the initializeEditableTable function. Consider adding a test to verify that it creates 3 empty rows with the correct structure when PDFs are uploaded without bibliography.
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.spec.ts
Outdated
Show resolved
Hide resolved
extralit-frontend/components/features/import/file-upload/useImportFileUploadViewModel.ts
Outdated
Show resolved
Hide resolved
- Created detailed test report documenting all testing activities - All 72 test suites passing (723 tests) - Auto-fixed 53 linting errors via eslint --fix - Reviewed key UI components (BaseSimpleTable, RenderTable, TableUpload, ImportFileUpload) - Documented remaining linting issues (ESLint parser configuration) - Confirmed PR #174 is ready for merge Test Summary: ✅ Unit Tests: 723/723 passed ✅ Component Review: All components structurally sound⚠️ Linting: 50 non-blocking errors (ESLint parser issues with TypeScript) ✅ Overall Status: PASSED - READY FOR MERGE
…table-for-pdf-uploads
| if ( | ||
| editableTable.value && | ||
| newUnmapped.length === 0 && | ||
| !hasAutoSubmitted.value | ||
| ) { |
There was a problem hiding this comment.
| if ( | |
| editableTable.value && | |
| newUnmapped.length === 0 && | |
| !hasAutoSubmitted.value | |
| ) { | |
| if ( | |
| editableTable.value && | |
| editableTableData.value.length > 0 && | |
| newUnmapped.length === 0 && | |
| !hasAutoSubmitted.value | |
| ) { |
We’re currently checking only editableTable.value to determine readiness, but the table instance may exist before it has actual row data.
Consider also checking editableTableData.value.length > 0 to ensure the table is fully initialized before triggering auto-submit. This prevents premature submission when PDFs are first uploaded.
| emitPdfUpdate(); | ||
| }; | ||
|
|
||
| const handleTableCellEdit = (cell: any) => { |
There was a problem hiding this comment.
| const handleTableCellEdit = (cell: any) => { | |
| const handleTableCellEdit = (_cell: any) => { |
| // Initialize editable table with empty rows | ||
| const initializeEditableTable = () => { | ||
| // Start with a few empty rows | ||
| const initialRows = Array.from({ length: 3 }, (_, i) => ({ |
There was a problem hiding this comment.
| const initialRows = Array.from({ length: 3 }, (_, i) => ({ | |
| const initialRows = Array.from({ length: 3 }, () => ({ |
| emitPdfUpdate(); | ||
| }; | ||
|
|
||
| const handleTableCellEdit = (cell: any) => { |
There was a problem hiding this comment.
| const handleTableCellEdit = (cell: any) => { | |
| const handleTableCellEdit = (_cell: any) => { |
| // Initialize editable table with empty rows | ||
| const initializeEditableTable = () => { | ||
| // Start with a few empty rows | ||
| const initialRows = Array.from({ length: 3 }, (_, i) => ({ |
There was a problem hiding this comment.
| const initialRows = Array.from({ length: 3 }, (_, i) => ({ | |
| const initialRows = Array.from({ length: 3 }, () => ({ |
7bea48c to
d11bb2b
Compare
…leting unused dependencies. Update unit test for dynamic editor parameters in useImportFileUploadViewModel to ensure proper functionality.
…eaner code - Removed unnecessary mapping for PDF file options in editable table columns. - Simplified reference validators by consolidating into an array format. - Updated handleTableCellEdit function parameter for clarity. - Adjusted initialRows creation to eliminate unused index variable.
…sTable) - ImportAnalysisTable: add editable table branch shown when no bibliography data exists but PDFs are uploaded (shouldShowEditableTable computed) - ImportAnalysisTable: add allPdfFileNames, unmappedPdfFiles, editableTableColumns computeds; handleTableCellEdit, handleTableBuilt, initializeEditableTable methods - ImportAnalysisTable: extend pdfData prop to include unmatchedFiles - ImportAnalysisTable: emitUpdate() first branch builds confirmedDocuments from editable table rows when in PDF-only mode - ImportFileUpload: remove editable table template, BaseSimpleTable import, and CSS - useImportFileUploadViewModel: remove all editable table logic (refs, computeds, methods, watcher); simplifies to pure bib+pdf coordination only - useImportFileUploadViewModel.spec.ts: delete (tested wrong location) - useImportAnalysisTableViewModel: extend pdfData type to include unmatchedFiles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- RenderTable.vue: Added styles for frozen column headers and body cells to ensure consistent light backgrounds. - BaseSimpleTable.vue: Introduced light-mode color variables for better theme control and updated frozen column styles. - ImportAnalysisTable.vue: Renamed "Reference Metadata" to "Document Metadata" and refined editable table initialization logic for PDF files, improving user experience and data handling.
- Added a reference to the ImportFlow component in index.vue. - Implemented beforeRouteLeave navigation guard to prompt users about unsaved import data. - Introduced handleBeforeUnload method to warn users when attempting to close the window with unsaved changes. - Updated hasDataToLose method in ImportFlow.vue to include editable table data in the loss check.
Description
This PR adds an editable table interface for PDF-only uploads, allowing users to manually create reference entries and assign PDFs when no bibliography file is provided.
Core Changes:
Implementation:
Data Flow:
PDFs uploaded →
shouldShowEditableTable→ User edits →syncEditableTableToBibData→ Analysis pipelineLeverages existing
BaseSimpleTable/RenderTablecomponents and domain entities (TableData,DataFrameSchema). Backward compatible—bibliography upload hides table and resumes standard flow.Related Tickets & Documents
Closes #191
What type of PR is this? (check all applicable)
Steps to QA
Added/updated tests?
useImportFileUploadViewModel.spec.tscovering table visibility, column configuration, unmapped tracking, and data syncAdded/updated documentations?
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.