fix
This commit is contained in:
@@ -25,6 +25,21 @@
|
||||
/** The short version of a row's state, for the column that has room for three words.
|
||||
NOT called `state`: that shadows the `$state` rune in this file, and everything
|
||||
declared with it silently stops being reactive. */
|
||||
// The refresh is its own press, with its own password: it dumps a database operators are
|
||||
// using, so it must not be reachable by the same click that ships a code change.
|
||||
let refreshOpen = $state(false);
|
||||
let pgPassword = $state("");
|
||||
let tileRoot = $state("");
|
||||
const canRefresh = $derived(
|
||||
password.trim().length > 0 && (pgPassword.trim().length > 0 || tileRoot.trim().length > 0),
|
||||
);
|
||||
|
||||
async function refresh() {
|
||||
if (!canRefresh || busy) return;
|
||||
await launcher.refreshRun(password, pgPassword, tileRoot);
|
||||
pgPassword = "";
|
||||
}
|
||||
|
||||
/** `20260921T125618Z` -> `21 Sep 2026`; anything else is shown as it came. */
|
||||
function stamped(snapshot: string | null): string {
|
||||
if (!snapshot || snapshot.length < 8) return snapshot ?? "unknown";
|
||||
@@ -36,6 +51,13 @@
|
||||
return `${d} ${MONTHS[m - 1] ?? "?"} ${y}`;
|
||||
}
|
||||
|
||||
/** `20260423` -> `Apr 2026`. The vintage of the extract, not an age. */
|
||||
function monthOf(stamp: string): string {
|
||||
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
const m = Number(stamp.slice(4, 6));
|
||||
return `${MONTHS[m - 1] ?? "?"} ${stamp.slice(0, 4)}`;
|
||||
}
|
||||
|
||||
function aged(days: number | null): string {
|
||||
if (days === null) return "";
|
||||
if (days <= 0) return "today";
|
||||
@@ -97,10 +119,55 @@
|
||||
<div class="payload-row">
|
||||
<span class="payload-name">Map tiles</span>
|
||||
<span class="payload-val mono">{d.tile_sets} sets</span>
|
||||
<span class="payload-age" class:stale={(d.tiles_age_days ?? 0) > 90}>{aged(d.tiles_age_days)}</span>
|
||||
<!-- Deliberately NOT an age. Nothing records when tiles were baked, and the only
|
||||
date available is the upstream extract's, which said "161 days old" about
|
||||
work that is three weeks old. -->
|
||||
<span class="payload-age" class:stale={(d.basemap_vintage_days ?? 0) > 365}>
|
||||
{d.basemap_vintage ? `map data ${monthOf(d.basemap_vintage)}` : ""}
|
||||
</span>
|
||||
<span class="payload-size mono">{formatBytes(d.tile_bytes)}</span>
|
||||
</div>
|
||||
<span class="payload-foot mono">{d.tile_datasets.join(" · ")}</span>
|
||||
<span class="payload-foot">
|
||||
Tiles record no bake date, so only the source extract's vintage is known.
|
||||
</span>
|
||||
<div class="payload-act">
|
||||
<button class="btn-link" onclick={() => (refreshOpen = !refreshOpen)}>
|
||||
{refreshOpen ? "Never mind" : "Bring up to date…"}
|
||||
</button>
|
||||
</div>
|
||||
{#if refreshOpen}
|
||||
<div class="refresh">
|
||||
<p class="refresh-why">
|
||||
This rebuilds the seed from the live database and re-indexes the tiles. It
|
||||
<strong>publishes nothing</strong> — it prepares the inputs, and the console says how to cut a
|
||||
version from them.
|
||||
</p>
|
||||
<input
|
||||
class="input"
|
||||
type="password"
|
||||
autocomplete="off"
|
||||
placeholder="database password (Data PC) — leave empty to skip the seed"
|
||||
bind:value={pgPassword}
|
||||
disabled={busy}
|
||||
/>
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
placeholder="tile folder laid out as style\dataset — leave empty to skip the tiles"
|
||||
bind:value={tileRoot}
|
||||
disabled={busy}
|
||||
/>
|
||||
<div class="row">
|
||||
<span class="refresh-note">
|
||||
The seed is minutes of load on a database people are using. Uses the node password above.
|
||||
</span>
|
||||
<button class="btn" disabled={!canRefresh || busy} onclick={refresh}>Refresh</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if !d.is_live}
|
||||
<span class="payload-foot">Read from this PC's {d.version}, which is not what the DHP serves.</span>
|
||||
{/if}
|
||||
@@ -189,6 +256,33 @@
|
||||
.payload-age.stale {
|
||||
color: var(--warn);
|
||||
}
|
||||
.payload-act {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.refresh {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
.refresh-why,
|
||||
.refresh-note {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
font-size: var(--text-xs);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.refresh .row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.refresh .row .refresh-note {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.payload-foot {
|
||||
margin-top: 4px;
|
||||
color: var(--muted);
|
||||
|
||||
Reference in New Issue
Block a user