refactor(ui): Empty, Spinner and Label replace hand-built equivalents

This commit is contained in:
sam committed 2026-10-26 22:11:39 +11:00
1 parent 17c07a31fe
commit a203cbc03b
37 files changed
+215 -193

No files matched your search

+3 -2
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Label } from "@/components/ui/label";
import { Plus } from "@lucide/vue";
import { computed, onMounted } from "vue";
@@ -116,7 +117,7 @@ const unavailable = computed(() => !!connection.value.type && !extensions.forges
<SelectItem v-if="identity && !choosableIdentities(connection, org.activeIdentities, identity).some((a) => a.id === identity)" :value="identity">{{ org.identityName(identity) }} · unavailable</SelectItem>
</SelectGroup></SelectContent>
</Select>
<label
<Label
v-for="operation in OPERATIONS"
:key="operation"
class="flex items-center gap-2 text-sm"
@@ -127,7 +128,7 @@ const unavailable = computed(() => !!connection.value.type && !extensions.forges
@update:model-value="(on: boolean) => (connection = toggleOperation(connection, identity, operation, on))"
/>
<span class="font-mono text-xs">{{ operation }}</span>
</label>
</Label>
<Button variant="ghost" size="sm" @click="connection = removePermit(connection, identity)">
Remove
</Button>
+13 -12
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Label } from "@/components/ui/label";
import { computed, useId } from "vue";
import { Trash2 } from "@lucide/vue";
@@ -76,10 +77,10 @@ const args = computed({
</div>
<template v-if="transport === 'stdio'">
<label class="grid gap-1 text-xs text-fg-subtle">Command
<Label class="grid gap-1 text-xs text-fg-subtle">Command
<Input :model-value="server.command"
@update:model-value="(value: string | number) => patch({ command: String(value) })" class="font-mono" placeholder="npx" />
</label>
</Label>
<div class="grid gap-1 text-xs text-fg-subtle">
<span :id="`${id}-args`">Arguments</span>
<TagsInput v-model="args" :aria-labelledby="`${id}-args`" class="font-mono">
@@ -90,29 +91,29 @@ const args = computed({
<TagsInputInput placeholder="Add argument" />
</TagsInput>
</div>
<label class="grid gap-1 text-xs text-fg-subtle">Working directory
<Label class="grid gap-1 text-xs text-fg-subtle">Working directory
<Input :model-value="server.work_dir"
@update:model-value="(value: string | number) => patch({ work_dir: String(value) })" class="font-mono" placeholder="the daemon's working directory" />
</label>
</Label>
</template>
<label v-else-if="transport === 'http'" class="grid gap-1 text-xs text-fg-subtle">URL
<Label v-else-if="transport === 'http'" class="grid gap-1 text-xs text-fg-subtle">URL
<Input :model-value="server.url"
@update:model-value="(value: string | number) => patch({ url: String(value) })" class="font-mono" placeholder="https://host/mcp" />
</label>
</Label>
<template v-else>
<label class="grid gap-1 text-xs text-fg-subtle">SSE endpoint
<Label class="grid gap-1 text-xs text-fg-subtle">SSE endpoint
<Input :model-value="server.sse_endpoint"
@update:model-value="(value: string | number) => patch({ sse_endpoint: String(value) })" class="font-mono" />
</label>
<label class="grid gap-1 text-xs text-fg-subtle">Message endpoint
</Label>
<Label class="grid gap-1 text-xs text-fg-subtle">Message endpoint
<Input :model-value="server.message_endpoint"
@update:model-value="(value: string | number) => patch({ message_endpoint: String(value) })" class="font-mono" />
</label>
</Label>
</template>
<label class="flex items-center gap-2 text-sm">
<Label class="flex items-center gap-2 text-sm">
<Switch :model-value="server.parallel_tool_calls" @update:model-value="(value: boolean) => patch({ parallel_tool_calls: value })" />
Parallel tool calls</label>
Parallel tool calls</Label>
</div>
</Section>
</template>
+2 -1
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Spinner } from "@/components/ui/spinner";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { onMounted } from "vue";
@@ -24,5 +25,5 @@ useIntervalFn(store.load, 15_000);
<TableHeader><TableRow><TableHead>Engine</TableHead><TableHead>Version</TableHead><TableHead>Source</TableHead></TableRow></TableHeader>
<TableBody><TableRow v-for="engine in store.engines" :key="engine.name"><TableCell class="font-mono">{{ engine.name }}</TableCell><TableCell class="font-mono">{{ engine.version || '–' }}</TableCell><TableCell>{{ engine.source }}</TableCell></TableRow></TableBody>
</Table>
<p v-else class="text-sm text-fg-subtle" role="status">Loading engine report…</p>
<p v-else class="flex items-center gap-2 text-sm text-fg-subtle"><Spinner />Loading engine report…</p>
</template>
+5 -4
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Label } from "@/components/ui/label";
import { computed, ref, watch } from "vue";
import { useIntervalFn } from "@vueuse/core";
@@ -67,7 +68,7 @@ async function check() {
/>
</div>
<div v-else class="flex flex-wrap items-end gap-2">
<label class="grid gap-1 text-xs text-fg-subtle">Engine
<Label class="grid gap-1 text-xs text-fg-subtle">Engine
<Select :model-value="model.engine" :disabled="disabled" @update:model-value="(engine) => patch({ engine: String(engine ?? '') })">
<SelectTrigger :id="`${idPrefix}-engine`" class="font-mono"><SelectValue placeholder="Choose engine" /></SelectTrigger>
<SelectContent><SelectGroup>
@@ -75,10 +76,10 @@ async function check() {
<SelectItem v-if="model.engine && (missing || engines.engines === null)" :value="model.engine">{{ model.engine }}{{ missing ? ' · not installed' : '' }}</SelectItem>
</SelectGroup></SelectContent>
</Select>
</label>
<label class="grid min-w-48 flex-1 gap-1 text-xs text-fg-subtle">Key
</Label>
<Label class="grid min-w-48 flex-1 gap-1 text-xs text-fg-subtle">Key
<Input :id="`${idPrefix}-key`" :model-value="model.key" class="font-mono" :disabled="disabled" @update:model-value="(key) => patch({ key: String(key) })" />
</label>
</Label>
<Button variant="ghost" size="sm" @click="editing = false">Done</Button>
</div>
<p v-if="editing && engines.error" class="mt-1 text-xs text-danger" role="alert">{{ engines.error }}</p>
+4 -3
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Label } from "@/components/ui/label";
import { Alert, AlertDescription } from "@/components/ui/alert";
import ApplyStatusRows from "./ApplyStatusRows.vue";
import { computed, onMounted, ref, watch } from "vue";
@@ -170,7 +171,7 @@ function setAllowed(id: string, text: string) {
<Section title="Aliases">
<p v-if="!aliases.default" class="mb-3 text-sm text-warn" role="alert">Set the default alias.</p>
<div v-for="alias in aliasNames" :key="alias" class="flex flex-wrap items-center gap-3 border-b border-border py-2.5 last-of-type:border-b-0">
<label :for="`alias-${alias}`" class="w-28 text-sm font-medium max-sm:w-full">{{ alias }}</label>
<Label :for="`alias-${alias}`" class="w-28 text-sm font-medium max-sm:w-full">{{ alias }}</Label>
<template v-if="alias === 'embedding'">
<Select :model-value="embeddingProvider" @update:model-value="(v) => setEmbedding(String(v), embeddingModel)">
<SelectTrigger class="w-44 font-mono" aria-label="Embedding provider"><SelectValue placeholder="unset" /></SelectTrigger>
@@ -224,9 +225,9 @@ function setAllowed(id: string, text: string) {
:aria-label="`Models ${o.name} may use`"
@update:model-value="(v) => setAllowed(o.id, String(v))"
/>
<label class="flex items-center gap-2 text-xs text-fg-muted">
<Label class="flex items-center gap-2 text-xs text-fg-muted">
<Switch :model-value="policyFor(o.id).own_providers" @update:model-value="(v) => setPolicy(o.id, { own_providers: !!v })" />
Own providers</label>
Own providers</Label>
<DraftHint kind="org-model-policy" :path="o.id" />
</div>
</Section>