fix
This commit is contained in:
+14
-2
@@ -14,6 +14,10 @@
|
||||
|
||||
let settingsOpen = $state(false);
|
||||
|
||||
// Dev mode drops the patch notes: they describe the INSTALLED version, which is not what
|
||||
// a dev run starts. With that column gone the art has the whole window to sit in.
|
||||
const dev = $derived(launcher.devOn);
|
||||
|
||||
onMount(() => launcher.start());
|
||||
</script>
|
||||
|
||||
@@ -21,8 +25,10 @@
|
||||
<KeyArt />
|
||||
<TitleBar onOpenSettings={() => (settingsOpen = true)} onOpenMarket={() => launcher.openMarket()} />
|
||||
|
||||
<main class="hub">
|
||||
<div class="news-slot"><NewsPanel /></div>
|
||||
<main class="hub" class:dev>
|
||||
{#if !dev}
|
||||
<div class="news-slot"><NewsPanel /></div>
|
||||
{/if}
|
||||
<div class="hero-slot"><Hero /></div>
|
||||
<div class="action-slot"><ActionPanel /></div>
|
||||
</main>
|
||||
@@ -69,6 +75,12 @@
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* No notes column in dev mode: it collapses rather than being hidden, so the hero and the
|
||||
action panel keep the places they have everywhere else. */
|
||||
.hub.dev {
|
||||
grid-template-columns: 0 minmax(0, 1fr) minmax(360px, 404px);
|
||||
}
|
||||
|
||||
.hero-slot {
|
||||
grid-row: 1;
|
||||
grid-column: 2 / span 2;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 190 KiB |
@@ -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 & 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;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
const art = $derived(launcher.devOn ? keyartDev : keyart);
|
||||
</script>
|
||||
|
||||
<div class="keyart" aria-hidden="true">
|
||||
<div class="keyart" class:dev={launcher.devOn} aria-hidden="true">
|
||||
<div class="frame">
|
||||
<img class="art" src={art} alt="" draggable="false" />
|
||||
</div>
|
||||
@@ -71,9 +71,29 @@
|
||||
radial-gradient(120% 100% at 62% 50%, transparent 58%, rgba(9, 9, 11, 0.5) 100%);
|
||||
}
|
||||
|
||||
/* Dev mode has no notes panel, so the picture gets the whole window and is centred in
|
||||
it - and the left-edge fade goes with the panel it was hiding a seam against. */
|
||||
.keyart.dev .frame {
|
||||
left: 0;
|
||||
-webkit-mask-image: none;
|
||||
mask-image: none;
|
||||
}
|
||||
|
||||
/* The dev picture is 3:2 in a window that is wider than that, so what gets cut is HEIGHT
|
||||
- 11% of it at the default size. Taken off the middle it clips the top of her head and
|
||||
the wordmark; taken mostly off the bottom it costs foreground crates the action panel
|
||||
half-covers anyway. Hence 30% rather than centre. The other picture keeps its own
|
||||
framing: it was placed against the notes panel, which dev mode does not draw. */
|
||||
.keyart.dev .art {
|
||||
object-position: 50% 30%;
|
||||
}
|
||||
|
||||
@media (max-width: 1140px) {
|
||||
.frame {
|
||||
left: 384px;
|
||||
}
|
||||
.keyart.dev .frame {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
SignInResult,
|
||||
StackEvent,
|
||||
Status,
|
||||
ReleasePlan,
|
||||
RemoveProgress,
|
||||
SyncConflict,
|
||||
TileSyncProgress,
|
||||
@@ -70,6 +71,8 @@ function createTauriBackend(): Backend {
|
||||
|
||||
onStatus: (handler) => subscribe<Status>("status", handler),
|
||||
onInstallProgress: (handler) => subscribe<InstallProgress>("install-progress", handler),
|
||||
releasePlan: () => invoke<ReleasePlan>("release_plan"),
|
||||
releaseRun: (password, withApi) => invoke<void>("release_run", { password, withApi }),
|
||||
onTileSyncProgress: (handler) => subscribe<TileSyncProgress>("tile-sync-progress", handler),
|
||||
onRemoveProgress: (handler) => subscribe<RemoveProgress>("remove-progress", handler),
|
||||
onStack: (handler) => subscribe<StackEvent>("stack", handler),
|
||||
|
||||
@@ -10,6 +10,7 @@ import type {
|
||||
LogLevel,
|
||||
Market,
|
||||
Phase,
|
||||
ReleasePlan,
|
||||
Settings,
|
||||
StackComponent,
|
||||
StackEvent,
|
||||
@@ -402,6 +403,24 @@ class Launcher {
|
||||
return this.launch();
|
||||
}
|
||||
|
||||
/** What a release could do right now; null until the panel asks. */
|
||||
release = $state<ReleasePlan | null>(null);
|
||||
releaseOpen = $state(false);
|
||||
|
||||
async loadRelease() {
|
||||
this.release = null;
|
||||
await this.run("release", async () => {
|
||||
this.release = await backend.releasePlan();
|
||||
});
|
||||
}
|
||||
|
||||
releaseRun(password: string, withApi: boolean) {
|
||||
return this.run("release", async () => {
|
||||
await backend.releaseRun(password, withApi);
|
||||
this.releaseOpen = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** Change part of the settings and save, for the dev controls on the hub. */
|
||||
setDev(change: Partial<Settings>) {
|
||||
const current = this.settings;
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
type MarketItem,
|
||||
type MockControls,
|
||||
type MockScenario,
|
||||
type ReleasePlan,
|
||||
type Settings,
|
||||
type SignInResult,
|
||||
type StackComponent,
|
||||
@@ -761,6 +762,31 @@ class MockBackend implements Backend {
|
||||
return asked && asked !== this.status.operator ? asked : null;
|
||||
}
|
||||
|
||||
async releasePlan(): Promise<ReleasePlan> {
|
||||
await this.wait(200);
|
||||
const dev = this.status.dev !== null;
|
||||
return {
|
||||
docker: dev,
|
||||
online: this.status.online,
|
||||
scripts: dev,
|
||||
blocked: this.status.online ? null : "The DHP is not answering: nothing can be published.",
|
||||
items: [
|
||||
{ key: "pack", title: "ODIAN", live: this.status.available, commit: "a1b2c3d", behind: true,
|
||||
dirty: false, note: "behind: the repo has moved past what is published" },
|
||||
{ key: "launcher", title: "Launcher", live: "0.1.38", commit: "e4f5a6b", behind: false,
|
||||
dirty: false, note: "up to date" },
|
||||
{ key: "api", title: "Engine API", live: null, commit: "a1b2c3d", behind: null,
|
||||
dirty: false, note: "what is published does not say which commit it came from" },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
async releaseRun(password: string, withApi: boolean): Promise<void> {
|
||||
await this.wait(400);
|
||||
if (!password.trim()) throw "The node's sudo password is needed to cut a pack and to roll the API.";
|
||||
this.log("info", `Release started in its own window (browser mock: nothing runs). API: ${withApi}`);
|
||||
}
|
||||
|
||||
async syncNow(): Promise<void> {
|
||||
if (!this.status.online) throw "Your DHP is unreachable: changes stay on this PC until the next connected sync.";
|
||||
if (this.status.phase !== "idle" && this.status.phase !== "error") throw "ODIAN is busy: sync once it has stopped.";
|
||||
|
||||
@@ -285,6 +285,27 @@ export interface WindowControls {
|
||||
onResized(handler: () => void): Promise<Unlisten>;
|
||||
}
|
||||
|
||||
/** What a release could do right now (dev mode only). */
|
||||
export interface ReleaseItem {
|
||||
key: string;
|
||||
title: string;
|
||||
live: string | null;
|
||||
commit: string | null;
|
||||
/** true = the repo has moved past what is published; null = nothing published says. */
|
||||
behind: boolean | null;
|
||||
dirty: boolean;
|
||||
note: string;
|
||||
}
|
||||
|
||||
export interface ReleasePlan {
|
||||
docker: boolean;
|
||||
online: boolean;
|
||||
scripts: boolean;
|
||||
items: ReleaseItem[];
|
||||
/** Why a release cannot run at all; null when it can. */
|
||||
blocked: string | null;
|
||||
}
|
||||
|
||||
export const DEV_TARGETS = ["client", "web", "both"] as const;
|
||||
export type DevTarget = (typeof DEV_TARGETS)[number];
|
||||
|
||||
@@ -352,6 +373,8 @@ export interface Backend {
|
||||
syncNow(): Promise<void>;
|
||||
/** Take the tiles the DHP baked while this PC was away. */
|
||||
syncTiles(): Promise<void>;
|
||||
releasePlan(): Promise<ReleasePlan>;
|
||||
releaseRun(password: string, withApi: boolean): Promise<void>;
|
||||
/** What the operator has to decide, oldest first. */
|
||||
getSyncConflicts(): Promise<SyncConflict[]>;
|
||||
/** Records one decision; resolves with what is left to decide. */
|
||||
|
||||
Reference in New Issue
Block a user