feat(folders): add rename, missing-folder recovery, and right-click context menu

- Backend: new `rename_folder` command (updates display name only, not path)
  and `update_folder_path` command (rewrites image paths in DB before reindexing
  so thumbnails/embeddings are not regenerated unnecessarily)
- DB: `rename_folder` and `update_folder_path` helpers; `scan_error` column on
  folders table to surface indexing failures without silently dropping images
- Store: `renameFolder` and `updateFolderPath` actions
- Sidebar: right-click context menu on each folder row (Reindex, Rename, Locate
  Folder, Remove from app); inline rename input on Enter/Escape/blur; missing-
  folder recovery banner with Locate/Remove; hover icon buttons (reindex + remove
  with Confirm/Cancel) preserved alongside the context menu
This commit is contained in:
2026-06-07 09:16:56 +01:00
parent 7871d52d39
commit 4e5923ba84
5 changed files with 258 additions and 125 deletions
+8
View File
@@ -1356,6 +1356,14 @@ pub fn get_folders(conn: &Connection) -> Result<Vec<Folder>> {
Ok(rows.collect::<rusqlite::Result<Vec<_>>>()?)
}
pub fn rename_folder(conn: &Connection, folder_id: i64, new_name: &str) -> Result<()> {
conn.execute(
"UPDATE folders SET name = ?2 WHERE id = ?1",
params![folder_id, new_name],
)?;
Ok(())
}
pub fn update_folder_path(conn: &Connection, folder_id: i64, old_path: &str, new_path: &str, new_name: &str) -> Result<()> {
conn.execute(
"UPDATE folders SET path = ?2, name = ?3, scan_error = NULL WHERE id = ?1",