c6920f96c8fb1c51cf8e7738e96e08aa2acef174
[feed/routing.git] / luci-app-bmx7 / files / usr / lib / lua / luci / view / bmx7 / status_j.htm
1 <%+header%>
2 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
3 <script type="text/javascript" src="<%=resource%>/bmx7/js/polling.js"></script>
4
5 <style>
6 div.hideme{
7 display: none;
8 }
9
10 div.info{
11 background: #FFF;
12 border: solid 1px;
13 height: 80px;
14 display: block;
15 overflow: auto;
16 }
17
18 div.inforow{
19 text-align:left;
20 display:inline-block;
21 width:20%;
22 margin:5px;
23 vertical-align:top;
24 }
25
26 #extra-info ul { list-style: none outside none; margin-left: 0em; }
27 </style>
28
29 <div class="cbi-map">
30 <center>
31 <img src="<%=resource%>/bmx7/bmx7logo.png" />
32 <br />
33 <br />
34 A mesh routing protocol for Linux devices.<br />
35 Visit <a href="http://bmx6.net">bmx6.net</a> for more information.<br />
36 <br />
37 </center>
38
39 <div class="cbi-map-descr"></div>
40
41 <fieldset class="cbi-section">
42 <legend><%:Node configuration%></legend>
43 <table class="cbi-section-table" id="config_table">
44 <tr class="cbi-section-table-titles">
45 <th class="cbi-section-table-cell"><%:Short ID%></th>
46 <th class="cbi-section-table-cell"><%:Node name%></th>
47 <th class="cbi-section-table-cell"><%:Primary IPv6 address%></th>
48 <th class="cbi-section-table-cell"><%:Node key%></th>
49 <th class="cbi-section-table-cell"><%:BMX7 revision%></th>
50 </tr>
51 <tr class="cbi-section-table-row">
52 <td colspan="5"><em><br /><%:Collecting data...%></em></td>
53 </tr>
54 </table>
55 </fieldset>
56
57 <fieldset class="cbi-section">
58 <legend><%:Node status%></legend>
59 <table class="cbi-section-table" id="status_table">
60 <tr class="cbi-section-table-titles">
61 <th class="cbi-section-table-cell"><%:Nodes seen%></th>
62 <th class="cbi-section-table-cell"><%:Neighbours%></th>
63 <th class="cbi-section-table-cell"><%:Tunnelled IPv6 address%></th>
64 <th class="cbi-section-table-cell"><%:Tunnelled IPv4 address%></th>
65 <th class="cbi-section-table-cell"><%:Uptime%></th>
66 <th class="cbi-section-table-cell"><%:CPU usage%></th>
67 <th class="cbi-section-table-cell"><%:Memory usage%></th>
68 <th class="cbi-section-table-cell"><%:Tx queue%></th>
69
70 </tr>
71 <tr class="cbi-section-table-row">
72 <td colspan="8"><em><br /><%:Collecting data...%></em></td>
73 </tr>
74 </table>
75 </fieldset>
76
77 <fieldset class="cbi-section">
78 <legend><%:Interfaces%></legend>
79 <table class="cbi-section-table" id="ifaces_table">
80 <tr class="cbi-section-table-titles">
81 <th class="cbi-section-table-cell"><%:Interface%></th>
82 <th class="cbi-section-table-cell"><%:State%></th>
83 <th class="cbi-section-table-cell"><%:Type%></th>
84 <th class="cbi-section-table-cell"><%:Max. rate%></th>
85 <th class="cbi-section-table-cell"><%:Link-local IPv6 address%></th>
86 <th class="cbi-section-table-cell"><%:Rx BpP%></th>
87 <th class="cbi-section-table-cell"><%:Tx BpP%></th>
88
89 </tr>
90 <tr class="cbi-section-table-row">
91 <td colspan="7"><em><br /><%:Collecting data...%></em></td>
92 </tr>
93 </table>
94 </fieldset>
95
96 <fieldset class="cbi-section">
97 <legend><%:Links%></legend>
98 <table class="cbi-section-table" id="links_table">
99 <tr class="cbi-section-table-titles">
100 <th class="cbi-section-table-cell"><%:Short ID%></th>
101 <th class="cbi-section-table-cell"><%:Name%></th>
102 <th class="cbi-section-table-cell"><%:Link key%></th>
103 <th class="cbi-section-table-cell"><%:Remote link-local IPv6 address%></th>
104 <th class="cbi-section-table-cell"><%:Device%></th>
105 <th class="cbi-section-table-cell"><%:Rx rate%></th>
106 <th class="cbi-section-table-cell"><%:Tx rate%></th>
107 <th class="cbi-section-table-cell"><%:Routes%></th>
108
109 </tr>
110 <tr class="cbi-section-table-row">
111 <td colspan="8"><em><br /><%:Collecting data...%></em></td>
112 </tr>
113 </table>
114 </fieldset>
115
116
117 </div>
118
119 <script type="text/javascript">//<![CDATA[
120 new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "config_table", function(st){
121 var res = Array();
122 var sta = st.info[0].status;
123 var ifaces = st.info[1].interfaces;
124
125 res.push([sta.shortId, sta.name, sta.primaryIp, sta.nodeKey, sta.revision]);
126 res.push(['','','','',''])
127 res.push(['','','','',''])
128
129 return res;
130 });
131
132
133 new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "status_table", function(st){
134 var res = Array();
135 var sta = st.info[0].status;
136 var mem = st.info[3].memory;
137
138 var txQ = sta.txQ.split('/');
139 console.log(txQ)
140
141 var ptxQ = '<p style="color:rgb('+parseInt(255*txQ[0]/txQ[1])+','+parseInt(128*(txQ[1]-txQ[0])/txQ[1])+',0)")>'+sta.txQ+'</p>';
142 console.log(ptxQ)
143
144 res.push([sta.nodes, sta.nbs, sta.tun6Address, sta.tun4Address, sta.uptime, sta.cpu, mem.bmx7, ptxQ]);
145
146 res.push(['','','','','','','',''])
147 res.push(['','','','','','','',''])
148
149 return res;
150 });
151
152 new TablePooler(1,"/cgi-bin/bmx7-info", {'$info':''}, "ifaces_table", function(st){
153 var res = Array();
154 var sta = st.info[0].status;
155 var ifaces = st.info[1].interfaces;
156
157 ifaces.forEach(function(iface){
158 res.push([iface.dev, iface.state, iface.type, iface.rateMax, iface.localIp, iface.rxBpP, iface.txBpP]);
159 });
160 res.push(['','','','','','',''])
161 if (ifaces.length % 2 == 0)
162 res.push('')
163 res.push(['','','','','','',''])
164 return res;
165 });
166
167 new TablePooler(1,"/cgi-bin/bmx7-info", {'links':''}, "links_table", function(st){
168 var res = Array();
169 links = st.links;
170
171 links.forEach(function(link){
172 res.push([link.shortId, link.name, link.linkKey, link.nbLocalIp, link.dev, link.rxRate, link.txRate, link.routes]);
173 });
174 res.push(['','','','','','','',''])
175 if (links.length % 2 == 0)
176 res.push([])
177 res.push(['','','','','','','',''])
178 return res;
179 });
180 //]]></script>
181
182 <%+footer%>