Spaces:
Running
Running
Upload index.html
Browse files- index.html +47 -46
index.html
CHANGED
|
@@ -1,60 +1,61 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
-
<title>Noda Import</title>
|
| 5 |
<script src="https://cdn.noda.io/noda.js"></script>
|
| 6 |
</head>
|
| 7 |
-
<body style="font-family: sans-serif; background: #111; color: white;">
|
| 8 |
-
<h2>Import BPM Graph into Noda</h2>
|
| 9 |
-
<p>Click the button below inside Noda VR.</p>
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
</
|
| 14 |
|
| 15 |
<script>
|
| 16 |
-
const DATA_URL =
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
| 53 |
-
|
| 54 |
-
alert("Import completed!");
|
| 55 |
}
|
| 56 |
|
| 57 |
-
|
|
|
|
| 58 |
</script>
|
| 59 |
</body>
|
| 60 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
+
<title>Noda Auto Import</title>
|
| 5 |
<script src="https://cdn.noda.io/noda.js"></script>
|
| 6 |
</head>
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
<body style="font-family: sans-serif; background: #111; color: white;">
|
| 9 |
+
<h2>Importing now…</h2>
|
| 10 |
+
<p>If you are in Noda VR, your graph will appear automatically.</p>
|
| 11 |
|
| 12 |
<script>
|
| 13 |
+
const DATA_URL =
|
| 14 |
+
"https://huggingface.co/spaces/RadRuss/BusinessFlowsVR/resolve/main/noda_export.json";
|
| 15 |
+
|
| 16 |
+
async function autoImport() {
|
| 17 |
+
try {
|
| 18 |
+
const resp = await fetch(DATA_URL);
|
| 19 |
+
const data = await resp.json();
|
| 20 |
+
|
| 21 |
+
// ----- Create nodes -----
|
| 22 |
+
for (const node of data.nodes) {
|
| 23 |
+
await window.noda.createNode({
|
| 24 |
+
uuid: node.id,
|
| 25 |
+
title: node.text || "Node",
|
| 26 |
+
color: node.color || "#66CCFF",
|
| 27 |
+
size: node.size || 1,
|
| 28 |
+
location: {
|
| 29 |
+
x: node.position.x,
|
| 30 |
+
y: node.position.y,
|
| 31 |
+
z: node.position.z,
|
| 32 |
+
relativeTo: "Origin"
|
| 33 |
+
},
|
| 34 |
+
notes: JSON.stringify(node.data || {})
|
| 35 |
+
});
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// ----- Create links -----
|
| 39 |
+
for (const link of data.links) {
|
| 40 |
+
await window.noda.createLink({
|
| 41 |
+
uuid: link.id,
|
| 42 |
+
fromUuid: link.source,
|
| 43 |
+
toUuid: link.target,
|
| 44 |
+
title: link.type || ""
|
| 45 |
+
});
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
document.body.innerHTML =
|
| 49 |
+
"<h2>Import Complete</h2><p>Your graph has been imported into Noda VR.</p>";
|
| 50 |
+
|
| 51 |
+
} catch (e) {
|
| 52 |
+
document.body.innerHTML =
|
| 53 |
+
"<h2>Import Failed</h2><p>" + e + "</p>";
|
| 54 |
}
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
+
// Run automatically (no UI interaction required)
|
| 58 |
+
autoImport();
|
| 59 |
</script>
|
| 60 |
</body>
|
| 61 |
</html>
|