Spaces:
Running
Running
| <html> | |
| <head> | |
| <title>Noda Auto Import</title> | |
| <script src="https://cdn.noda.io/noda.js"></script> | |
| </head> | |
| <body style="font-family: sans-serif; background: #111; color: white;"> | |
| <h2>Waiting for Noda WebAPI…</h2> | |
| <script> | |
| const DATA_URL = | |
| "https://huggingface.co/spaces/RadRuss/BusinessFlowsVR/resolve/main/noda_export.json"; | |
| // Wait for Noda API to appear | |
| async function waitForNoda() { | |
| while (typeof window.noda === "undefined") { | |
| document.body.innerHTML = "<h2>Waiting for Noda WebAPI…</h2>"; | |
| await new Promise(res => setTimeout(res, 500)); | |
| } | |
| document.body.innerHTML = "<h2>Importing Graph…</h2>"; | |
| return window.noda; | |
| } | |
| async function autoImport() { | |
| const noda = await waitForNoda(); | |
| const resp = await fetch(DATA_URL); | |
| const data = await resp.json(); | |
| // Create nodes | |
| for (const node of data.nodes) { | |
| await noda.createNode({ | |
| uuid: node.id, | |
| title: node.text || "Node", | |
| color: node.color || "#66CCFF", | |
| size: node.size || 1, | |
| location: { | |
| x: node.position.x, | |
| y: node.position.y, | |
| z: node.position.z, | |
| relativeTo: "Origin" | |
| }, | |
| notes: JSON.stringify(node.data || {}) | |
| }); | |
| } | |
| // Create links | |
| for (const link of data.links) { | |
| await noda.createLink({ | |
| uuid: link.id, | |
| fromUuid: link.source, | |
| toUuid: link.target, | |
| title: link.type || "" | |
| }); | |
| } | |
| document.body.innerHTML = "<h2>Import completed!</h2>"; | |
| } | |
| autoImport(); | |
| </script> | |
| </body> | |
| </html> |