cosmetics
[tomato.git] / release / src / router / www / bwm-client.asp
blobcc43f83a8a3d5634bdd9712a6db773d4e0be4ff6
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Bandwidth: Real-Time Client Monitor</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <% css(); %>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <style type='text/css'>
22 #txt {
23 width: 550px;
24 white-space: nowrap;
26 #bwm-controls {
27 text-align: right;
28 margin-right: 5px;
29 margin-top: 5px;
30 float: right;
31 visibility: hidden;
33 ul.tabs a,
34 #tabs a {
35 width: 140px;
36 height: 12px;
37 font-size: 9px;
39 </style>
41 <script type='text/javascript' src='debug.js'></script>
43 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
44 <script type='text/javascript' src='bwm-common.js'></script>
46 <script type='text/javascript'>
47 // <% nvram("wan_ifname,lan_ifname,wl_ifname,wan_proto,wan_iface,web_svg,rstats_colors,bwm_client"); %>
49 var cprefix = 'bwcm_r';
50 var updateInt = 2;
51 var updateDiv = updateInt;
52 var updateMaxL = 300;
53 var updateReTotal = 1;
54 var prev = [];
55 var debugTime = 0;
56 var avgMode = 0;
57 var wdog = null;
58 var wdogWarn = null;
60 var ref = new TomatoRefresh('update.cgi', 'exec=climon', updateInt);
62 ref.stop = function() {
63 this.timer.start(1000);
66 ref.refresh = function(text) {
67 var c, i, h, n, j, k, l;
69 watchdogReset();
71 ++updating;
72 try {
73 climon = null;
74 eval(text);
76 n = (new Date()).getTime();
77 if (this.timeExpect) {
78 if (debugTime) E('dtime').innerHTML = (this.timeExpect - n) + ' ' + ((this.timeExpect + 1000*updateInt) - n);
79 this.timeExpect += 1000*updateInt;
80 this.refreshTime = MAX(this.timeExpect - n, 500);
82 else {
83 this.timeExpect = n + 1000*updateInt;
86 for (i in climon) {
87 c = climon[i];
88 if ((p = prev[i]) != null) {
89 h = speed_history[i];
91 h.rx.splice(0, 1);
92 h.rx.push((c.rx < p.rx) ? (c.rx + (0xFFFFFFFF - p.rx)) : (c.rx - p.rx));
94 h.tx.splice(0, 1);
95 h.tx.push((c.tx < p.tx) ? (c.tx + (0xFFFFFFFF - p.tx)) : (c.tx - p.tx));
97 else if (!speed_history[i]) {
98 speed_history[i] = {};
99 h = speed_history[i];
100 h.rx = [];
101 h.tx = [];
102 for (j = 300; j > 0; --j) {
103 h.rx.push(0);
104 h.tx.push(0);
106 h.count = 0;
108 prev[i] = c;
110 loadData();
112 catch (ex) {
114 --updating;
117 function watchdog() {
118 watchdogReset();
119 ref.stop();
120 wdogWarn.style.display = '';
123 function watchdogReset() {
124 if (wdog) clearTimeout(wdog)
125 wdog = setTimeout(watchdog, 5000*updateInt);
126 wdogWarn.style.display = 'none';
129 function init() {
130 if (nvram.bwm_client.length > 0) {
131 E('sesdiv').style.display = '';
133 populateCache();
135 speed_history = [];
137 initCommon(2, 1, 1);
139 wdogWarn = E('warnwd');
140 watchdogReset();
142 ref.start();
145 </script>
147 </head>
148 <body onload='init()'>
149 <form>
150 <table id='container' cellspacing=0>
151 <tr><td colspan=2 id='header'>
152 <div class='title'>Tomato</div>
153 <div class='version'>Version <% version(); %></div>
154 </td></tr>
155 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
156 <td id='content'>
157 <div id='ident'><% ident(); %></div>
159 <!-- / / / -->
160 <script type='text/javascript'>
161 if (nvram.bwm_client.length < 1) {
162 W('<i>You need to <a href="basic-static.asp">configure</a> which LAN clients/devices should be monitored before coming back to this page.</i>');
164 </script>
165 <div id='sesdiv' style='display:none'>
167 <div id='rstats'>
168 <div id='tab-area'></div>
170 <script type='text/javascript'>
171 if (nvram.web_svg != '0') {
172 // without a div, Opera 9 moves svgdoc several pixels outside of <embed> (?)
173 W("<div style='border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0;visibility:hidden;padding:0;margin:0' id='graph'><embed src='bwm-graph.svg?<% version(); %>' style='width:760px;height:300px;margin:0;padding:0' type='image/svg+xml' pluginspage='http://www.adobe.com/svg/viewer/install/'></embed></div>");
175 </script>
177 <div id='bwm-controls'>
178 <small>(<script type='text/javascript'>W(5*updateInt);</script> minute window, <script type='text/javascript'>W(updateInt);</script> second interval)</small><br>
179 <br>
180 Avg:&nbsp;
181 <a href='javascript:switchAvg(1)' id='avg1'>Off</a>,
182 <a href='javascript:switchAvg(2)' id='avg2'>2x</a>,
183 <a href='javascript:switchAvg(4)' id='avg4'>4x</a>,
184 <a href='javascript:switchAvg(6)' id='avg6'>6x</a>,
185 <a href='javascript:switchAvg(8)' id='avg8'>8x</a><br>
186 Max:&nbsp;
187 <a href='javascript:switchScale(0)' id='scale0'>Uniform</a>,
188 <a href='javascript:switchScale(1)' id='scale1'>Per Client</a><br>
189 Display:&nbsp;
190 <a href='javascript:switchDraw(0)' id='draw0'>Solid</a>,
191 <a href='javascript:switchDraw(1)' id='draw1'>Line</a><br>
192 Color:&nbsp; <a href='javascript:switchColor()' id='drawcolor'>-</a><br>
193 <small><a href='javascript:switchColor(1)' id='drawrev'>[reverse]</a></small><br>
195 <br><br>
196 &nbsp; &raquo; <a href="basic-static.asp">Configure</a>
197 </div>
199 <br><br>
200 <table border=0 cellspacing=2 id='txt'>
201 <tr>
202 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='rx-name'>RX</b></td>
203 <td width='15%' align='right' valign='top'><span id='rx-current'></span></td>
204 <td width='8%' align='right' valign='top'><b>Avg</b></td>
205 <td width='15%' align='right' valign='top' id='rx-avg'></td>
206 <td width='8%' align='right' valign='top'><b>Peak</b></td>
207 <td width='15%' align='right' valign='top' id='rx-max'></td>
208 <td width='8%' align='right' valign='top'><b>Total</b></td>
209 <td width='14%' align='right' valign='top' id='rx-total'></td>
210 <td>&nbsp;</td>
211 </tr>
212 <tr>
213 <td width='8%' align='right' valign='top'><b style='border-bottom:blue 1px solid' id='tx-name'>TX</b></td>
214 <td width='15%' align='right' valign='top'><span id='tx-current'></span></td>
215 <td width='8%' align='right' valign='top'><b>Avg</b></td>
216 <td width='15%' align='right' valign='top' id='tx-avg'></td>
217 <td width='8%' align='right' valign='top'><b>Peak</b></td>
218 <td width='15%' align='right' valign='top' id='tx-max'></td>
219 <td width='8%' align='right' valign='top'><b>Total</b></td>
220 <td width='14%' align='right' valign='top' id='tx-total'></td>
221 <td>&nbsp;</td>
222 </tr>
223 </table>
224 </div>
225 <br>
226 <br>
228 <!-- / / / -->
230 </td></tr>
231 <tr><td id='footer' colspan=2>
232 <span id='warnwd' style='display:none'>Warning: 10 second timeout, restarting...&nbsp;</span>
233 <span id='dtime'></span>
234 <img src='spin.gif' id='refresh-spinner' onclick='javascript:debugTime=1'>
236 </div>
237 </td></tr>
238 </table>
239 </form>
240 </body>
241 </html>