feat: new ToolStarter component — unified workspace-first tool starting
- New ToolStarter component: workspace context, fetches real tool types, auto-fetches config profiles per tool type, shows SSH key status - Backend: add repo_ssh_key_id to workspace list responses - WorkspacesPage: uses ToolStarter in modal instead of StartToolModal - WorkspaceDetailPage ToolsTab: uses ToolStarter in modal - Removed old inline StartToolModal from workspace-detail.tsx - Styles: .tool-starter-context, .context-row, .ssh-key-status Quality gates: ruff clean, tsc --noEmit clean, pytest workspaces API (9 passed, 1 skipped)
This commit is contained in:
@@ -4,10 +4,9 @@ import { useState } from "react";
|
||||
import { Icon } from "../components/icon";
|
||||
import { useWorkspaces } from "../hooks/use-workspaces";
|
||||
import { useWorkspaceActions } from "../hooks/use-workspace-actions";
|
||||
import { useStartTool } from "../hooks/use-start-tool";
|
||||
import { WorkspaceCard } from "../components/workspace-card";
|
||||
import { WorkspaceCreateForm } from "../components/workspace-create-form";
|
||||
import { StartToolModal } from "../components/start-tool-modal";
|
||||
import { ToolStarter } from "../components/tool-starter";
|
||||
import type { Workspace } from "../types/workspace";
|
||||
|
||||
export function WorkspacesPage() {
|
||||
@@ -16,8 +15,6 @@ export function WorkspacesPage() {
|
||||
|
||||
const { workspaces, loading, error, refresh } = useWorkspaces();
|
||||
const actions = useWorkspaceActions();
|
||||
const { startTool } = useStartTool();
|
||||
|
||||
const handleDelete = async (workspace: Workspace) => {
|
||||
await actions.delete(workspace, refresh);
|
||||
};
|
||||
@@ -31,23 +28,6 @@ export function WorkspacesPage() {
|
||||
);
|
||||
};
|
||||
|
||||
const handleStartTool = async (
|
||||
toolTypeId: string,
|
||||
configProfileId?: string,
|
||||
) => {
|
||||
if (!startWorkspace) return;
|
||||
const instance = await startTool(
|
||||
startWorkspace,
|
||||
toolTypeId,
|
||||
undefined,
|
||||
configProfileId,
|
||||
);
|
||||
if (instance) {
|
||||
setStartWorkspace(null);
|
||||
await refresh();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="page workspaces-page">
|
||||
<header className="page-header">
|
||||
@@ -109,11 +89,19 @@ export function WorkspacesPage() {
|
||||
)}
|
||||
|
||||
{startWorkspace && (
|
||||
<StartToolModal
|
||||
workspace={startWorkspace}
|
||||
onClose={() => setStartWorkspace(null)}
|
||||
onStart={handleStartTool}
|
||||
/>
|
||||
<div className="modal-overlay" onClick={() => setStartWorkspace(null)}>
|
||||
<div className="modal-content" onClick={(e) => e.stopPropagation()}>
|
||||
<h3>Start Tool</h3>
|
||||
<ToolStarter
|
||||
workspace={startWorkspace}
|
||||
onStarted={() => {
|
||||
setStartWorkspace(null);
|
||||
void refresh();
|
||||
}}
|
||||
onCancel={() => setStartWorkspace(null)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user