fix(sessions): auto-start instances and add delete button
- Auto-start instances after creation from Sessions page - Add delete button to Active Sessions section - Fix instances remaining in 'pending' status
This commit is contained in:
@@ -4,7 +4,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { listProjects } from "../api/projects";
|
import { listProjects } from "../api/projects";
|
||||||
import type { Project } from "../types";
|
import type { Project } from "../types";
|
||||||
import { listRepositories, type GitRepository } from "../api/git_repositories";
|
import { listRepositories, type GitRepository } from "../api/git_repositories";
|
||||||
import { getUserSessions, type Session, deleteInstance, stopInstance } from "../api/sessions";
|
import { getUserSessions, type Session, deleteInstance, stopInstance, startInstance } from "../api/sessions";
|
||||||
import { listToolTypes, type ToolType } from "../api/tool_types";
|
import { listToolTypes, type ToolType } from "../api/tool_types";
|
||||||
import { createInstance } from "../api/sessions";
|
import { createInstance } from "../api/sessions";
|
||||||
import { getUserConfig, updateUserConfig } from "../api/settings";
|
import { getUserConfig, updateUserConfig } from "../api/settings";
|
||||||
@@ -123,6 +123,10 @@ export const SessionsPage = () => {
|
|||||||
selectedToolType,
|
selectedToolType,
|
||||||
displayName || undefined
|
displayName || undefined
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Auto-start the instance
|
||||||
|
await startInstance(selectedProject, selectedRepo, instance.id);
|
||||||
|
|
||||||
await updateUserConfig({ last_session_id: instance.id });
|
await updateUserConfig({ last_session_id: instance.id });
|
||||||
setCreateStatus("idle");
|
setCreateStatus("idle");
|
||||||
setSelectedProject("");
|
setSelectedProject("");
|
||||||
@@ -296,6 +300,19 @@ export const SessionsPage = () => {
|
|||||||
<Icon name="stop" size="sm" />
|
<Icon name="stop" size="sm" />
|
||||||
Stop
|
Stop
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className="ghost-button small danger-text"
|
||||||
|
onClick={() =>
|
||||||
|
void handleDelete(
|
||||||
|
session.id,
|
||||||
|
projects.find((p) => p.name === session.project_name)?.id ?? "",
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<Icon name="delete" size="sm" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user