new destruction flow

This commit is contained in:
2026-09-17 16:57:08 -04:00
parent 5f8e03c693
commit a611850649
13 changed files with 349 additions and 96 deletions
@@ -1,7 +1,10 @@
import { json, error } from '@sveltejs/kit';
import { db } from '$lib/server/db/index.js';
import { getDeployment } from '$lib/server/fleet/deployments.js';
export async function GET({ params }: { params: { id: string } }) {
const lifecycle = getDeployment(params.id);
if (lifecycle) return json(lifecycle);
const dep = db()
.prepare('SELECT * FROM deployments WHERE id = ?')
.get(params.id) as Record<string, unknown> | undefined;
+3 -1
View File
@@ -1,3 +1,4 @@
import { kick } from '$lib/server/pipeline/worker.js';
import { json } from '@sveltejs/kit';
import { destroyServer } from '$lib/server/fleet/create.js';
@@ -11,5 +12,6 @@ export async function DELETE({ params }: { params: { name: string } }) {
const status = result.kind === 'not-found' ? 404 : 500;
return json({ ok: false, error: result.message, kind: result.kind, warnings: result.warnings }, { status });
}
return json({ ok: true, warnings: result.warnings });
void kick().catch((err) => console.error('[destroy] worker kick failed:', err));
return json({ ok: true, deploymentId: result.deploymentId }, { status: 202 });
}