feat(eda): link binding dispatches to the captures and tasks they started
This commit is contained in:
24 files changed
+1315
-518
No files matched your search
@@ -13,6 +13,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { ago } from "@/lib/format";
|
||||
import { captureSignature } from "./capture-signature";
|
||||
import CapturePayload from "./CapturePayload.vue";
|
||||
import DispatchLinks from "@/bindings/DispatchLinks.vue";
|
||||
import { selected } from "./state";
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,10 @@ watch(selected, () => {
|
||||
<div class="flex flex-col gap-5">
|
||||
<CapturePayload label="Payload" :raw="selected.body" />
|
||||
<CapturePayload label="Headers" :raw="selected.headers" />
|
||||
<section class="flex flex-col gap-2">
|
||||
<h3 class="text-sm font-medium">Dispatches</h3>
|
||||
<DispatchLinks kind="captures" :id="selected.id" />
|
||||
</section>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -71,8 +71,8 @@ onMounted(async () => {
|
||||
// The URL names a selection before the window is read, so the restore waits
|
||||
// for the list; an id it no longer holds falls back to the newest capture,
|
||||
// which is what a page opened with nothing named starts on too.
|
||||
const named = Number(route.query.capture);
|
||||
if (!Number.isInteger(named) || !selectById(named)) selectNewest();
|
||||
const named = String(route.query.capture ?? "");
|
||||
if (!named || !selectById(named)) selectNewest();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { loadEventTypes } from "./event-type-state";
|
||||
* what the page prints is what the store holds.
|
||||
*/
|
||||
export interface Capture {
|
||||
id: number;
|
||||
id: string;
|
||||
received_at?: string;
|
||||
source?: string;
|
||||
remote_addr?: string;
|
||||
@@ -80,7 +80,7 @@ export async function load(): Promise<void> {
|
||||
* it. A capture that has aged out cannot be resolved: the list is the only
|
||||
* read of a capture's body, so an id it no longer carries has nothing to show.
|
||||
* Reports whether it found one. */
|
||||
export function selectById(id: number): boolean {
|
||||
export function selectById(id: string): boolean {
|
||||
const found = captures.value.find((capture) => capture.id === id);
|
||||
if (found) selected.value = found;
|
||||
return Boolean(found);
|
||||
|
||||
Reference in new issue
Block a user