|
46 | 46 | const newNodes: Node[] = [];
|
47 | 47 | let nodeId = 1;
|
48 | 48 |
|
49 |
| - // Add eVaults in a column on the left (x: 200, y: starting from 150) |
| 49 | + // Add service nodes at the top (x: 400, 600, 800, y: 50) |
| 50 | + newNodes.push({ |
| 51 | + id: 'registry', |
| 52 | + position: { x: 400, y: 50 }, |
| 53 | + data: { |
| 54 | + label: 'Registry', |
| 55 | + subLabel: 'Service', |
| 56 | + type: 'service', |
| 57 | + selected: false |
| 58 | + }, |
| 59 | + type: 'vault' |
| 60 | + }); |
| 61 | +
|
| 62 | + newNodes.push({ |
| 63 | + id: 'ontology', |
| 64 | + position: { x: 600, y: 50 }, |
| 65 | + data: { |
| 66 | + label: 'Ontology Service', |
| 67 | + subLabel: 'Service', |
| 68 | + type: 'service', |
| 69 | + selected: false |
| 70 | + }, |
| 71 | + type: 'vault' |
| 72 | + }); |
| 73 | +
|
| 74 | + newNodes.push({ |
| 75 | + id: 'provisioner', |
| 76 | + position: { x: 800, y: 50 }, |
| 77 | + data: { |
| 78 | + label: 'eVault Provisioner', |
| 79 | + subLabel: 'Service', |
| 80 | + type: 'service', |
| 81 | + selected: false |
| 82 | + }, |
| 83 | + type: 'vault' |
| 84 | + }); |
| 85 | +
|
| 86 | + // Add eVaults in a column on the left (x: 200, y: starting from 500) |
50 | 87 | selectedEVaults.forEach((evault, index) => {
|
51 | 88 | newNodes.push({
|
52 | 89 | id: `evault-${index + 1}`,
|
53 |
| - position: { x: 200, y: 150 + index * 180 }, |
| 90 | + position: { x: 200, y: 500 + index * 180 }, |
54 | 91 | data: {
|
55 | 92 | label: evault.evaultId || evault.name || 'eVault',
|
56 | 93 | subLabel: evault.serviceUrl || evault.ip || 'Unknown',
|
|
61 | 98 | });
|
62 | 99 | });
|
63 | 100 |
|
64 |
| - // Add platforms in a column on the right (x: 800, y: starting from 150) |
| 101 | + // Add platforms in a column on the right (x: 800, y: starting from 500) |
65 | 102 | selectedPlatforms.forEach((platform, index) => {
|
66 | 103 | newNodes.push({
|
67 | 104 | id: `platform-${index + 1}`,
|
68 |
| - position: { x: 800, y: 150 + index * 180 }, |
| 105 | + position: { x: 800, y: 500 + index * 180 }, |
69 | 106 | data: {
|
70 | 107 | label: platform.name,
|
71 | 108 | subLabel: platform.url,
|
|
82 | 119 |
|
83 | 120 | // Load SvelteFlow component
|
84 | 121 | loadSvelteFlow();
|
| 122 | +
|
| 123 | + // Start subscription immediately on mount |
| 124 | + subscribeToEvents(); |
| 125 | +
|
| 126 | + // Initialize sequence state to show we're ready |
| 127 | + sequenceStarted = true; |
| 128 | + currentFlowStep = 0; |
85 | 129 | });
|
86 | 130 |
|
87 | 131 | async function loadSvelteFlow() {
|
|
378 | 422 | // Don't clear flowMessages - keep old logs
|
379 | 423 | edges = [];
|
380 | 424 |
|
381 |
| - // Close existing connection if any |
382 |
| - if (eventSource) { |
383 |
| - eventSource.close(); |
| 425 | + // Only start new SSE connection if one doesn't exist |
| 426 | + if (!eventSource) { |
| 427 | + subscribeToEvents(); |
384 | 428 | }
|
385 |
| -
|
386 |
| - // Start new SSE connection |
387 |
| - subscribeToEvents(); |
388 | 429 | }
|
389 | 430 |
|
390 | 431 | // Function to reset the sequence
|
|
435 | 476 |
|
436 | 477 | <section class="flex h-full w-full">
|
437 | 478 | <div class="bg-gray flex h-screen w-screen flex-col">
|
438 |
| - <div class="z-10 flex w-full items-center justify-between bg-white p-4 shadow-sm"> |
| 479 | + <div class="z-10 flex w-full items-center justify-between bg-white p-4"> |
439 | 480 | <div>
|
440 | 481 | <h4 class="text-xl font-semibold text-gray-800">Live Monitoring</h4>
|
441 | 482 | <p class="mt-1 text-sm text-gray-600">
|
|
543 | 584 |
|
544 | 585 | <!-- Flow Messages Panel -->
|
545 | 586 | <div
|
546 |
| - class="flex h-full w-[40%] cursor-pointer flex-col bg-white p-4 shadow-sm transition-colors hover:bg-gray-50" |
547 |
| - onclick={!sequenceStarted || currentFlowStep >= 4 ? startSequence : undefined} |
548 |
| - class:cursor-pointer={!sequenceStarted || currentFlowStep >= 4} |
549 |
| - class:cursor-default={sequenceStarted && currentFlowStep < 4} |
| 587 | + class="flex h-full w-[40%] cursor-default flex-col bg-white p-4 transition-colors hover:bg-gray-50" |
550 | 588 | >
|
551 | 589 | <div class="mb-4">
|
552 | 590 | <h3 class="text-lg font-semibold text-gray-800">Data Flow</h3>
|
553 |
| - {#if sequenceStarted} |
554 |
| - <div class="mt-2 text-sm text-gray-600"> |
555 |
| - Current Step: {currentFlowStep === 0 |
556 |
| - ? 'Waiting...' |
557 |
| - : currentFlowStep === 1 |
558 |
| - ? 'Platform creating entry locally' |
559 |
| - : currentFlowStep === 2 |
560 |
| - ? 'Syncing to eVault' |
561 |
| - : currentFlowStep === 3 |
562 |
| - ? 'eVault created metaenvelope' |
563 |
| - : currentFlowStep === 4 |
564 |
| - ? 'Awareness Protocol' |
565 |
| - : currentFlowStep === 5 |
566 |
| - ? 'All platforms notified' |
567 |
| - : 'Complete'} |
568 |
| - </div> |
569 |
| - {/if} |
| 591 | + <div class="mt-2 text-sm text-gray-600"> |
| 592 | + Current Step: {currentFlowStep === 0 |
| 593 | + ? 'Waiting for events...' |
| 594 | + : currentFlowStep === 1 |
| 595 | + ? 'Platform creating entry locally' |
| 596 | + : currentFlowStep === 2 |
| 597 | + ? 'Syncing to eVault' |
| 598 | + : currentFlowStep === 3 |
| 599 | + ? 'eVault created metaenvelope' |
| 600 | + : currentFlowStep === 4 |
| 601 | + ? 'Awareness Protocol' |
| 602 | + : currentFlowStep === 5 |
| 603 | + ? 'All platforms notified' |
| 604 | + : 'Complete'} |
| 605 | + </div> |
570 | 606 | </div>
|
571 | 607 |
|
572 | 608 | <div class="flex-1 space-y-2 overflow-y-auto">
|
|
617 | 653 | :global(.svelte-flow__edge.default .svelte-flow__edge-path) {
|
618 | 654 | stroke-dasharray: none !important;
|
619 | 655 | }
|
| 656 | +
|
| 657 | + /* Hide handles on service nodes */ |
| 658 | + :global(.svelte-flow__node[data-id='registry'] .svelte-flow__handle), |
| 659 | + :global(.svelte-flow__node[data-id='ontology'] .svelte-flow__handle), |
| 660 | + :global(.svelte-flow__node[data-id='provisioner'] .svelte-flow__handle) { |
| 661 | + visibility: hidden !important; |
| 662 | + } |
620 | 663 | </style>
|
0 commit comments