feat(agent): Cookie-Result-View + Check-Historie aus Snapshots
Snapshot-getriebene Result-Views, entkoppelt vom Live-Check:
- CookieResultView: laedt cmp_vendors aus einem Snapshot (kein Re-Crawl),
KPIs (Anbieter/Cookies/Marketing/Drittland) + Empfaenger-Gruppen
(Eigene/AVV/Joint-Controller) + aufklappbare Vendor->Cookie-Tabelle.
- Historie (/sdk/agent/snapshots): alle gespeicherten Checks, jederzeit
oeffnbar (DSB/Mitarbeiter) + Detail-Seite je Snapshot.
- Next.js-Proxys fuer GET /snapshots (Liste) + /snapshots/{id} (einzeln).
BMW-Snapshot 4603d15b: 83 Vendors / 780 Cookies. Library-Abgleich
(cookie_knowledge_db.lookup_cookie) folgt als Phase B.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
'use client'
|
||||
|
||||
/**
|
||||
* Snapshot-Detail — öffnet einen gespeicherten Check aus der Historie und
|
||||
* zeigt die Ergebnis-Views aus den Rohdaten (kein Re-Crawl). Aktuell:
|
||||
* Cookie-Auswertung. Impressum/AGB/… folgen als weitere Module hier.
|
||||
*/
|
||||
|
||||
import React, { use as useUnwrap, useEffect, useState } from 'react'
|
||||
import Link from 'next/link'
|
||||
|
||||
import { CookieResultView } from '../../_components/CookieResultView'
|
||||
|
||||
export default function SnapshotDetail(
|
||||
{ params }: { params: Promise<{ snapshotId: string }> },
|
||||
) {
|
||||
const { snapshotId } = useUnwrap(params)
|
||||
const [snap, setSnap] = useState<any>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
fetch(`/api/sdk/v1/agent/snapshots/${snapshotId}`)
|
||||
.then(r => r.json())
|
||||
.then(d => {
|
||||
if (cancelled) return
|
||||
if (d?.error) setError(d.error)
|
||||
else setSnap(d)
|
||||
})
|
||||
.catch(e => { if (!cancelled) setError(String(e)) })
|
||||
.finally(() => { if (!cancelled) setLoading(false) })
|
||||
return () => { cancelled = true }
|
||||
}, [snapshotId])
|
||||
|
||||
const hasCookies = (snap?.cmp_vendors?.length ?? 0) > 0
|
||||
|
||||
return (
|
||||
<div className="p-6 max-w-6xl space-y-4">
|
||||
<Link href="/sdk/agent/snapshots" className="text-xs text-blue-700 hover:underline">
|
||||
‹ Zurück zur Historie
|
||||
</Link>
|
||||
{loading ? (
|
||||
<div className="text-sm text-gray-500">Lade Snapshot…</div>
|
||||
) : error || !snap ? (
|
||||
<div className="text-sm text-red-600">Snapshot nicht gefunden.</div>
|
||||
) : hasCookies ? (
|
||||
<CookieResultView snapshot={snap} />
|
||||
) : (
|
||||
<div className="text-sm text-gray-500">
|
||||
Dieser Snapshot enthält keine Cookie-/Vendor-Daten.
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user