RadRuss commited on
Commit
d28728d
·
verified ·
1 Parent(s): 7b4a3ee

Upload index.html

Browse files
Files changed (1) hide show
  1. 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
- <button id="btn" style="padding: 10px; font-size: 18px;">
12
- Import Graph
13
- </button>
14
 
15
  <script>
16
- const DATA_URL = "https://huggingface.co/spaces/RadRuss/BusinessFlowsVR/resolve/main/noda_export.json";
17
-
18
- async function importGraph() {
19
- alert("Loading JSON…");
20
- const resp = await fetch(DATA_URL);
21
- const data = await resp.json();
22
-
23
- alert("Creating nodes…");
24
-
25
- // Create all nodes
26
- for (const node of data.nodes) {
27
- await window.noda.createNode({
28
- uuid: node.id,
29
- title: node.text || "Node",
30
- color: node.color || "#66CCFF",
31
- size: node.size || 1,
32
- location: {
33
- x: node.position.x,
34
- y: node.position.y,
35
- z: node.position.z,
36
- relativeTo: "Origin"
37
- },
38
- notes: JSON.stringify(node.data || {})
39
- });
40
- }
41
-
42
- alert("Creating links…");
43
-
44
- // Create all links
45
- for (const link of data.links) {
46
- await window.noda.createLink({
47
- uuid: link.id,
48
- fromUuid: link.source,
49
- toUuid: link.target,
50
- title: link.type || ""
51
- });
 
 
 
 
 
52
  }
53
-
54
- alert("Import completed!");
55
  }
56
 
57
- document.getElementById("btn").onclick = importGraph;
 
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>