forked from zelig/p2p-cy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
simulation.html
240 lines (223 loc) · 10.7 KB
/
simulation.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html lang="en">
<head>
<title>p2p Network Connectivity Graph</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<!--
<script src="js/lib/3d-force-graph.js"></script>
-->
<script src="js/lib/[email protected]"></script>
<script src="js/lib/d3.v4.min.js"></script>
<script src="js/lib/jquery-2.2.4.min.js"></script>
<script src="js/clickhandlers.js"></script>
<script src="js/timemachine.js"></script>
<script src="js/visuals.js"></script>
<script src="js/network.js"></script>
<script src="js/chord.js"></script>
<link rel="stylesheet" href="css/d3.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
</head>
<body>
<div class="wrapper">
<header>
<div class="menu-space">
<label id="drawer-toggle-label"></label>
</div>
<!-- Currently disabled
<div class="backend-monitor">
<div class="monitor-label">Backend connection status</div>
<div class="monitor-indicator" id="backend-ok"></div>
<div class="monitor-indicator" id="backend-nok"></div>
</div>
-->
<div class="logo">
<img src="img/swarm-logo-horizontal-w.png"/>
<img src="img/swarm-text-w.png"/>
</div>
<div class="title">
P2P Network Connectivity Graph
</div>
</header>
<div id="sidebar" class=sidebar>
<div class="controls">
<i id="power" class="fa fa-power-off power-off" aria-hidden="true"><div class="control-label">Power</div></i>
<i id="start" class="invisible fa fa-play" aria-hidden="true"><div class="control-label">Start</div></i>
<i id="stop" class="invisible fa fa-stop" aria-hidden="true"><div class="control-label">Stop</div></i>
<i id="freeze" class="invisible fa fa-snowflake-o" aria-hidden="true"><div class="control-label">Freeze</div></i>
<i id="upload" class="invisible fa fa-upload" aria-hidden="true"><div class="control-label">Upload snapshot</div></i>
<i id="snapshot" class="invisible fa fa-camera-retro" aria-hidden="true"><div class="control-label">Take snapshot</div></i>
<i id="play" class="invisible fa fa-play-circle" aria-hidden="true"><div class="control-label">Replay last run</div></i>
<i id="refresh" class="invisible fa fa-fast-backward" aria-hidden="true"><div class="control-label">Rewind last run</div></i>
<i id="search-node" class="invisible fa fa-search" aria-hidden="true"><div class="control-label">Search node</div></i>
<i id="show-conn-graph" class="invisible fa fa-pie-chart"><div class="control-label">Last run graph</div></i>
<div class="display">
<div class="elapsed">Time elapsed: <span id="time-elapsed">00:00:00</span></div>
<div class="label">
</div>
</div>
<i id="visualisation-options" class="fa fa-cog" aria-hidden="true"><div class="control-label">Settings</div></i>
</div>
<div class="sidebar-content">
<div class="sm-dialog">
<input id="find-id" class="nodeactions" type="text" placeholder="Provide node name or ID"/>
<button type="button" class="nodeactions" onclick="getNodeById()">Find Node</button>
</div>
<div class="control-options">
<div id="general-options">
<div class="option-item">
<label for="node-count">Number of nodes for simulation</label>
<input id="node-count" min="5" max="1000" width="5" type="number" class="" name="node-count" value="30">
</div>
<div class="option-item">
<label for="mocker-type">Mocker Type</label>
<select class="sim-options" id="mocker-type-selector">
</select>
</div>
<div class="option-item">
<label for="showlogs">Enable log console</label>
<label>
<input type="checkbox" id="showlogs" name="showlogs" value="true">
<span></span>
</label>
<label for="rec-messages">Enable message events</label>
<label>
<input id="rec-messages" type="checkbox" class="checkbox"/>
<span></span>
</label>
</div>
</div>
<div id="message-filters">
<input type="radio" class="selected-protocol" name="selected-protocol" checked="checked" value="pss">pss
<input type="radio" class="selected-protocol" name="selected-protocol" value="hive">hive
<input type="radio" class="selected-protocol" name="selected-protocol" value="bzz">bzz
<div id="pss-options" class="filter-options">
<label for="msg-code">Optionally specify pss message code</label>
<input type="text" name="msg-code" id="msg-code" value=0 size="4">
</div>
<div id="devp2p-options" class="filter-options">
<div class="filter-option">
<input type="radio" id="filter-handshake" checked="checked" name="devp2p-option" value="00">Handshake
<br/>
</div>
<div class="filter-option">
<input type="radio" id="filter-disc" name="devp2p-option" value="01">Discovery
<br/>
</div>
<div class="filter-option">
<input type="radio" id="filter-ping" name="devp2p-option" value="02">Ping
<br/>
</div>
<div class="filter-option">
<input type="radio" id="filter-pong" name="devp2p-option" value="03">Pong
<br/>
</div>
<div class="filter-option">
<input type="radio" id="filter-getPeer" name="devp2p-option" value="04">GetPeer
<br/>
</div>
<div class="filter-option">
<input type="radio" id="filter-peer" name="devp2p-option" value="05">Peer
</div>
</div>
</div>
</div>
<i id="info-message-events" class="fa info-circle" aria-hidden="true"></i>
<div class="timemachine-section">
<input id="timemachine" style="display:none" type="range">
<div>
<label for="replaySpeed">Replay Speed (ms)</label>
<input type="text" name="replaySpeed" id="replaySpeed" value="200">
<button type="button" class="speedDial" id="incSpeed" name="incSpeed">+</button>
<button type="button" class="speedDial" id="decSpeed" name="decSpeed">-</button>
</div>
</div>
<div class="counts">
<table>
<thead>
<td class="count-type node-counts">Nodes</td>
<td></td>
<td class="count-type conn-counts">Connections</td>
<td></td>
<td class="count-type msg-counts">Messages</td>
</thead>
<tbody>
<tr>
<td width="20%"id="nodes-up-count" class="up-count node-counts">0</td>
<td width="20%">
<div class="subcount node-counts">
<p class="count-label">Added</p><div id="nodes-add-count" class="count-value">0</div>
<p class="count-label">Removed</p><div id="nodes-remove-count" class="count-value">0</div>
</div>
</td>
<td width="20%" id="edges-up-count" class="up-count conn-counts">0</td>
<td width="20%">
<div class="subcount conn-counts">
<p class="count-label">Added</p><div id="edges-add-count" class="count-value">0</div>
<p class="count-label">Removed</p><div id="edges-remove-count" class="count-value">0</div>
</div>
</td>
<td width="20%" id="msg-count" class="up-count msg-counts">0</td>
</tr>
</tbody>
</table>
</div>
<div id="selected-node">
<div class="node-bar">
<h3>Node Information</h1>
<div class="node-display">
ID: <span id="node-id"></span> - Name:<span id="node-name"></span><i id="healthy" class="fa fa-circle invisible" aria-hidden="true"></i>
</div>
<div class="node-actions">
<input type="hidden" id="target-id"/>
<input type="hidden" id="full-node-id"/>
<button type="button" class="nodeactions" onclick="killNode()">Stop this node</button>
<button type="button" class="nodeactions" onclick="connectTo()">Connect this node to peer</button>
<button type="button" class="nodeactions" onclick="killLink()">Disconnect a link</button>
<button type="button" class="nodeactions" onclick="clearSelection()">Clear Selection</button>
</div>
<p id="operation-info"></p>
<div id="connect-peer">
<br/>
<input id="peer-id" type="text" placeholder="Provide node name or ID"/>
<button type="button" id="finalizeConnAction" class="nodeactions" onclick="finalizeConnAction()"></button>
</div>
<pre id="node-kademlia-table" class="kademlia-info"></pre>
<!--
<div id="kad-hint" class="invisible hint">The network updated. The above routing table may be out-of-date.
<button class="small-link-action" onclick='refreshKadTable()'>Refresh</button>
</div>
-->
</div>
</div>
</div>
</div>
<div id="error-messages">
Oooops - error connecting to backend!
<br/>
<div id="error-reason">
</div>
</div>
<div id="status-messages">
</div>
<div id="visualisation-wrapper">
<div id="3d-graph"></div>
<div id="graph-detail"></div>
<!--
<svg id="network-visualisation"></svg>
-->
</div>
</div>
<div id="Overlay" name="Overlay" class="overlay">
</div>
<div id="select-mocker" name="select-mocker" class="ui-dialog">
</div>
<div id="connection-graph" class="ui-dialog">
<svg id="chord-diagram"></svg>
<div class="invisible action-div" onclick="toggleChord()" id="toggle-chord">Show message graph</div>
</div>
<div id="output-window">
<div id="log-console"> </div>
</div>
</body>
</html>