feat: Add search function for File Tree

Features:
1. Search UI
   - Search input box at top of File Tree panel
   - Search button and Clear button
   - Enter key support for quick search
   - Search query preserved in input field

2. Search API
   - Route: /api/v2/tree/:user_id/search?q=keyword&mode=tree
   - Searches: label, aliases_json, file_uuid, sha256
   - Case-insensitive search (LOWER LIKE %keyword%)
   - Returns matching nodes in selected display mode

3. Search Logic
   - SQL: LOWER(label) LIKE ? OR LOWER(aliases_json) LIKE ? ...
   - Preserves parent_id and children relationships
   - Compatible with all display modes (tree, list, grid)

Test result:
- Query: 'download' → 22 matches 
- Query: 'jpg' → 593 matches (jpg files)
- Query: 'mp4' → 56 matches (video files)

UI workflow:
1. File Tree → Login
2. Enter search keyword in search box
3. Press Enter or click Search button
4. Matching files/folders displayed
5. Click Clear to reset view

Files:
- src/page.html (search UI, searchTree/clearSearch functions)
- src/server.rs (search_tree API handler)
This commit is contained in:
Warren
2026-05-17 05:25:04 +08:00
parent ce4f0602c8
commit bd09b59a67
3 changed files with 112 additions and 3 deletions

Binary file not shown.