fix(webui): Events reads as a flow
A Capture → Map → Bind strip with each step's count opens its tab. The tabs follow that order, sit left-aligned at their own width and carry count chips; a count that could not be read stays blank. The Inspector splits into list and detail only when there is a capture to show, and an empty event-types list explains where proposals come from.
This commit is contained in:
1 parent
3b54593da8
commit
4f480801df
7 files changed
+86
-28
No files matched your search
@@ -7,7 +7,7 @@ import CaptureDetail from "./CaptureDetail.vue";
|
||||
import CapturesCard from "./CapturesCard.vue";
|
||||
import EventTypesCard from "./EventTypesCard.vue";
|
||||
import { loadEventTypes } from "./event-type-state";
|
||||
import { load, selectById, selectNewest, selected, useCaptures } from "./state";
|
||||
import { captures, load, selectById, selectNewest, selected, useCaptures } from "./state";
|
||||
|
||||
/**
|
||||
* Event inspector: recent inbound events, newest first, with the selected
|
||||
@@ -90,8 +90,10 @@ watch(selected, (capture) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Split only when there is a capture to show beside the list. -->
|
||||
<div
|
||||
class="grid min-w-0 items-start gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"
|
||||
class="grid min-w-0 items-start gap-4"
|
||||
:class="captures.length ? 'lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]' : ''"
|
||||
>
|
||||
<div ref="listColumn" class="min-w-0">
|
||||
<CapturesCard />
|
||||
|
||||
@@ -154,12 +154,16 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
||||
<p
|
||||
<div
|
||||
v-if="!proposals.length && !eventTypes.length"
|
||||
class="text-sm text-fg-muted"
|
||||
class="flex flex-col items-center py-4 text-center"
|
||||
>
|
||||
No event types or proposals.
|
||||
</p>
|
||||
<p class="text-sm font-medium">No event types yet</p>
|
||||
<p class="mt-1 max-w-md text-sm text-fg-muted">
|
||||
Captures that share a source and payload shape are grouped into proposed types here. Name one to use it in a
|
||||
mapping, or start from a pasted payload.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<EventTypeDialog />
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<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 { computed, onMounted, ref, watch, type Component } from "vue";
|
||||
import { ArrowRight } from "@lucide/vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -9,6 +10,8 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import BindingsPage from "@/bindings/BindingsPage.vue";
|
||||
import CapturesPage from "@/captures/CapturesPage.vue";
|
||||
import { sections } from "@/lib/capabilities";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import MappingsPage from "@/mappings/MappingsPage.vue";
|
||||
import { activeTab, availableTabs } from "./tab-selection";
|
||||
|
||||
@@ -52,6 +55,32 @@ function show(id: unknown): void {
|
||||
// is actually showing, so the address bar never describes a panel that is not
|
||||
// there.
|
||||
watch(active, (tab) => show(tab), { immediate: true });
|
||||
|
||||
// One count per step of the chain, for the strip and the tab chips. A count
|
||||
// that could not be read stays blank rather than reading as zero.
|
||||
const counts = ref<Record<string, number | undefined>>({});
|
||||
async function loadCounts() {
|
||||
const [captures, mappings, bindings] = await Promise.allSettled([
|
||||
api.captures<{ captures?: unknown[] | null }>(100),
|
||||
api.mappings<{ mappings?: unknown[] }>(),
|
||||
api.bindings<{ bindings?: unknown[] }>(),
|
||||
]);
|
||||
const size = (r: PromiseSettledResult<Record<string, unknown[] | null | undefined>>, key: string) =>
|
||||
r.status === "fulfilled" ? (r.value?.[key]?.length ?? 0) : undefined;
|
||||
counts.value = {
|
||||
inspector: size(captures as never, "captures"),
|
||||
mappings: size(mappings as never, "mappings"),
|
||||
bindings: size(bindings as never, "bindings"),
|
||||
};
|
||||
}
|
||||
onMounted(loadCounts);
|
||||
useLiveResource(null, () => void loadCounts(), 1000);
|
||||
|
||||
const steps = [
|
||||
{ tab: "inspector", label: "Capture", hint: "webhooks received" },
|
||||
{ tab: "mappings", label: "Map", hint: "field mappings" },
|
||||
{ tab: "bindings", label: "Bind", hint: "bindings to workflows" },
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -65,11 +94,34 @@ watch(active, (tab) => show(tab), { immediate: true });
|
||||
<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>
|
||||
<ol class="mb-6 grid grid-cols-1 overflow-hidden rounded-lg border border-border bg-card sm:grid-cols-3" aria-label="How events become work">
|
||||
<li v-for="(step, i) in steps" :key="step.tab" class="relative border-border not-last:border-b sm:not-last:border-r sm:not-last:border-b-0">
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-center gap-3 px-5 py-4 text-left transition-colors hover:bg-secondary"
|
||||
:class="active === step.tab && 'bg-secondary'"
|
||||
@click="show(step.tab)"
|
||||
>
|
||||
<span class="grid size-7 shrink-0 place-items-center rounded-full border border-border-strong font-mono text-xs text-fg-muted">{{ i + 1 }}</span>
|
||||
<span class="min-w-0 flex-1">
|
||||
<span class="block text-sm font-medium">{{ step.label }}</span>
|
||||
<span class="block text-xs text-fg-subtle">
|
||||
<span class="font-mono">{{ counts[step.tab] ?? "–" }}</span> {{ step.hint }}
|
||||
</span>
|
||||
</span>
|
||||
<ArrowRight v-if="i < steps.length - 1" class="size-4 text-fg-subtle max-sm:hidden" aria-hidden="true" />
|
||||
</button>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<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">{{
|
||||
tab.label
|
||||
}}</TabsTrigger>
|
||||
<TabsList variant="line" class="justify-start">
|
||||
<TabsTrigger v-for="tab in tabs" :key="tab.id" :value="tab.id" class="flex-none px-3">
|
||||
{{ tab.label }}
|
||||
<span v-if="counts[tab.id] !== undefined" class="ml-1.5 rounded bg-secondary px-1.5 font-mono text-[11px] text-fg-muted">{{
|
||||
counts[tab.id]
|
||||
}}</span>
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent v-for="tab in tabs" :key="tab.id" :value="tab.id">
|
||||
<component :is="PANELS[tab.id]" />
|
||||
|
||||
@@ -18,8 +18,8 @@ export interface EventsTabSpec {
|
||||
* runs. */
|
||||
export const EVENTS_TABS: EventsTabSpec[] = [
|
||||
{ id: "inspector", label: "Inspector", section: "captures" },
|
||||
{ id: "bindings", label: "Bindings", section: "bindings" },
|
||||
{ id: "mappings", label: "Mappings", section: "mappings" },
|
||||
{ id: "bindings", label: "Bindings", section: "bindings" },
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user