diff --git a/packages/core/api/client.test.ts b/packages/core/api/client.test.ts index e665382b40..81ebab4dd6 100644 --- a/packages/core/api/client.test.ts +++ b/packages/core/api/client.test.ts @@ -234,21 +234,21 @@ describe("ApiClient", () => { ).resolves.toMatchObject({ id: "", status: "" }); }); - it("deleteCloudRuntimeNode sends DELETE with JSON body containing node id", async () => { + it("deleteCloudRuntimeNode sends DELETE with JSON body containing instance id", async () => { const fetchMock = vi.fn().mockResolvedValueOnce( new Response(null, { status: 204 }), ); vi.stubGlobal("fetch", fetchMock); const client = new ApiClient("https://api.example.test"); - await client.deleteCloudRuntimeNode("node-abc-123"); + await client.deleteCloudRuntimeNode("i-0123456789abcdef0"); expect(fetchMock).toHaveBeenCalledTimes(1); const [url, opts] = fetchMock.mock.calls[0]!; expect(url).toBe("https://api.example.test/api/cloud-runtime/nodes"); expect(opts).toMatchObject({ method: "DELETE", - body: JSON.stringify({ id: "node-abc-123" }), + body: JSON.stringify({ instance_id: "i-0123456789abcdef0" }), }); expect((opts.headers as Record)["Content-Type"]).toBe( "application/json", diff --git a/packages/core/api/client.ts b/packages/core/api/client.ts index 62d522123f..428fe0e4a8 100644 --- a/packages/core/api/client.ts +++ b/packages/core/api/client.ts @@ -806,10 +806,10 @@ export class ApiClient { ); } - async deleteCloudRuntimeNode(nodeId: string): Promise { + async deleteCloudRuntimeNode(instanceId: string): Promise { await this.fetchRaw("/api/cloud-runtime/nodes", { method: "DELETE", - body: JSON.stringify({ id: nodeId }), + body: JSON.stringify({ instance_id: instanceId }), extraHeaders: { "Content-Type": "application/json" }, }); } diff --git a/packages/core/runtimes/cloud-runtime.ts b/packages/core/runtimes/cloud-runtime.ts index 986b6e824f..bf27c7ffb7 100644 --- a/packages/core/runtimes/cloud-runtime.ts +++ b/packages/core/runtimes/cloud-runtime.ts @@ -83,7 +83,7 @@ export function useCreateCloudRuntimeNode(wsId: string) { export function useDeleteCloudRuntimeNode(wsId: string) { const qc = useQueryClient(); return useMutation({ - mutationFn: (nodeId: string) => api.deleteCloudRuntimeNode(nodeId), + mutationFn: (instanceId: string) => api.deleteCloudRuntimeNode(instanceId), onSettled: () => { qc.invalidateQueries({ queryKey: cloudRuntimeKeys.all(wsId) }); }, diff --git a/packages/views/runtimes/components/cloud-runtime-dialog.tsx b/packages/views/runtimes/components/cloud-runtime-dialog.tsx index 0064049390..f0d4254cb5 100644 --- a/packages/views/runtimes/components/cloud-runtime-dialog.tsx +++ b/packages/views/runtimes/components/cloud-runtime-dialog.tsx @@ -327,7 +327,7 @@ function CloudRuntimeNodeRow({ node, wsId }: { node: CloudRuntimeNode; wsId: str disabled={deleteNode.isPending} onClick={() => { if (!confirm(t(($) => $.cloud_runtime.delete_confirm))) return; - deleteNode.mutate(node.id, { + deleteNode.mutate(node.instance_id, { onSuccess: () => toast.success(t(($) => $.cloud_runtime.toast_deleted)), onError: (err) => toast.error(