feat(webui): Events header states capture status; copyable capture endpoint

The page says what it is for and whether capture intake is listening,
once that is known, instead of the Inspector repeating the global stream
state. An empty capture list offers the webhook address with a Copy
button.
This commit is contained in:
sam committed 2026-09-25 16:37:05 +10:00
1 parent 54a02fe258
commit 3b54593da8
6 files changed
+28 -30

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { Badge } from "@/components/ui/badge";
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
* it a list that has stopped updating looks exactly like a quiet one.
*/
</script>
<template>
<Badge :variant="streamKind">{{ streamState }}</Badge>
</template>
+14 -3
View File
@@ -1,7 +1,9 @@
<script setup lang="ts">
import { Inbox, TriangleAlert } from "@lucide/vue";
import { ref } from "vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import {
Empty,
EmptyDescription,
@@ -29,8 +31,13 @@ import { captures, enabled, error, loading } from "./state";
// The receiver's path, held as a string rather than typed into the template:
// its source segment is angle-bracketed, which a template parser reads as a
// tag.
const webhookHint =
"Point a webhook at /webhooks/capture/<source> and it will show up here.";
const endpoint = "/webhooks/capture/<source>";
const copied = ref(false);
async function copyEndpoint() {
await navigator.clipboard.writeText(`${location.origin}${endpoint}`);
copied.value = true;
setTimeout(() => (copied.value = false), 1500);
}
</script>
<template>
@@ -57,8 +64,12 @@ const webhookHint =
<EmptyHeader>
<EmptyMedia variant="icon"><Inbox /></EmptyMedia>
<EmptyTitle>No captures yet</EmptyTitle>
<EmptyDescription>{{ webhookHint }}</EmptyDescription>
<EmptyDescription>Point a webhook at this address and it shows up here.</EmptyDescription>
</EmptyHeader>
<div class="flex items-center gap-2 rounded-md border border-border bg-background py-1 pr-1 pl-3">
<code class="font-mono text-xs">{{ endpoint }}</code>
<Button variant="ghost" size="sm" @click="copyEndpoint">{{ copied ? "Copied" : "Copy" }}</Button>
</div>
</Empty>
<Table v-else>
-6
View File
@@ -4,7 +4,6 @@ import { onBeforeUnmount, onMounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import CaptureDetail from "./CaptureDetail.vue";
import CaptureStatus from "./CaptureStatus.vue";
import CapturesCard from "./CapturesCard.vue";
import EventTypesCard from "./EventTypesCard.vue";
import { loadEventTypes } from "./event-type-state";
@@ -91,11 +90,6 @@ watch(selected, (capture) => {
</script>
<template>
<!-- The stream's state belongs to this panel, not the page: the page carries
tabs whose other two have nothing to do with the capture stream. -->
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
<CaptureStatus />
</div>
<div
class="grid min-w-0 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"
>
+11 -1
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { StatusPill } from "@/components/ui/status-pill";
import { enabled as captureEnabled, loading as captureLoading } from "@/captures/state";
import { computed, watch, type Component } from "vue";
import { useRoute, useRouter } from "vue-router";
@@ -54,7 +56,15 @@ watch(active, (tab) => show(tab), { immediate: true });
<template>
<div>
<PageHeader title="Events" />
<PageHeader title="Events">
<template v-if="!captureLoading">
<StatusPill v-if="captureEnabled" dot="live">Listening</StatusPill>
<StatusPill v-else>Capture off</StatusPill>
</template>
</PageHeader>
<p class="-mt-4 mb-6 text-sm text-fg-muted">
Webhooks come in, get mapped to event types, and bindings turn them into work.
</p>
<Tabs class="gap-4" :model-value="active" @update:model-value="show">
<TabsList variant="line" class="w-full justify-start">
<TabsTrigger v-for="tab in tabs" :key="tab.id" :value="tab.id">{{