Queue server creation and verify health and selected map before completion
This commit is contained in:
@@ -66,7 +66,8 @@
|
||||
const [keysRes, serversRes] = await Promise.all([fetch('/api/server-keys'), fetch('/api/servers')]);
|
||||
if (!keysRes.ok || !serversRes.ok) throw new Error('Could not load saved keys and server slots. Reopen this dialog to retry.');
|
||||
savedIds = (await keysRes.json()).keys.map((k: { server_id: string }) => k.server_id);
|
||||
deployedIds = (await serversRes.json()).servers.map((s: { name: string }) => s.name);
|
||||
const fleet = await serversRes.json();
|
||||
deployedIds = [...fleet.servers.map((s: { name: string }) => s.name), ...(fleet.reservedNames ?? [])];
|
||||
keysLoaded = true;
|
||||
} catch (err) { flash = (err as Error).message; }
|
||||
}
|
||||
@@ -100,15 +101,15 @@
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ gameMode, mapSlug: selectedMap.slug, expectedName: previewName, plutoKey: plutoKey.trim() || undefined })
|
||||
});
|
||||
const body = (await res.json()) as { ok: boolean; name?: string; port?: number; error?: string; kind?: string };
|
||||
if (!body.ok || !body.name) {
|
||||
const body = (await res.json()) as { ok: boolean; name?: string; port?: number; deploymentId?: string; error?: string; kind?: string };
|
||||
if (!res.ok || !body.ok || !body.deploymentId) {
|
||||
flash = body.error ?? 'Deploy failed';
|
||||
if (body.kind === 'no-slot') await loadKeys();
|
||||
deploying = false;
|
||||
return;
|
||||
}
|
||||
close();
|
||||
await goto(`/servers/${encodeURIComponent(body.name)}`);
|
||||
await goto(`/deployments/${encodeURIComponent(body.deploymentId)}`);
|
||||
} catch (err) {
|
||||
flash = (err as Error).message;
|
||||
deploying = false;
|
||||
|
||||
Reference in New Issue
Block a user