From 8f802ea17b2ea3364e927c13c866134a4f0f4ac6 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 19 May 2026 10:03:32 +0100 Subject: [PATCH] Make Huginn node preview payload-first --- inspector/src/main.tsx | 62 +++++++++++++++++++++-------- inspector/src/styles.css | 85 +++++++++++++++++++++++++++++++++++----- 2 files changed, 121 insertions(+), 26 deletions(-) diff --git a/inspector/src/main.tsx b/inspector/src/main.tsx index b42e5b4..a592349 100644 --- a/inspector/src/main.tsx +++ b/inspector/src/main.tsx @@ -281,6 +281,17 @@ function InspectionView({ const terrainForces = useHuginnTerrainForces(HUGINN_ART.field); const record = inspection.records[selection.record]; const catalogEntry = inspection.catalog[selection.catalog]; + const expandedRawSelection = graphSelection?.kind === "node" + ? graphProjection.nodeSelections.get(graphSelection.nodeId) + : graphSelection?.kind === "edge" + ? graphProjection.edgeSelections.get(graphSelection.edgeId) + : undefined; + const expandedRecord = expandedRawSelection?.kind === "record" + ? inspection.records[expandedRawSelection.index] + : undefined; + const expandedCatalogEntry = expandedRawSelection?.kind === "catalog" + ? inspection.catalog[expandedRawSelection.index] + : undefined; const expandedNode = graphSelection?.kind === "node" ? { graphKey: graphSelection.graphKey, @@ -289,9 +300,9 @@ function InspectionView({ ariaLabel: "Selected CultCache node", content: ( ), @@ -529,31 +540,38 @@ function ExpandedNodePanel({ record: InspectedRecord | undefined; selection: Selection; }) { + const title = record?.key ?? catalogEntry?.schemaName ?? inspection.filePath; return (
CultCache Node
-

{record?.key ?? catalogEntry?.schemaName ?? inspection.filePath}

+

{title}

{inspection.format} - {inspection.records.length} records - {inspection.catalog.length} schemas + {record ? {record.schemaName} : {inspection.records.length} records} + {record ? {record.payloadBytes} bytes : {inspection.catalog.length} schemas}
{record ? ( <> -

{record.schemaName} record stored at {record.storedAt} with {record.payloadBytes} payload bytes.

+

{record.schemaName} record stored at {record.storedAt}.

{record.payloadDecodeError ?
{record.payloadDecodeError}
: null} ) : (

{inspection.filePath} contains a schema catalog and persisted MessagePack record set.

)}
+ {record ? ( +
+

Payload

+ +
+ ) : null}
-

Record Payload

- {record ? :
Select a record node to inspect payload data.
} +

Record Metadata

+ {record ? :
Select a record node to inspect payload data.
}

Schema Entry

@@ -608,19 +626,31 @@ function CatalogButton({ function RecordDetail({ record }: { record: InspectedRecord }) { return ( <> - + {record.payloadDecodeError ?
{record.payloadDecodeError}
: null} -
{JSON.stringify(record.payloadPreview, null, 2)}
+ ); } +function RecordFacts({ record }: { record: InspectedRecord }) { + return ( + + ); +} + +function RecordPayload({ record }: { record: InspectedRecord }) { + return ( +
{JSON.stringify(record.payloadPreview, null, 2)}
+ ); +} + function CatalogDetail({ entry }: { entry: InspectedCatalogEntry }) { return ( <> diff --git a/inspector/src/styles.css b/inspector/src/styles.css index 6c84206..63ab049 100644 --- a/inspector/src/styles.css +++ b/inspector/src/styles.css @@ -578,6 +578,19 @@ pre { line-height: 1.55; } +.expanded-payload { + display: grid; + gap: 8px; + min-width: 0; + min-height: 0; +} + +.expanded-payload h2 { + margin: 0; + color: #f8fdff; + font-size: 18px; +} + .expanded-article { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); @@ -600,46 +613,98 @@ pre { } .huginn-expanded-node[data-node-stage="summary"] .expanded-content { - display: flex; + display: grid; align-items: center; - gap: 12px; + justify-items: center; + gap: 6px; padding: 10px 14px; + text-align: center; } .huginn-expanded-node[data-node-stage="summary"] .expanded-kicker, .huginn-expanded-node[data-node-stage="summary"] .expanded-summary, .huginn-expanded-node[data-node-stage="summary"] .expanded-article, -.huginn-expanded-node[data-node-stage="summary"] .expanded-footer, -.huginn-expanded-node[data-node-stage="summary"] .expanded-chips { +.huginn-expanded-node[data-node-stage="summary"] .expanded-footer { display: none; } .huginn-expanded-node[data-node-stage="summary"] .expanded-header { + display: grid; + justify-items: center; min-width: 0; } .huginn-expanded-node[data-node-stage="summary"] .expanded-header h1 { - overflow: hidden; + max-width: 100%; font-size: 1.02rem; + text-align: center; text-overflow: ellipsis; white-space: nowrap; } +.huginn-expanded-node[data-node-stage="summary"] .expanded-chips { + justify-content: center; +} + +.huginn-expanded-node[data-node-stage="summary"] .expanded-payload { + display: none; +} + .huginn-expanded-node[data-node-stage="preview"] { overflow: hidden; } -.huginn-expanded-node[data-node-stage="preview"] .expanded-article { - grid-template-columns: 1fr; +.huginn-expanded-node[data-node-stage="preview"] .expanded-content { + align-content: center; + justify-items: center; + gap: 10px; + padding: 18px 22px; + text-align: center; } -.huginn-expanded-node[data-node-stage="preview"] .expanded-article > div:nth-child(2), +.huginn-expanded-node[data-node-stage="preview"] .expanded-header { + justify-items: center; + max-width: min(640px, 100%); +} + +.huginn-expanded-node[data-node-stage="preview"] .expanded-header h1 { + max-width: 100%; + font-size: clamp(1.05rem, 2.1vw, 1.7rem); + text-align: center; +} + +.huginn-expanded-node[data-node-stage="preview"] .expanded-chips { + justify-content: center; +} + +.huginn-expanded-node[data-node-stage="preview"] .expanded-summary, +.huginn-expanded-node[data-node-stage="preview"] .expanded-article, .huginn-expanded-node[data-node-stage="preview"] .expanded-footer { display: none; } -.huginn-expanded-node[data-node-stage="preview"] pre { - max-height: 170px; +.huginn-expanded-node[data-node-stage="preview"] .expanded-payload { + width: min(680px, 100%); + justify-items: center; +} + +.huginn-expanded-node[data-node-stage="preview"] .expanded-payload h2 { + color: var(--cyan); + font-size: 12px; + font-weight: 800; + letter-spacing: 0.14em; + text-transform: uppercase; +} + +.huginn-expanded-node[data-node-stage="preview"] .payload-code { + width: 100%; + max-height: min(280px, 44vh); + margin: 0; + text-align: left; +} + +.huginn-expanded-node[data-node-stage="preview"] dl { + display: none; } .huginn-expanded-node[data-node-stage="article"] {