-
Notifications
You must be signed in to change notification settings - Fork 12
/
visualGraph.html
71 lines (64 loc) · 2.37 KB
/
visualGraph.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<title>Graph Visualizer</title>
<link rel="stylesheet" href="vGmain.css">
</head>
<body>
<!-- Title and Icon -->
<img src="visualGraphIcon.svg" width="25" height="25" alt="">
<h2>Visualization</h2> <span id="peerList"></span> <br>
<div class="topbar">
<label for="key">Key to Start from:</label>
<input id="key" size="32"> <br>
<label for="label">Property to be used as Label:</label>
<input id="label" class="custom" size="32"> <br>
<button type="button" id="startButton">Start</button> <br>
</div>
<div class="container">
<div class="twothirdleft">
<!-- Render area -->
<svg width="700" height="500"></svg>
</div>
<div class="onethirdright">
<!-- Data Inspection Area -->
<div class="cont" id="detail">
<h3> Data Inspector </h3>
</div>
<button type="button" id="save">Save Changes</button>
</div>
</div>
<!-- End of Page -->
</body>
<!-- Require D3 for Grahping the Graph -->
<script src="https://d3js.org/d3.v4.min.js"></script>
<!-- Needed Gun DB files to hook into a peer -->
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/promise.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/sea.js"></script>
<!-- Button Logic -->
<script type="text/javascript">
//clear old data
localStorage.clear();
//check if we have used inspector in this session and offer the previous ip as default if true
let data = window.sessionStorage.getItem('peers')
if(data) {
var def = data;
} else {
var def = '"http://localhost:8080/gun"';
}
var peers = window.prompt('Please specify the IP of the peer you want to inspect:', def);
sessionStorage.setItem('peers', peers);
peers = JSON.parse(peers);
var gun = Gun({peers:peers, radisk:false});
var graph = {};
var peerList = document.getElementById('peerList');
peerList.innerHTML = peers;
</script>
<!-- Build and explore graphs -->
<script src="visualGraph.js"></script>
<!-- Use abastraction to build labelled property graphs -->
<script src="abstraction.js"></script>
</html>