(
state: State<'_, AppState>,
app: tauri::AppHandle,
request: CloseWorkspaceRequest,
)
| 1784 | |
| 1785 | #[tauri::command] |
| 1786 | pub async fn close_workspace( |
| 1787 | state: State<'_, AppState>, |
| 1788 | app: tauri::AppHandle, |
| 1789 | request: CloseWorkspaceRequest, |
| 1790 | ) -> Result<(), String> { |
| 1791 | let closing = state |
| 1792 | .workspace_service |
| 1793 | .get_workspace(&request.workspace_id) |
| 1794 | .await; |
| 1795 | |
| 1796 | match state |
| 1797 | .workspace_service |
| 1798 | .close_workspace(&request.workspace_id) |
| 1799 | .await |
| 1800 | { |
| 1801 | Ok(_) => { |
| 1802 | if let Some(ref ws) = closing { |
| 1803 | if ws.workspace_kind == WorkspaceKind::Remote { |
| 1804 | if let Some(rw) = remote_workspace_from_info(ws) { |
| 1805 | state |
| 1806 | .unregister_remote_workspace_entry(&rw.connection_id, &rw.remote_path) |
| 1807 | .await; |
| 1808 | } |
| 1809 | } |
| 1810 | } |
| 1811 | |
| 1812 | if let Some(workspace_info) = state.workspace_service.get_current_workspace().await { |
| 1813 | apply_active_workspace_context(&state, &app, &workspace_info, None).await; |
| 1814 | } else { |
| 1815 | clear_active_workspace_context(&state, &app, None).await; |
| 1816 | } |
| 1817 | |
| 1818 | info!("Workspace closed: workspace_id={}", request.workspace_id); |
| 1819 | Ok(()) |
| 1820 | } |
| 1821 | Err(e) => { |
| 1822 | error!("Failed to close workspace: {}", e); |
| 1823 | Err(format!("Failed to close workspace: {}", e)) |
| 1824 | } |
| 1825 | } |
| 1826 | } |
| 1827 | |
| 1828 | #[tauri::command] |
| 1829 | pub async fn set_active_workspace( |
no test coverage detected