refactor(workspace): migrate from per-folder windows to single-window workspace
Replace the legacy folder + welcome routes with a unified /workspace route that hosts all folders, conversations, tabs, and terminals in one window. - Persist opened tabs to the database (opened_tabs entity + migration) so tab layout survives restarts and deep-link bootstrap restores state - Replace FolderContext shim with AppWorkspaceProvider, ActiveFolderProvider, and TabProvider; expose both opened (folders) and full DB (allFolders) listings via list_all_folder_details - Return conversations across all non-deleted folders from list_all when no folder filter is given, so the sidebar can show every folder's history - Add ConversationContextBar above the chat input with folder picker (auto-opens unopened folders on select), branch picker, and commit / push / merge / stash entries to restore BranchDropdown functionality - Rework sidebar with stats header, search, flat / folder-grouped view modes (localStorage-persisted), reveal-in-sidebar event subscriber, and per-folder context menu (focus, close tabs, remove from workspace); indent conversations under folder headers in grouped mode - Gate terminal creation on active folder and show folder context - Remove deprecated BranchDropdown, FolderNameDropdown, welcome route, and per-folder window commands - Localize all new strings across 10 locales
This commit is contained in:
@@ -9,24 +9,24 @@ use crate::commands::conversations as conv_commands;
|
||||
use crate::db::service::{conversation_service, folder_service, import_service};
|
||||
use crate::models::*;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ListFolderConversationsParams {
|
||||
pub folder_id: i32,
|
||||
pub struct ListAllConversationsParams {
|
||||
pub folder_ids: Option<Vec<i32>>,
|
||||
pub agent_type: Option<AgentType>,
|
||||
pub search: Option<String>,
|
||||
pub sort_by: Option<String>,
|
||||
pub status: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn list_folder_conversations(
|
||||
pub async fn list_all_conversations(
|
||||
Extension(state): Extension<Arc<AppState>>,
|
||||
Json(params): Json<ListFolderConversationsParams>,
|
||||
Json(params): Json<ListAllConversationsParams>,
|
||||
) -> Result<Json<Vec<DbConversationSummary>>, AppCommandError> {
|
||||
let db = &state.db;
|
||||
let result = conversation_service::list_by_folder(
|
||||
let result = conversation_service::list_all(
|
||||
&db.conn,
|
||||
params.folder_id,
|
||||
params.folder_ids,
|
||||
params.agent_type,
|
||||
params.search,
|
||||
params.sort_by,
|
||||
@@ -37,6 +37,35 @@ pub async fn list_folder_conversations(
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
||||
pub async fn list_opened_tabs(
|
||||
Extension(state): Extension<Arc<AppState>>,
|
||||
) -> Result<Json<Vec<OpenedTab>>, AppCommandError> {
|
||||
use crate::db::service::tab_service;
|
||||
let db = &state.db;
|
||||
let result = tab_service::list_all_tabs(&db.conn)
|
||||
.await
|
||||
.map_err(AppCommandError::from)?;
|
||||
Ok(Json(result))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SaveOpenedTabsParams {
|
||||
pub items: Vec<OpenedTab>,
|
||||
}
|
||||
|
||||
pub async fn save_opened_tabs(
|
||||
Extension(state): Extension<Arc<AppState>>,
|
||||
Json(params): Json<SaveOpenedTabsParams>,
|
||||
) -> Result<Json<()>, AppCommandError> {
|
||||
use crate::db::service::tab_service;
|
||||
let db = &state.db;
|
||||
tab_service::save_all_tabs(&db.conn, params.items)
|
||||
.await
|
||||
.map_err(AppCommandError::from)?;
|
||||
Ok(Json(()))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ListConversationsParams {
|
||||
|
||||
Reference in New Issue
Block a user