[web] Design review: last row's menu not clipped, Hostname focused after loading, popover closes on Esc and outside click, phone engine chip in the top bar, paused and needs-attention copy with Restore in the panel, change bar offers and countdown, focus after share and kept, fingerprint check when signing by hand, draft kept through sign-in
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
import IntermediateBanner from "../components/IntermediateBanner.svelte";
|
||||
import { ApiError, del, get, post, sentence } from "../lib/api";
|
||||
import { app, navigate, refresh, secondsLeft, toast } from "../lib/app.svelte";
|
||||
import { shortDate, when } from "../lib/format";
|
||||
import { atTime, shortDate } from "../lib/format";
|
||||
import type { Bundle, CertsView, DeviceRow, PkiRequest } from "../lib/types";
|
||||
|
||||
let { newDevice }: { newDevice: boolean } = $props();
|
||||
@@ -120,7 +120,11 @@
|
||||
}
|
||||
|
||||
const lifetime = $derived(certs?.device_lifetime_days ?? 365);
|
||||
const until = $derived(shortDate(new Date(Date.now() + lifetime * 86_400_000).toISOString()));
|
||||
// The server caps it at the intermediate's end (Q7); without one it cannot issue anyway.
|
||||
const until = $derived(shortDate(certs?.device_valid_until ?? new Date(Date.now() + lifetime * 86_400_000).toISOString()));
|
||||
const capped = $derived(
|
||||
!!certs?.device_valid_until && Date.parse(certs.device_valid_until) < Date.now() + (lifetime - 1) * 86_400_000,
|
||||
);
|
||||
const intState = $derived.by((): [import("@ianitor/ui").StatusKind, string] => {
|
||||
switch (certs?.intermediate?.state) {
|
||||
case "ok": return ["healthy", "valid"];
|
||||
@@ -187,18 +191,18 @@
|
||||
<p class="ia-hint" id="device-name-h">Shown in this list and inside the certificate.</p>
|
||||
</div>
|
||||
<Segmented legend="What is it" name="kind" bind:value={kind} options={[{ value: "phone", label: "Phone or tablet" }, { value: "computer", label: "Computer" }, { value: "app", label: "Domi app" }]} />
|
||||
<p class="ia-hint">Valid for {lifetime} days, until {until}. It lets this device into hosts that ask for a Domi device certificate.</p>
|
||||
<p class="ia-hint">{#if capped}Valid until {until}, when the Domi intermediate certificate ends (renew it to issue for a full year).{:else}Valid for {lifetime} days, until {until}.{/if} It lets this device into hosts that ask for a Domi device certificate.</p>
|
||||
</form>
|
||||
{:else if request.state === "waiting"}
|
||||
<p class="ia-status" data-s="running"><Icon name="clock" /><strong>Waiting for approval</strong></p>
|
||||
<p>Approve it on the server, and only if it shows the same code:</p>
|
||||
<p>Custos cannot approve device certificates yet, so approve it on the server, and only if it shows the same code:</p>
|
||||
<p class="ia-code" aria-label="Match code {request.match_code}">{request.match_code}</p>
|
||||
{#if request.approve_command}<p class="ia-hint">Run on the server:</p><pre class="ia-secret ia-cmd">{request.approve_command}</pre>{/if}
|
||||
<p class="ia-muted">The request stays open for {Math.floor(secondsLeft(request.expires_at) / 60)}:{String(secondsLeft(request.expires_at) % 60).padStart(2, "0")}. Nothing is issued until it is approved.</p>
|
||||
<p class="ia-muted">The request stays open for 10 minutes ({Math.floor(secondsLeft(request.expires_at) / 60)}:{String(secondsLeft(request.expires_at) % 60).padStart(2, "0")} left). Nothing is issued until it is approved.</p>
|
||||
<div><Button onclick={cancelRequest}>Cancel request</Button></div>
|
||||
<span class="sr-only" aria-live="polite">Waiting for approval. Code {request.match_code}.</span>
|
||||
{:else if issuedDevice}
|
||||
<Banner tone="kept" live="status">{#snippet title()}<strong>{issuedDevice.name} has a certificate.</strong> Approved at {when(request?.approved_at, app.now)}.{/snippet}</Banner>
|
||||
<Banner tone="kept" live="status">{#snippet title()}<strong>{issuedDevice.name} has a certificate.</strong> Approved {atTime(request?.approved_at, app.now)}.{/snippet}</Banner>
|
||||
<div class="buttons">
|
||||
<Button variant="outline" onclick={() => install(issuedDevice, "qr")}>Show QR code</Button>
|
||||
<Button onclick={() => install(issuedDevice, "p12")}>Download file (.p12)</Button>
|
||||
|
||||
Reference in New Issue
Block a user