fix(webui): stop empty states re-deriving their own titles
A title that states the fact does not need a description that derives it: the log, panels, lifecycle lists, dashboard cards, stages, skills and captures empty states now say the fact once, and keep only the descriptions that carry an action, a cause, or a distinct reading.
This commit is contained in:
43 files changed
+239
-315
No files matched your search
@@ -1,16 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { RefreshCw } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { load } from "./state";
|
||||
|
||||
/** Read the list again, for an operator who does not want to wait for the
|
||||
* stream to invalidate it. */
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button variant="outline" @click="load">
|
||||
<RefreshCw data-icon="inline-start" />
|
||||
Refresh
|
||||
</Button>
|
||||
</template>
|
||||
@@ -1,6 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { streamKind, streamState } from "./state";
|
||||
import { useLiveUpdatesStore } from "@/stores/live-updates";
|
||||
|
||||
const { streamKind, streamState } = storeToRefs(useLiveUpdatesStore());
|
||||
|
||||
/**
|
||||
* The state of the stream that is supposed to be adding to this list. Without
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import CaptureActions from "./CaptureActions.vue";
|
||||
import CaptureStatus from "./CaptureStatus.vue";
|
||||
|
||||
/** The page's title, and what belongs beside it: where the stream has got to,
|
||||
@@ -14,7 +13,6 @@ import CaptureStatus from "./CaptureStatus.vue";
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<CaptureStatus />
|
||||
<CaptureActions />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -33,7 +33,6 @@ const webhookHint = "Point a webhook at /webhooks/capture/<source> and it will s
|
||||
<EmptyHeader>
|
||||
<EmptyMedia variant="icon"><Inbox /></EmptyMedia>
|
||||
<EmptyTitle>Capture is not configured</EmptyTitle>
|
||||
<EmptyDescription>This deployment has no capture storage wired up.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { computed, onMounted, onUnmounted, ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
import { api, subscribeEvents } from "@/lib/api";
|
||||
import type { StatusKind } from "@/lib/status";
|
||||
import type { StreamState } from "@/lib/stream-state";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
|
||||
/**
|
||||
* The event inspector's shared state.
|
||||
@@ -43,7 +42,6 @@ export const captures = ref<Capture[]>([]);
|
||||
export const enabled = ref(true);
|
||||
export const error = ref<string | null>(null);
|
||||
export const loading = ref(true);
|
||||
export const streamState = ref<StreamState | "connecting">("connecting");
|
||||
|
||||
/**
|
||||
* The open row's capture, or null. Held by value rather than by id: the list
|
||||
@@ -53,13 +51,6 @@ export const streamState = ref<StreamState | "connecting">("connecting");
|
||||
*/
|
||||
export const selected = ref<Capture | null>(null);
|
||||
|
||||
/** The stream's state as a badge kind. A stream still connecting and one that
|
||||
* has given up are different answers, so they do not share a tone. */
|
||||
export const streamKind = computed<StatusKind>(() => {
|
||||
if (streamState.value === "live") return "ok";
|
||||
return streamState.value === "unavailable" ? "danger" : "warn";
|
||||
});
|
||||
|
||||
/**
|
||||
* load re-reads the list. It runs once on mount and again on every capture
|
||||
* event, so it deliberately never re-enters the loading state: the skeletons
|
||||
@@ -81,26 +72,9 @@ export async function load(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function handleEvent(raw: unknown): void {
|
||||
// The "capture" event on /events carries the id and source only, no payload
|
||||
// (see handleCapture), so it is an invalidation signal rather than data: it
|
||||
// says a capture exists, and the authoritative list -- the only place the
|
||||
// redacted payload lives -- is asked for again. Merging it into local state
|
||||
// instead would put a row in the list with nothing behind it.
|
||||
if ((raw as { kind?: string } | null)?.kind !== "capture") return;
|
||||
void load();
|
||||
}
|
||||
|
||||
let unsubscribe: (() => void) | undefined;
|
||||
|
||||
/** Owns the initial read and the live stream that invalidates it, for the
|
||||
* page's lifetime. */
|
||||
export function useCaptures(): void {
|
||||
onMounted(() => {
|
||||
void load();
|
||||
unsubscribe = subscribeEvents(handleEvent, (state) => {
|
||||
streamState.value = state;
|
||||
});
|
||||
});
|
||||
onUnmounted(() => unsubscribe?.());
|
||||
useLiveResource("captures", () => void load());
|
||||
onMounted(load);
|
||||
}
|
||||
Reference in new issue
Block a user