Developing lightweight computation at the DSG edge

gateways_j.htm 2.79 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
<%+header%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>

<script type="text/javascript">//<![CDATA[

	var displayExtraInfo = function ( id ) {

		document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
	}
	XHR.poll(5, '/cgi-bin/bmx6-info', { 'descriptions/all': '' },
		function(x, st)
		{
		  var tb = document.getElementById('descriptions_table');
14
15
		  var rowcount = 0;
		  var tunicon = "<%=resource%>/icons/tunnel.png";
16
17
18
19
20
21
22
		  /* clear all rows */
		  while( tb.rows.length > 1 ) tb.deleteRow(1);

		  for ( var k in st  )
			{
			var description = st[k].DESC_ADV;
		  	var tun4in6;
23

24
25
26
27
			for ( var k in description.extensions )
				{
				var value = description.extensions[k];

28
					if ( value.TUN4IN6_NET_EXTENSION )
29
						{
30
						tun4in6 = value.TUN4IN6_NET_EXTENSION;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
						break;
						}
				}

			if ( tun4in6 )
			{
				var nodename = description.globalId.replace(/\..+$/,'');

				for( var i = 0; i < tun4in6.length; i++ )
				{
					var tr = tb.insertRow(-1);
					var network =  tun4in6[i].network;
					var network_len = tun4in6[i].networklen;
					var network_bw = tun4in6[i].bandwidth;
45

46
47
48
49
50
51
52
					if ( network_len >= 32 ) continue;

					tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((rowcount++ % 2) + 1);
					tr.insertCell(-1).innerHTML = String.format('<a href="/cgi-bin/bmx6control?function=gwselect&amp;node=%s"><img src="%s" /></a>',nodename,tunicon);
					tr.insertCell(-1).innerHTML = nodename;
					tr.insertCell(-1).innerHTML = network + '/' + network_len;
					tr.insertCell(-1).innerHTML = network_bw;
53
54


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
				}

				if( tb.rows.length == 1 )
				{
					var tr = tb.insertRow(-1);
						tr.className = 'cbi-section-table-row';

					var td = tr.insertCell(-1);
						td.colSpan = 4;
						td.innerHTML = '<em><br /><%:There are no gateways announced in the network.%></em>';
				}
				}
			}
		}
	);
//]]></script>

<style>

	div.hideme{
		display: none;
	}
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
	div.info{
		background: #FFF;
		border: solid 1px;
		height: 80px;
		display: block;
		overflow: auto;
	}

	div.inforow{
		text-align:left;
		display:inline-block;
		width:20%;
		margin:5px;
		vertical-align:top;

	}

#extra-info ul { list-style: none outside none; margin-left: 0em; }

</style>
<div class="cbi-map">

<h2>Originators</h2>
<div class="cbi-map-descr"></div>
<fieldset class="cbi-section">
	<legend><%:Mesh gateways%></legend>
	<table class="cbi-section-table" id="descriptions_table">
		<tr class="cbi-section-table-titles">
			<th class="cbi-section-table-cell"></th>
			<th class="cbi-section-table-cell"><%:Node%></th>
			<th class="cbi-section-table-cell"><%:Network%></th>
			<th class="cbi-section-table-cell"><%:Bandwidth%></th>
		</tr>
		<tr class="cbi-section-table-row">
			<td colspan="4"><em><br /><%:Collecting data...%></em></td>
		</tr>
	</table>
</fieldset>

</div>

<%+footer%>