-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhive.html
82 lines (72 loc) · 2.79 KB
/
hive.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
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>netkraken | single hive</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="css/hive.css" />
</head>
<body>
<ol class="breadcrumb">
<li><a href="/">netkraken</a></li>
<li>single hive</li>
</ol>
<div class="hive-description">
<em>Description: Hosts get mapped to three groups, based on their name:
<br/>
"devel-*" on lower right axis (orange),
<br/>
"testing-*" on lower left axis (green),
<br/>
rest on upper axis (blue).
<br/>
Connections are in the color of the source host.
</em>
</div>
<article>
<h1><img src="res/octopus.png"> single hive | <span id="protocol"></span> protocol</h1>
<div id="infoText"> </div>
<div id="graph_0_0"></div>
</article>
<script src="js/d3.min.js"></script>
<script src="js/link.js"></script>
<script src="js/hive.js"></script>
<script src="js/jsxcompressor.min.js"></script>
<script>
"use strict";
var source = getUrlVar("source");
source = (source === "") ? "model.live.reduced.json" : source;
var protocol = getUrlVar("protocol");
protocol = (protocol === "") ? "http" : protocol;
document.getElementById("protocol").innerHTML = protocol;
var mapping = createGroupFunction(JSON.parse(getUrlVar("mapping")));
var desc = mapping.description;
d3.xhr(source, function(response) {
var binary = JXG.decompress(response.response);
var data = JSON.parse(binary);
console.log(data);
var nodes = {};
var links = [];
data.links.forEach(function(link) {
if (link.protocol === protocol) {
var source_name = link.source;
var target_name = link.target;
var source_node = data.nodes[source_name];
var target_node = data.nodes[target_name];
source_node.group = mapping(source_name);
target_node.group = mapping(target_name);
if (source_node.group != target_node.group) {
link.source = source_node;
link.target = target_node;
links.push(link);
nodes[source_name] = source_node;
nodes[target_name] = target_node;
}
}
});
renderHive(nodes, links, 3, "#graph_0_0", "#infoText", 600);
});
</script>
</body>
</html>