(function(SS) { 'use strict'; let uiContent function loadSVG(url) { fetch(url) .then(response => response.text()) .then(svgContent => { const container = document.getElementById('svg-container'); container.src = url; uiContent = svgContent; }) .catch(err => console.error('Failed to load SVG:', err)); } window.onload = function() { loadSVG('http://localhost:8083/ui'); }; document.getElementById('send-request').addEventListener('click', function() { const input = document.getElementById('payload'); const payloadData = JSON.parse(input.value); const data = { payload: payloadData }; fetch('http://localhost:8083/request', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }) .then(response => response.json()) .then(data => console.log('Success:', data)) .catch((error) => console.error('Error:', error)); }); const tasks = {}; function attachSVGNodeEvents() { const svgNodes = document.querySelectorAll('g.node'); // Adjust selector as per your SVG structure svgNodes.forEach(node => { node.classList.add("cursor-pointer") node.addEventListener('click', handleSVGNodeClick); }); } // Function to handle the click on an SVG node and show the popover function handleSVGNodeClick(event) { const nodeId = event.currentTarget.id; // Get the node ID (e.g., 'node_store:data') const nodeData = findNodeDataById(nodeId); // Fetch data related to the node (status, result, etc.) if (nodeData) { showSVGPopover(event, nodeData); } } // Function to show the popover next to the clicked SVG node function showSVGPopover(event, nodeData) { const popover = document.getElementById('svg-popover'); document.getElementById('task-id').innerHTML = nodeData.task_id popover.classList.add('visible'); popover.innerHTML = `
${JSON.stringify(nodeData.payload, null, 2)}Error: ${nodeData.error || 'N/A'} Created At: ${nodeData.created_at} Processed At: ${nodeData.processed_at} Latency: ${nodeData.latency}