refactor(webui): one empty-state treatment from the installed empty primitive
This commit is contained in:
10 files changed
+96
-30
No files matched your search
@@ -19,6 +19,12 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Empty,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import {
|
||||
Card,
|
||||
CardAction,
|
||||
@@ -154,15 +160,14 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<div
|
||||
v-if="!proposals.length && !eventTypes.length"
|
||||
class="flex flex-col items-center py-4 text-center"
|
||||
>
|
||||
<p class="text-sm font-medium">No event types yet</p>
|
||||
<p class="mt-1 max-w-md text-sm text-fg-muted">
|
||||
Create one from a captured event.
|
||||
</p>
|
||||
</div>
|
||||
<Empty v-if="!proposals.length && !eventTypes.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No event types yet</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Create one from a captured event.
|
||||
</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<EventTypeDialog />
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { ago } from "@/lib/format";
|
||||
import CuratorAction from "./CuratorAction.vue";
|
||||
|
||||
@@ -72,7 +73,11 @@ function healthKind(status: string | undefined): StatusKind {
|
||||
:action="a"
|
||||
/>
|
||||
</ul>
|
||||
<p v-else class="text-sm text-fg-subtle">No recorded activity yet.</p>
|
||||
<Empty v-else>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No recorded activity yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -5,6 +5,7 @@ import { storeToRefs } from "pinia";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -15,7 +16,7 @@ import {
|
||||
import { ago } from "@/lib/format";
|
||||
import { useControlPlaneStore, type AuditEntry } from "@/stores/control-plane";
|
||||
import { formatValue } from "./changes";
|
||||
import { filterHistory } from "./history";
|
||||
import { filterHistory, historyEmptyTitle } from "./history";
|
||||
|
||||
/**
|
||||
* Every settings change, one row per changed field, newest first. Restore
|
||||
@@ -189,8 +190,12 @@ async function restoreBefore(entry: AuditEntry): Promise<void> {
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!rows.length">
|
||||
<td colspan="7" class="px-4 py-8 text-center text-sm text-fg-muted">
|
||||
{{ entries.length ? "No matching changes." : "No changes recorded yet." }}
|
||||
<td colspan="7">
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>{{ historyEmptyTitle(entries.length > 0) }}</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -5,6 +5,13 @@ import { CalendarClock, Plus, Trash2 } from "@lucide/vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Empty,
|
||||
EmptyContent,
|
||||
EmptyHeader,
|
||||
EmptyMedia,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
@@ -83,13 +90,17 @@ const whenKind = (job: Job) => job.schedule.kind || "interval";
|
||||
</p>
|
||||
|
||||
<template v-if="jobs">
|
||||
<div v-if="!jobs.length" class="flex flex-col items-center rounded-lg border border-border bg-card px-6 py-12 text-center">
|
||||
<span class="mb-3 grid size-10 place-items-center rounded-md bg-secondary text-muted-foreground">
|
||||
<CalendarClock class="size-5" aria-hidden="true" />
|
||||
</span>
|
||||
<p class="font-medium">No schedules yet</p>
|
||||
<Button size="sm" @click="add"><Plus data-icon="inline-start" /> Add schedule</Button>
|
||||
</div>
|
||||
<Empty v-if="!jobs?.length">
|
||||
<EmptyMedia variant="icon">
|
||||
<CalendarClock />
|
||||
</EmptyMedia>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No schedules yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
<EmptyContent>
|
||||
<Button size="sm" @click="add"><Plus data-icon="inline-start" /> Add schedule</Button>
|
||||
</EmptyContent>
|
||||
</Empty>
|
||||
|
||||
<section
|
||||
v-for="(job, i) in jobs"
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import {
|
||||
Select,
|
||||
@@ -121,7 +122,13 @@ const lifecycle = {
|
||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.busy" @click="retiring = value">Retire</Button>
|
||||
</div>
|
||||
</li>
|
||||
<li v-if="!store.identities.length" class="px-4 py-8 text-center text-sm text-fg-muted">No identities yet.</li>
|
||||
<li v-if="!store.identities.length">
|
||||
<Empty class="py-6">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No identities yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<AlertDialog :open="!!retiring" @update:open="(open) => !open && (retiring = null)">
|
||||
|
||||
@@ -12,6 +12,15 @@ export interface HistoryFilter {
|
||||
sinceMs?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* historyEmptyTitle is what the history table's nothing-to-show row says: a
|
||||
* history with entries whose filters match nothing asks the reader to change
|
||||
* the filters, while a history with nothing recorded at all says so.
|
||||
*/
|
||||
export function historyEmptyTitle(entriesRecorded: boolean): string {
|
||||
return entriesRecorded ? "No matching changes." : "No changes recorded yet.";
|
||||
}
|
||||
|
||||
/** filterHistory keeps the audit entries that match every filter set. */
|
||||
export function filterHistory<T extends HistoryEntry>(
|
||||
entries: T[],
|
||||
|
||||
@@ -4,6 +4,11 @@ import { Plus, RotateCcw } from "@lucide/vue";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Empty,
|
||||
EmptyHeader,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { StatusPill } from "@/components/ui/status-pill";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
@@ -139,8 +144,12 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<section v-if="!selected" class="min-w-0 rounded-lg border border-border bg-card px-5 py-10 text-center" aria-label="Workflow">
|
||||
<p class="font-medium">No workflows</p>
|
||||
<section v-if="!selected" class="min-w-0 rounded-lg border border-border bg-card" aria-label="Workflow">
|
||||
<Empty>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No workflows</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</section>
|
||||
<section v-else class="min-w-0 rounded-lg border border-border bg-card px-5 py-4" aria-label="Workflow">
|
||||
<header class="mb-2 flex flex-wrap items-center gap-2">
|
||||
@@ -162,14 +171,22 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<WorkflowEditor v-model:selected="selected" />
|
||||
</TabsContent>
|
||||
<TabsContent value="performance" class="grid gap-4 pt-4">
|
||||
<p v-if="!stages.length" class="text-sm text-fg-muted">No stage timings yet.</p>
|
||||
<Empty v-if="!stages.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No stage timings yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<template v-else>
|
||||
<SlowestStagesCard :stages="stages" />
|
||||
<StageFailuresCard :stages="stages" />
|
||||
</template>
|
||||
</TabsContent>
|
||||
<TabsContent value="runs" class="pt-4">
|
||||
<p v-if="!workflowRuns.length" class="text-sm text-fg-muted">No runs yet.</p>
|
||||
<Empty v-if="!workflowRuns.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No runs yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<ul v-else class="divide-y divide-border">
|
||||
<li v-for="t in workflowRuns" :key="t.id" class="flex items-center gap-3 py-2 text-sm">
|
||||
<RouterLink :to="`/tasks/${t.id}`" class="min-w-0 flex-1 truncate hover:underline">{{ t.title || `Task ${t.id}` }}</RouterLink>
|
||||
|
||||
Reference in new issue
Block a user