From 50832e022992c5e3ed326b0e42a9b16ebc400c64 Mon Sep 17 00:00:00 2001
From: Alessandro <155005371+3clyp50@users.noreply.github.com>
Date: Wed, 30 Sep 2026 16:13:10 +0200
Subject: [PATCH] Persist sidebar project, status, and activity filters
The sidebar saved View and Sort by, but kept Project, Status, and Last activity
only in memory. Reloading reset those three controls to their defaults.
Store the filters in the existing Sidebar Folders configuration and reuse its
save/load API. Preserve the empty No project value, apply safe defaults to
missing or malformed settings, and keep the menu open when changing filters.
Changing view or sort retains the selected filters.
Update defaults, documentation, and frontend regression coverage for saving,
reloading, fallback values, and menu behavior.
Validation: frontend checks and seven focused Python tests passed. Live native
dropdown checks confirmed named-project and No-project selections survive
reloads, including after changing view and sort. Original runtime settings
were restored afterward.
---
plugins/_sidebar_folders/AGENTS.md | 4 +-
plugins/_sidebar_folders/README.md | 2 +-
plugins/_sidebar_folders/default_config.yaml | 3 ++
.../webui/chats-header-controls/options.html | 11 +++--
.../_sidebar_folders/tests/test_frontend.mjs | 46 +++++++++++++++----
.../webui/sidebar-folders-store.js | 26 +++++------
6 files changed, 64 insertions(+), 28 deletions(-)
diff --git a/plugins/_sidebar_folders/AGENTS.md b/plugins/_sidebar_folders/AGENTS.md
index 543486123..c53552b5d 100644
--- a/plugins/_sidebar_folders/AGENTS.md
+++ b/plugins/_sidebar_folders/AGENTS.md
@@ -29,7 +29,7 @@
- Keep parallel children nested and selectable. Move visible descendants and background workers with their root; retain parent IDs, history, and selection. Reject running families and scheduler-owned contexts before any mutation.
- Use existing project activation/deactivation helpers, persistence, and state invalidation. Restore project/profile state if a family move fails.
- Scheduler tasks retain their configured project; dragging may reorder them within their folder or within the shared pinned section.
-- Closed project folders mount their rows only when expanded. Expansion is browser-local, while view, sort, and order survive server/browser reloads.
+- Closed project folders mount their rows only when expanded. Expansion is browser-local, while view, sort, filters, and order survive server/browser reloads. The empty project-filter key means **No project** and must not be replaced with the all-projects default.
- Folder rows use compact spacing tokens; thread lists have no vertical guide border and reuse the smaller core thread dots. Dim empty-folder labels and give their rows the same height as a chat row, preserving space before the next folder.
- Extend list rows `--spacing-xs` beyond the header controls, with the same inset after their last action button. Keep header positions fixed so folder, chat, and worker action columns align in both views.
- Folder actions reuse the standard chat action buttons with a subtle border at rest. Show them on pointer hover, keyboard focus, or while the folder menu is open; touch devices also show them for expanded folders.
@@ -41,7 +41,7 @@
## Work Guidance
- Reuse project creation/edit/file dialogs, notifications, native drag events, and Material `x-icon` elements.
-- View and sort preferences are saved through the plugin configuration API from the sidebar menu. This plugin has no separate configuration page.
+- View, sort, and Project/Status/Last activity filters share the plugin configuration API and save automatically from the sidebar menu. Missing or invalid filters fall back to all projects/statuses/times. This plugin has no separate configuration page.
- Project moves and ordering use drag and drop, without move actions in thread menus. Folder-row creation uses the same `chat_add_on` icon as the New chat menu action.
- Header, folder, chat, worker, and task action buttons share hover/focus treatment. The two Chats header icons use `1.125rem` inside the existing button frames, preserving action-column alignment with the smaller row icons. Header borders appear only on hover; row buttons retain their resting borders. Use `--spacing-xs` between buttons and at row ends. Keep these sidebar-scoped overrides in the plugin's header extension and retain row visibility behavior and confirmation states.
- The options menu contains only View (Folders / Flat mode), Sort by, Project, Status, and Last activity. Keep native dropdowns consistent with Settings: muted borders, the small radius token, and an opaque menu-colored surface so native option lists remain readable. Use `--spacing-xs` gaps between fields and `--spacing-sm` outer padding. Show focus outlines for keyboard navigation, without a lingering pointer-click ring. Folder expansion belongs to individual folder rows.
diff --git a/plugins/_sidebar_folders/README.md b/plugins/_sidebar_folders/README.md
index 2a47edd60..53d8a25d6 100644
--- a/plugins/_sidebar_folders/README.md
+++ b/plugins/_sidebar_folders/README.md
@@ -13,4 +13,4 @@ Organize chats and tasks into project folders. Folder view is on by default; use
- Scheduler tasks have their own pinned section and project folders. Their configured project stays unchanged when reordered.
- Chats and tasks default to **Created time**, newest first, so new messages do not change their position. **Last active**, name, and manual order are also available. Filter by project, **Working** / **Idle** status, or recent activity. Idle includes waiting or completed chats, paused chats, and disabled tasks. A working parallel child keeps its family under Working.
-View and sort settings, project pins, and manual order are saved for the instance. Folder expansion is saved in the browser; filters apply to the current page. Disabling this plugin restores the standard sidebar.
+View, sort, Project, Status, and Last activity choices save automatically for the instance and survive reloads, along with project pins and manual order. Folder expansion is saved in the browser. Disabling this plugin restores the standard sidebar.
diff --git a/plugins/_sidebar_folders/default_config.yaml b/plugins/_sidebar_folders/default_config.yaml
index 95e46e776..9f297a0c3 100644
--- a/plugins/_sidebar_folders/default_config.yaml
+++ b/plugins/_sidebar_folders/default_config.yaml
@@ -1,2 +1,5 @@
folder_view: true
sort_by: created
+project_filter: '*'
+status_filter: all
+activity_filter: all
diff --git a/plugins/_sidebar_folders/extensions/webui/chats-header-controls/options.html b/plugins/_sidebar_folders/extensions/webui/chats-header-controls/options.html
index bbc7318a7..3ccb1263e 100644
--- a/plugins/_sidebar_folders/extensions/webui/chats-header-controls/options.html
+++ b/plugins/_sidebar_folders/extensions/webui/chats-header-controls/options.html
@@ -32,21 +32,24 @@