From 0f14b5c8e70d5c89409561468767aa03a552be9f Mon Sep 17 00:00:00 2001 From: perf3ct Date: Sun, 15 Jun 2025 16:31:58 +0000 Subject: [PATCH] feat(server): upgrade WebDAV settings on Sources page --- frontend/src/pages/SourcesPage.tsx | 243 +++++++++++++++++++++++++++++ src/models.rs | 1 + 2 files changed, 244 insertions(+) diff --git a/frontend/src/pages/SourcesPage.tsx b/frontend/src/pages/SourcesPage.tsx index a91e119..89a511d 100644 --- a/frontend/src/pages/SourcesPage.tsx +++ b/frontend/src/pages/SourcesPage.tsx @@ -989,6 +989,249 @@ const SourcesPage: React.FC = () => { sx={{ '& .MuiOutlinedInput-root': { borderRadius: 2 } }} /> )} + + + + {/* Folder Management */} + + + + + + Folders to Monitor + + + + + Specify which folders to scan for files. Use absolute paths starting with "/". + + + + setNewFolder(e.target.value)} + placeholder="/Documents" + sx={{ + flexGrow: 1, + '& .MuiOutlinedInput-root': { borderRadius: 2 } + }} + /> + + + + + {formData.watch_folders.map((folder, index) => ( + removeFolder(folder)} + sx={{ + mr: 1, + mb: 1, + borderRadius: 2, + bgcolor: alpha(theme.palette.secondary.main, 0.1), + color: theme.palette.secondary.main, + }} + /> + ))} + + + {/* File Extensions */} + + + + + + File Extensions + + + + + File types to sync and process with OCR. + + + + setNewExtension(e.target.value)} + placeholder="docx" + sx={{ + flexGrow: 1, + '& .MuiOutlinedInput-root': { borderRadius: 2 } + }} + /> + + + + + {formData.file_extensions.map((extension, index) => ( + removeFileExtension(extension)} + sx={{ + mr: 1, + mb: 1, + borderRadius: 2, + bgcolor: alpha(theme.palette.warning.main, 0.1), + color: theme.palette.warning.main, + }} + /> + ))} + + + {/* Crawl Estimation */} + {editingSource && formData.server_url && formData.username && formData.watch_folders.length > 0 && ( + <> + + + + + + + + Crawl Estimation + + + + + Estimate how many files will be processed and how long it will take. + + + + + {estimatingCrawl && ( + + + + Analyzing folders and counting files... + + + )} + + {crawlEstimate && ( + + + Estimation Results + + + + + + {crawlEstimate.total_files?.toLocaleString() || '0'} + + Total Files + + + + + + {crawlEstimate.total_supported_files?.toLocaleString() || '0'} + + Supported Files + + + + + + {crawlEstimate.total_estimated_time_hours?.toFixed(1) || '0'}h + + Estimated Time + + + + + + {crawlEstimate.total_size_mb ? (crawlEstimate.total_size_mb / 1024).toFixed(1) : '0'}GB + + Total Size + + + + + {crawlEstimate.folders && crawlEstimate.folders.length > 0 && ( + + + + + Folder + Total Files + Supported + Est. Time + Size (MB) + + + + {crawlEstimate.folders.map((folder: any) => ( + + {folder.path} + {folder.total_files?.toLocaleString() || '0'} + {folder.supported_files?.toLocaleString() || '0'} + {folder.estimated_time_hours?.toFixed(1) || '0'}h + {folder.total_size_mb?.toFixed(1) || '0'} + + ))} + +
+
+ )} +
+ )} + + )} )} diff --git a/src/models.rs b/src/models.rs index 5fbbcbb..7485482 100644 --- a/src/models.rs +++ b/src/models.rs @@ -779,4 +779,5 @@ pub struct WebDAVSourceConfig { pub file_extensions: Vec, pub auto_sync: bool, pub sync_interval_minutes: i32, + pub server_type: Option, } \ No newline at end of file