fix(ui): settings pages show a skeleton or the error until their draft loads (#1743)
Quality / check (push) Successful in 7m32s
deploy / gate (push) Successful in 4m59s
deploy / archied-image (push) Successful in 3m27s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

New settings/KindGate renders the store's per-kind loading/error state
where the form would be: a skeleton while loading, ReadError with Retry
on a failed read. Wired into Tools, SystemModels, SystemRepos,
SchedulingPolicy, ContainerRuntime, OrgAlerts, Instructions, Plugins,
SystemTasks, UpdateSettings, IdentityGrants, OrgModels, Channels and
Authentication pages, which no longer render blank until the draft
exists.
This commit is contained in:
sam committed 2026-11-07 00:42:28 +11:00
1 parent f37f6e2453
commit c6f70de82d
16 files changed
+60 -3

No files matched your search

+6 -3
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Alert, AlertDescription } from "@/components/ui/alert";
import { ReadError } from "@/components/ui/read-error";
import { Skeleton } from "@/components/ui/skeleton";
import { Check } from "@lucide/vue";
import { computed, onMounted, ref } from "vue";
import PageHeader from "@/base/PageHeader.vue";
@@ -11,13 +12,15 @@ import { SettingRow } from "@/components/ui/setting-row";
import { Section } from "@/components/ui/section";
interface Settings {public_url:string;oidc_issuer:string;oidc_audience:string;oidc_client_id:string}
const value=ref<Settings>({public_url:"",oidc_issuer:"",oidc_audience:"",oidc_client_id:""});const loaded=ref(false);const error=ref("");const sessionExpired=ref(false);const busy=ref(false);const saved=ref(false);
onMounted(async()=>{try{value.value=await api.authentication<Settings>();loaded.value=true}catch(cause){error.value=String((cause as Error).message||cause)}});
async function load(){try{value.value=await api.authentication<Settings>();loaded.value=true;error.value=""}catch(cause){error.value=String((cause as Error).message||cause)}finally{loaded.value=true}}
onMounted(load);
const redirectURI=computed(()=>`${value.value.public_url.replace(/\/$/,"")}/oauth2/callback`);
async function save(){busy.value=true;error.value="";saved.value=false;try{await api.saveAuthentication(value.value);saved.value=true}catch(cause){error.value=String((cause as Error).message||cause);sessionExpired.value=classifyActionError(cause).kind==="session-expired"}finally{busy.value=false}}
</script>
<template>
<div><PageHeader title="Authentication"/>
<Alert v-if="error" variant="destructive" class="mb-4"><AlertDescription>{{error}}<a v-if="sessionExpired" class="underline" href="/?reauth=1"> Sign in again</a></AlertDescription></Alert>
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-4" @retry="load"><a v-if="sessionExpired" class="underline" href="/?reauth=1"> Sign in again</a></ReadError>
<div v-else-if="!loaded" role="status" aria-label="Loading settings" class="space-y-2 py-2"><Skeleton class="h-8 w-full" /><Skeleton class="h-8 w-full" /><Skeleton class="h-24 w-full" /></div>
<form v-if="loaded" @submit.prevent="save">
<Section title="Instance URL">
<SettingRow label="Public address" for="instance-url" hint="Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed."><Input id="instance-url" v-model="value.public_url" type="url" required /></SettingRow>
+2
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Alert, AlertDescription } from "@/components/ui/alert";
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
import KindGate from "@/settings/KindGate.vue";
import HistoryLink from "@/settings/HistoryLink.vue";
import { computed, onMounted, reactive, ref } from "vue";
import { storeToRefs } from "pinia";
@@ -230,6 +231,7 @@ function setModels(list: string[]) {
</Section>
<Section v-if="instance" title="Chat session defaults">
<KindGate v-if="!form" :kind="KIND" />
<FieldGroup v-if="form" class="@container/field-group">
<form.Field v-slot="{ field }" name="workspace">
<Field orientation="responsive">
@@ -14,6 +14,7 @@ const emit = defineEmits<{ retry: [] }>();
<Alert variant="destructive">
<AlertDescription class="flex flex-wrap items-center gap-2">
<span class="min-w-0 flex-1">{{ message }}</span>
<slot />
<Button v-if="retryLabel" variant="link" size="xs" class="shrink-0 px-0" @click="emit('retry')">{{ retryLabel }}</Button>
</AlertDescription>
</Alert>
+3
View File
@@ -11,6 +11,7 @@ import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { useSettingsStore } from "@/stores/settings";
import DraftHint from "@/settings/DraftHint.vue";
import KindGate from "@/settings/KindGate.vue";
/**
* The org's own models: aliases over the instance's, and providers the
* instance admin lets it add. The server refuses a model the org may not use,
@@ -75,6 +76,8 @@ const bound = computed(() => new Set(((store.draftValue("credential-bindings") a
<PageHeader title="Models" />
<Alert v-for="e in errors" :key="String(e)" variant="destructive" class="mb-4"><AlertDescription>{{ e }}</AlertDescription></Alert>
<KindGate v-if="!aliases && !providers" kind="provider-settings" />
<template v-if="aliases">
<Section title="Aliases">
<div v-for="[alias, model] in aliasEntries" :key="alias" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
+2
View File
@@ -21,6 +21,7 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import KindGate from "./KindGate.vue";
import { fieldInvalid } from "./settings-form";
const KIND = "container-runtime-policies";
@@ -79,6 +80,7 @@ function formatHours(seconds: number): string {
<Alert v-if="catalogError || error" variant="destructive" class="mb-4"><AlertDescription>{{ catalogError || error }}</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<FieldGroup v-if="form" class="@container/field-group">
<form.Field v-slot="{ field }" name="image">
<Field orientation="responsive" :data-invalid="fieldInvalid(field)">
+2
View File
@@ -11,6 +11,7 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { useOrgStore } from "@/stores/org";
import { useSettingsStore } from "@/stores/settings";
import DraftHint from "./DraftHint.vue";
import KindGate from "./KindGate.vue";
/** The identity-grants document: the default credential services,
* and per identity a list that replaces the default. */
@@ -53,6 +54,7 @@ function removeIdentity(id: string) {
<template>
<Section title="Credential grants">
<Alert v-if="error" variant="destructive" class="mb-3"><AlertDescription>{{ error }}</AlertDescription></Alert>
<KindGate v-if="!grants" :kind="KIND" />
<ItemGroup v-if="grants">
<Item as="div" role="listitem" variant="outline" size="sm" class="flex-wrap">
<span class="w-40 shrink-0 text-label max-sm:w-24 max-sm:truncate">Default</span>
+2
View File
@@ -10,6 +10,7 @@ import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import { Section } from "@/components/ui/section";
import DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import KindGate from "./KindGate.vue";
import { fieldInvalid } from "./settings-form";
const KIND = "soul";
@@ -36,6 +37,7 @@ const chars = computed(() => soul.value?.text.length ?? 0);
{{ catalogError || error }}
</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<Section v-if="form && soul">
<form.Field v-slot="{ field }" name="text">
<div class="flex justify-end">
+26
View File
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { computed } from "vue";
import { ReadError } from "@/components/ui/read-error";
import { Skeleton } from "@/components/ui/skeleton";
import { useSettingsStore } from "@/stores/settings";
/**
* What a settings page shows until its kind's draft has loaded: the read
* error with Retry, else a skeleton. The store already tracks loading and
* error per kind; this renders them where the form would be.
*/
const props = defineProps<{ kind: string }>();
const store = useSettingsStore();
const state = computed(() => store.stateFor(props.kind));
const error = computed(() => store.pageErrorFor(props.kind));
</script>
<template>
<ReadError v-if="!state.resource && error" :message="error" retry-label="Retry" @retry="store.load()" />
<div v-else role="status" aria-label="Loading settings" class="space-y-2 py-2">
<Skeleton class="h-8 w-full" />
<Skeleton class="h-8 w-full" />
<Skeleton class="h-24 w-full" />
</div>
</template>
+2
View File
@@ -13,6 +13,7 @@ import { useSessionStore } from "@/stores/session";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import KindGate from "./KindGate.vue";
import SecretRefField from "./SecretRefField.vue";
const POLICY = "task-policy";
@@ -40,6 +41,7 @@ const policy = computed(() => store.draftValue(POLICY));
{{ catalogError || store.pageErrorFor(POLICY) }}
</AlertDescription></Alert>
<KindGate v-if="!form" :kind="POLICY" />
<FieldGroup v-if="form && policy" class="@container/field-group">
<form.Field v-slot="{ field }" name="notify_webhook">
<Field orientation="responsive">
+2
View File
@@ -10,6 +10,7 @@ import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import ApplyStatusRows from "./ApplyStatusRows.vue";
import DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import KindGate from "./KindGate.vue";
import { fieldInvalid } from "./settings-form";
const KIND = "plugin-settings";
@@ -31,6 +32,7 @@ const error = computed(() => store.pageErrorFor(KIND));
<Alert v-if="catalogError || error" variant="destructive" class="mb-4"><AlertDescription>{{ catalogError || error }}</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<template v-if="form">
<FieldGroup class="@container/field-group">
<form.Field v-slot="{ field }" name="skills_dir">
+1
View File
@@ -62,6 +62,7 @@ const triggers = [
{{ catalogError || error }}
</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<template v-if="form">
<Section title="Dispatch">
<FieldGroup class="@container/field-group">
+3
View File
@@ -2,6 +2,7 @@
import { Label } from "@/components/ui/label";
import { Alert, AlertDescription } from "@/components/ui/alert";
import ApplyStatusRows from "./ApplyStatusRows.vue";
import KindGate from "./KindGate.vue";
import { computed, onMounted, ref, watch } from "vue";
import { storeToRefs } from "pinia";
import { Plus, Trash2 } from "@lucide/vue";
@@ -168,6 +169,8 @@ function setAllowed(id: string, text: string) {
{{ e }}
</AlertDescription></Alert>
<KindGate v-if="!aliases && !providers" kind="provider-settings" />
<template v-if="aliases">
<Section title="Aliases">
<p v-if="!aliases.default" class="mb-3 text-label text-warn" role="alert">Set the default alias.</p>
+2
View File
@@ -42,6 +42,7 @@ import CardAccordion from "./CardAccordion.vue";
import CommandListEditor from "./CommandListEditor.vue";
import DraftHint from "./DraftHint.vue";
import HistoryLink from "./HistoryLink.vue";
import KindGate from "./KindGate.vue";
const KIND = "repository-policies";
@@ -147,6 +148,7 @@ async function checkAccess(repo:Repo):Promise<void>{
<Alert v-if="catalogError || error" variant="destructive" class="mb-4"><AlertDescription>{{ catalogError || error }}</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<template v-if="form">
<CardAccordion v-model:open="open" :items="repos" :title="(r) => `${r.owner}/${r.name}`" remove-label="Remove" mono @remove="removeRepo">
<template #aside="{ item }">
+3
View File
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Alert, AlertDescription } from "@/components/ui/alert";
import ApplyStatusRows from "./ApplyStatusRows.vue";
import KindGate from "./KindGate.vue";
import { computed, onMounted, ref } from "vue";
import { RotateCcw } from "@lucide/vue";
import { storeToRefs } from "pinia";
@@ -89,6 +90,8 @@ async function restoreWorkflows(): Promise<void> {
{{ catalogError || error }}
</AlertDescription></Alert>
<KindGate v-if="!limitsForm" :kind="KIND" />
<FieldGroup v-if="limitsForm && limits" class="@container/field-group">
<limitsForm.Field v-slot="{ field }" name="max_task_runtime_seconds">
<Field orientation="responsive">
+1
View File
@@ -99,6 +99,7 @@ function looseNumber(value: string | number): number | string {
{{ catalogError || error }}
</AlertDescription></Alert>
<KindGate v-if="!form" :kind="KIND" />
<template v-if="form && tools">
<Section title="MCP servers">
<div class="grid gap-3">
+2
View File
@@ -8,6 +8,7 @@ import { Input } from "@/components/ui/input";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { useSettingsStore } from "@/stores/settings";
import { fieldInvalid } from "./settings-form";
import KindGate from "./KindGate.vue";
const KIND = "update-settings";
type UpdateSettings = { channel: string; pin: string };
@@ -27,6 +28,7 @@ const channels = [
</script>
<template>
<KindGate v-if="!form" :kind="KIND" />
<Section v-if="form" title="Updates">
<Alert v-if="error" variant="destructive" class="mb-2"><AlertDescription>{{ error }}</AlertDescription></Alert>
<FieldGroup class="@container/field-group">