Fix: Show "Folder is empty" message for empty folders in AI tagging #592#1158
Fix: Show "Folder is empty" message for empty folders in AI tagging #592#1158codex-yv wants to merge 1 commit intoAOSSIE-Org:mainfrom
Conversation
📝 WalkthroughWalkthroughThis PR adds image count tracking to folders throughout the application stack. The database layer now counts images per folder, this count propagates through the backend API and schema definitions, and the frontend displays a "Folder is empty" message when the count is zero instead of showing progress UI. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
This PR addresses an issue where enabling AI tagging on a folder with no images would display a stagnant 0% progress bar. The updated logic checks for the image count and provides a clear "Folder is empty" message instead. #592
Changes in Backend
Backend
backend/app/database/folders.pyUpdateddb_get_all_folder_detailsto include aLEFT JOINwith the images table, allowing each folder to return its respectiveimage_count.Schemas
backend/app/schemas/folders.pyAdded theimage_countfield to theFolderDetailsPydantic model to ensure the data is passed to the frontend.Routes
backend/app/routes/folders.pyUpdated theget_all_foldersendpoint to unpack the newimage_countvalue and include it in the API response.Changes in Frontend
Types
frontend/src/types/Folder.tsUpdated theFolderDetailsinterface to include theimage_countproperty.Components
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx(image_count === 0), it now displays an italicized "Folder is empty" message.Final Result
Users will now see a much clearer state when attempting to enable AI tagging on empty folders. Instead of a misleading progress bar, they are explicitly informed that the folder is empty, improving the overall UX of the Folder Management section.
Summary by CodeRabbit
New Features
Chores