diff --git a/src/App.vue b/src/App.vue index 6da8b59..cbe218f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -47,7 +47,7 @@ const isRunning = computed(() => playing.value || stepIndex.value >= 0) function persist() { localStorage.setItem(STORAGE_KEY, JSON.stringify(landscape.value)) } function persistPresets() { localStorage.setItem(PRESET_STORAGE_KEY, JSON.stringify(customPresets.value)) } function selectSystem(id: string) { selectedSystemId.value = id; selectedConnectionId.value = '' } -function selectConnection(id: string) { selectedConnectionId.value = id; selectedSystemId.value = ''; const connection = landscape.value.connections.find((item) => item.id === id); if (connection && !connection.transformation) connection.transformation = { incoming: connection.payload, outgoing: connection.payload, note: '' } } +function selectConnection(id: string) { selectedConnectionId.value = id; selectedSystemId.value = ''; const connection = landscape.value.connections.find((item) => item.id === id); if (connection) { connection.transformation ||= { incoming: connection.payload, outgoing: connection.payload, note: '' }; connection.protocol ||= 'HTTPS'; connection.dataType ||= 'JSON'; connection.deliveryMethod ||= 'immediate'; connection.showCableLabel ??= true } } function addSystem() { const id = uid('system'); landscape.value.systems.push({ id, name: 'New system', description: 'Describe this system.', category: 'service', color: '#6d7cff', position: [160, 160], capabilities: [] }); selectSystem(id); persist(); rebuildGraph() } @@ -62,7 +62,7 @@ function deleteSystem(id: string) { } function addConnection() { if (landscape.value.systems.length < 2) return - const connection: ConnectionModel = { id: uid('connection'), sourceId: landscape.value.systems[0].id, targetId: landscape.value.systems[1].id, label: 'New connection', description: '', payload: '{}', transformation: { incoming: '{}', outgoing: '{}', note: '' } } + const connection: ConnectionModel = { id: uid('connection'), sourceId: landscape.value.systems[0].id, targetId: landscape.value.systems[1].id, label: 'New connection', description: '', payload: '{}', transformation: { incoming: '{}', outgoing: '{}', note: '' }, protocol: 'HTTPS', dataType: 'JSON', deliveryMethod: 'immediate', showCableLabel: true } landscape.value.connections.push(connection); selectConnection(connection.id); persist(); rebuildGraph() } function deleteConnection(id: string) { @@ -145,6 +145,7 @@ function buildNode(system: SystemModel) { node.onDrawForeground = function(ctx: CanvasRenderingContext2D) { ctx.fillStyle = '#8d9bb8'; ctx.font = '11px Inter, sans-serif'; ctx.fillText(system.category.toUpperCase(), 12, 76); if (node.showActions) { ctx.fillStyle = '#c9d3e8'; ctx.font = '10px Inter, sans-serif'; system.capabilities.forEach((capability: CapabilityModel, index: number) => ctx.fillText(`${capability.name}: ${capability.actions.map((item) => item.name).join(', ')}`, 12, 92 + index * 13)) } } graph.add(node); return node } +function connectionLabel(connection: ConnectionModel) { return connection.showCableLabel === false ? '' : `${connection.label} · ${connection.protocol || 'HTTPS'} · ${connection.dataType || 'JSON'} · ${connection.deliveryMethod || 'immediate'}` } function rebuildGraph() { graph.clear(); landscape.value.systems.forEach(buildNode) for (const connection of landscape.value.connections) { @@ -161,6 +162,12 @@ function drawPackets() { graphCanvas.onDrawForeground = original if (!currentConnections.value.length || stepIndex.value < 0) return const ctx = graphCanvas.ctx as CanvasRenderingContext2D + for (const connection of landscape.value.connections) { + if (!connection.showCableLabel) continue + const from = graph.getNodeById(connection.sourceId); const to = graph.getNodeById(connection.targetId) + if (!from || !to) continue + ctx.save(); ctx.fillStyle = '#7887a2'; ctx.font = '10px Inter, sans-serif'; ctx.fillText(connectionLabel(connection), (from.pos[0] + to.pos[0]) / 2, (from.pos[1] + to.pos[1]) / 2 - 8); ctx.restore() + } for (const connection of currentConnections.value) { const from = graph.getNodeById(connection.sourceId); const to = graph.getNodeById(connection.targetId) if (!from || !to) continue @@ -208,5 +215,6 @@ onUnmounted(stopAnimation)
SIMULATED TRANSFORMATION{{ selectedConnection.label }}

Configure the data change explicitly; playback never calls a real service.

LAST RECEIVED PAYLOAD
Incoming
{{ latestSelectedRecord.incoming }}
Outgoing
{{ latestSelectedRecord.outgoing }}
{{ change.status }} {{ change.key }}: {{ change.incoming }} → {{ change.outgoing }}
GUIDED STEP {{ stepIndex + 1 }}{{ currentStep.explanation }}

{{ selectedScenario?.description }}

STEP OUTCOMESFailure and recovery routing

Choose how a simulated step behaves. Retry is limited to one automatic attempt per reset.

{{ index + 1 }}. {{ step.explanation }}
+
CONNECTION PROPERTIES
diff --git a/src/connection.css b/src/connection.css new file mode 100644 index 0000000..ea626ce --- /dev/null +++ b/src/connection.css @@ -0,0 +1 @@ +.connection-properties{padding:13px 16px}.property-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:9px}.property-grid label{color:#8996af;font-size:10px;font-weight:700}.property-grid select{display:block;width:100%;margin-top:5px;background:#0d1320;color:#dce4f4;border:1px solid #303d58;border-radius:4px;padding:7px;font-size:11px}.property-grid .checkbox-label{display:flex;align-items:center;gap:7px;padding-top:22px}.property-grid .checkbox-label input{width:auto}@media(max-width:800px){.property-grid{grid-template-columns:1fr 1fr}} diff --git a/src/main.ts b/src/main.ts index 371612c..a0010ba 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,7 @@ import './inspector.css' import './transformation.css' import './presentation.css' import './failure.css' +import './connection.css' import './style.css' createApp(App).mount('#app') diff --git a/src/model.ts b/src/model.ts index 0b5fb00..d02d365 100644 --- a/src/model.ts +++ b/src/model.ts @@ -24,6 +24,10 @@ export interface ConnectionModel { description: string payload: string transformation?: { incoming: string; outgoing: string; note: string } + protocol?: string + dataType?: string + deliveryMethod?: 'immediate' | 'scheduled' | 'manual' + showCableLabel?: boolean } export interface ScenarioStep {