fix(terminal): simplify REST endpoints to use instance_id only
The frontend router navigates to /instances/:instanceId/terminal without
project_id or repo_id. The backend terminal REST endpoints were requiring
these path params, causing 404s.
- Simplify _get_terminal_instance to validate by instance_id only
- Update all REST routes from /projects/{pid}/repositories/{rid}/instances/{iid}/terminal/*
to /instances/{instance_id}/terminal/*
- Update frontend API client to match new paths
- Update useTerminalSessions hook to take instanceId only
- Update TerminalPage to use simplified hook
- Update tests to match new paths
Fixes: 404 on GET /projects/repositories/instances/{id}/terminal/sessions
This commit is contained in:
@@ -18,9 +18,7 @@ const SESSIONS_TO_INFO = (sessions: TerminalSession[]): TerminalSessionInfo[] =>
|
||||
}));
|
||||
|
||||
export const TerminalPage: React.FC = () => {
|
||||
const { projectId, repoId, instanceId } = useParams<{
|
||||
projectId: string;
|
||||
repoId: string;
|
||||
const { instanceId } = useParams<{
|
||||
instanceId: string;
|
||||
}>();
|
||||
const navigate = useNavigate();
|
||||
@@ -39,7 +37,7 @@ export const TerminalPage: React.FC = () => {
|
||||
resetSession,
|
||||
loading,
|
||||
error,
|
||||
} = useTerminalSessions(projectId ?? "", repoId ?? "", instanceId ?? "");
|
||||
} = useTerminalSessions(instanceId ?? "");
|
||||
|
||||
// Auto-create default session if none exist
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user