luci-app-bmx7: refactory, multiple fixes and add topology graph
[feed/routing.git] / luci-app-bmx7 / files / usr / lib / lua / luci / view / bmx7 / nodes_j.htm
1 <%#
2 Copyright © 2011 Pau Escrich <pau@dabax.net>
3 Contributors Lluis Esquerda <eskerda@gmail.com>
4 Roger Pueyo Centelles <roger.pueyo@guifi.net>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 The full GNU General Public License is included in this distribution in
21 the file called "COPYING".
22 -%>
23
24 <%+header%>
25 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
26 <script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
27
28
29 <style>
30 div.hideme{
31 display: none;
32 }
33 div.info{
34 background: #FFF;
35 border: solid 0px;
36 height: 190px;
37 display: block;
38 overflow: auto;
39 }
40 div.inforow{
41 text-align:left;
42 display:inline-block;
43 margin:10px;
44 vertical-align:top;
45 float: left;
46 white-space:nowrap;
47 }
48 div.inforow.newline{
49 clear: both;
50 }
51 u {
52 text-decoration: underline;
53 }
54 #extra-info ul { list-style: none outside none; margin-left: 0em; }
55 </style>
56
57 <div class="cbi-map">
58
59 <h2>Mesh nodes</h2>
60 <div class="cbi-map-descr"></div>
61 <div id="extra-info" class="info">
62 <br />
63 <center>
64 Tip: click the <img src="<%=resource%>/bmx7/world.png" /> icon to see individual node information.
65 </center>
66 </div>
67
68
69 <div class="cbi-section">
70 <legend><%:Originators%></legend>
71 <div class="cbi-section-node">
72 <div class="table" id="nodes_div">
73 <div class="tr table-titles">
74 <div class="th"></div>
75 <div class="th"><%:Name%></div>
76 <div class="th"><%:Short ID%></div>
77 <div class="th"><%:S/s/T/t%></div>
78 <div class="th"><%:Primary IPv6%></div>
79 <div class="th"><%:Via Neighbour%></div>
80 <div class="th"><%:Metric%></div>
81 <div class="th"><%:Last Desc%></div>
82 <div class="th"><%:Last Ref%></div>
83 <div class="th"><%: %></div>
84 </div>
85 </div>
86 </div>
87 </div>
88
89 </div>
90
91 <script type="text/javascript">//<![CDATA[
92 var displayExtraInfo = function ( id ) {
93 document.getElementById('extra-info').innerHTML = document.getElementById(id).innerHTML;
94 }
95 new TablePooler(5,"/cgi-bin/bmx7-info", {'$originators':''}, "nodes_div", function(st){
96 var infoicon = "<%=resource%>/bmx7/world_small.png";
97 var originators = st.originators;
98 var res = Array();
99 originators.forEach(function(originator,i){
100 var name = originator.name;
101 var shortId = originator.shortId;
102 var nodeId = originator.nodeId;
103 var extensions = originator.name;
104 var SsTt = originator.S+'/'+originator.s+'/'+originator.T+'/'+originator.t;
105 var nodeKey = originator.nodeKey;
106 var descSize = originator.descSize;
107 var primaryIp = originator.primaryIp;
108 var nbName = originator.nbName;
109 var dev = originator.dev;
110 var nbLocalIp = originator.nbLocalIp;
111 var metric = originator.metric;
112 var lastDesc = originator.lastDesc;
113 var lastRef = originator.lastRef;
114
115 var extrainfo = '<a onclick="displayExtraInfo(\'ip-' + i + '\')"><img src="' + infoicon + '" / ></a>';
116 var extrainfo_link = '<a onclick="displayExtraInfo(\'ip-' + i + '\')">' + '<img src="' + infoicon + '" />' + '</a>';
117
118 extrainfo = '<div id="ip-'+ i +'" class="hideme">'
119 + "<div class='inforow'>"
120 + "<h4><u>" + name + '</u></h4>\n'
121 + 'Node ID: ' + shortId + "</div>"
122 + "<div class='inforow'>"
123 + "<h5>Primary IPv6 address</h5>\n"
124 + primaryIp + "</div>\n"
125 + "<div class='inforow'>"
126 + "<h5>Support & Trust</h5>\n"
127 + SsTt + "</div>\n"
128 + "<div class='inforow'>"
129 + "<h5>Node key</h5>\n"
130 + nodeKey + "</div>\n"
131 + "<div class='inforow newline'>"
132 + "<h5>Via neighbour</h5>\n"
133 + nbName + "</div>\n"
134 + "<div class='inforow'>"
135 + "<h5>Via device</h5>\n"
136 + dev + "</div>\n"
137 + "<div class='inforow'>"
138 + "<h5>Via link-local IPv6</h5>\n"
139 + nbLocalIp + "</div>\n"
140 + "<div class='inforow'>"
141 + "<h5>Route metric</h5>\n"
142 + metric + "</div>\n"
143 + "<div class='inforow'>"
144 + "<h5>Desc. size</h5>\n"
145 + descSize + "</div>\n"
146 + "\n</div>";
147
148 res.push([extrainfo_link, name, shortId, SsTt, primaryIp,
149 nbName, metric, lastDesc, lastRef, extrainfo]);
150 });
151 return res;
152 });
153 //]]></script>
154
155 <%+footer%>