This commit is contained in:
Kelorastus
2026-09-30 10:53:46 +02:00
parent 58ebd1dded
commit ffbb8fc9a5
12 changed files with 619 additions and 25 deletions
+147 -22
View File
@@ -102,6 +102,7 @@
const devRoot = $derived(launcher.settings?.dev_root ?? "");
const devTarget = $derived(launcher.settings?.dev_target ?? "client");
const devBuild = $derived(launcher.settings?.dev_build ?? false);
const devUserField = $derived(launcher.settings?.dev_user ?? "");
const savingDev = $derived(busy === "settings");
// One stack either way: both clients talk to the same API and the same database, which is
// the only way a .exe/web divergence is visible at all.
@@ -111,6 +112,24 @@
{ key: "both", name: "Both", note: "one stack" },
] as const;
// ---- releasing ------------------------------------------------------------
const plan = $derived(launcher.release);
const releasing = $derived(busy === "release");
let releaseOpen = $state(false);
let nodePassword = $state("");
let withApi = $state(true);
async function openRelease() {
releaseOpen = true;
await launcher.loadRelease();
}
async function doRelease() {
await launcher.releaseRun(nodePassword, withApi);
nodePassword = ""; // held for the one run, never kept
releaseOpen = false;
}
async function browseCheckout() {
const path = await launcher.pickFolder();
if (path) await launcher.setDev({ dev_root: path });
@@ -281,26 +300,85 @@
<button type="button" class="btn" disabled={blocked || savingDev} onclick={browseCheckout}>Browse…</button>
</div>
<div class="dev-row wrap">
<label class="dev-check">
<input
type="checkbox"
checked={devBuild}
disabled={blocked || savingDev}
onchange={(e) => launcher.setDev({ dev_build: e.currentTarget.checked })}
/>
<span>Build first</span>
</label>
{#if s?.online}
<!-- The stack is the install's, so its tiles and its data are still worth
refreshing from the DHP while there is a line to it. -->
<button class="btn-link" disabled={blocked} onclick={() => launcher.syncTiles()}>Sync tiles</button>
<button class="btn-link" disabled={blocked} onclick={() => launcher.syncNow()}>Sync database</button>
{:else}
<span class="dev-offline mono">offline — tiles and data stay as they are</span>
<div class="dev-row">
<label class="dev-label" for="dev-run-as">Run as</label>
<input
id="dev-run-as"
class="dev-path"
type="text"
spellcheck="false"
autocomplete="off"
placeholder={s?.operator ?? "the operator who signed in"}
value={devUserField}
disabled={blocked || savingDev}
onchange={(e) => launcher.setDev({ dev_user: e.currentTarget.value.trim() })}
/>
</div>
<div class="dev-row">
<button class="btn dev-release" disabled={blocked || !s?.online} onclick={openRelease}>
Build &amp; deploy…
</button>
{#if !s?.online}
<span class="dev-note">needs the DHP</span>
{/if}
</div>
{#if releaseOpen}
<div class="dev-release-panel">
{#if releasing && !plan}
<p class="dev-note">Looking at what is live and what this PC holds…</p>
{:else if plan}
<ul class="dev-plan">
{#each plan.items as row (row.key)}
<li class:behind={row.behind === true} class:dirty={row.dirty}>
<span class="dev-plan-name">{row.title}</span>
<span class="dev-plan-live mono">{row.live ?? "—"}</span>
<span class="dev-plan-note">{row.note}</span>
</li>
{/each}
</ul>
<div class="dev-checks mono">
<span class:ok={plan.online}>DHP {plan.online ? "✓" : "✗"}</span>
<span class:ok={plan.docker}>Docker {plan.docker ? "✓" : "✗"}</span>
<span class:ok={plan.scripts}>scripts {plan.scripts ? "✓" : "✗"}</span>
</div>
{#if plan.blocked}
<p class="dev-note attention">{plan.blocked}</p>
{:else}
<label class="dev-check">
<input type="checkbox" bind:checked={withApi} disabled={!plan.docker || releasing} />
<span>Also roll the Engine API{plan.docker ? "" : " (needs Docker)"} — logs everyone out</span>
</label>
<div class="dev-row">
<input
class="dev-path"
type="password"
placeholder="node sudo password"
bind:value={nodePassword}
disabled={releasing}
/>
<button class="btn" disabled={releasing || !nodePassword.trim()} onclick={doRelease}>Release</button>
</div>
<p class="dev-note">
Runs in its own window. Each step decides for itself whether it has anything to do.
</p>
{/if}
{/if}
<button class="btn-link" onclick={() => (releaseOpen = false)}>Close</button>
</div>
{/if}
<label class="dev-check">
<input
type="checkbox"
checked={devBuild}
disabled={blocked || savingDev}
onchange={(e) => launcher.setDev({ dev_build: e.currentTarget.checked })}
/>
<span>Build first</span>
</label>
{#if !devRun}
<p class="dev-note">Name the folder that holds <code>ODIAN_Engine</code> and Launch runs from it.</p>
{:else if devUser}
@@ -532,10 +610,6 @@
align-items: center;
gap: 0.4rem;
}
.dev-row.wrap {
flex-wrap: wrap;
row-gap: 0.3rem;
}
.dev-path {
flex: 1 1 auto;
min-width: 0;
@@ -547,6 +621,11 @@
border: 1px solid var(--line, #2a3139);
border-radius: 6px;
}
.dev-label {
flex: none;
font-size: 0.78rem;
color: var(--text-dim, #9aa3ad);
}
.dev-check {
display: inline-flex;
align-items: center;
@@ -554,7 +633,6 @@
font-size: 0.8rem;
white-space: nowrap;
}
.dev-offline,
.dev-note {
font-size: 0.75rem;
color: var(--text-dim, #9aa3ad);
@@ -563,6 +641,53 @@
.dev-note code {
font-size: 0.72rem;
}
.dev-release {
font-weight: 600;
}
.dev-release-panel {
display: flex;
flex-direction: column;
gap: 0.4rem;
padding: 0.5rem;
border: 1px solid var(--line, #2a3139);
border-radius: 6px;
background: rgba(0, 0, 0, 0.25);
}
.dev-plan {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.dev-plan li {
display: grid;
grid-template-columns: 5.5rem 4.5rem 1fr;
gap: 0.4rem;
align-items: baseline;
font-size: 0.76rem;
color: var(--text-dim, #9aa3ad);
}
.dev-plan li.behind .dev-plan-name {
color: #46d17f;
}
.dev-plan li.dirty .dev-plan-note {
color: #e6b35a;
}
.dev-plan-name {
font-weight: 600;
color: inherit;
}
.dev-checks {
display: flex;
gap: 0.7rem;
font-size: 0.72rem;
color: #e06c6c;
}
.dev-checks span.ok {
color: #46d17f;
}
.action {
display: grid;