97d6e0ec14372f4a6ad454169e2b15a913a500a8
[feed/routing.git] / packages / bmx6-luci / files / usr / lib / lua / luci / view / admin_status / index / neighbours_simple.htm
1 <script type="text/javascript">//<![CDATA[
2
3 XHR.poll(5, '/cgi-bin/bmx6-info', { '$neighbours': '' },
4 function(x, st)
5 {
6 var originators = st.neighbours[0].originators;
7 var descriptions = st.neighbours[1].descriptions;
8
9 var tb = document.getElementById('descriptions_table');
10
11 if ( originators.length != descriptions.length )
12 {
13 var tr = tb.insertRow(-1);
14 tr.className = 'cbi-section-table-row';
15 var td = tr.insertCell(-1);
16 td.colSpan = 7;
17 td.innerHTML = '<em><br /><%:Some problem with JSON: lenght of originators and descriptions different. %></em>';
18 return 1;
19 }
20
21 if ( originators && descriptions && tb)
22 {
23 /* clear all rows */
24 while( tb.rows.length > 1 )
25 tb.deleteRow(1);
26
27 for( var i = 0; i < descriptions.length; i++ )
28 {
29 var tr = tb.insertRow(-1);
30 tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
31 tr.insertCell(-1).innerHTML = descriptions[i].DESC_ADV.globalId.replace(/\.[^\.]+$/,"");
32
33 var extensions = descriptions[i].DESC_ADV.extensions;
34
35 //Looking for the extensions
36 var hna6 = [];
37 for( var e = 0; e < extensions.length; e++)
38 {
39 if( extensions[e].HNA6_EXTENSION )
40 {
41 hna6 = extensions[e].HNA6_EXTENSION;
42 break;
43 }
44 }
45
46 //Adding first HNA with prefix=128 as main address
47 var ipstxt = '';
48 var address;
49 var prefix;
50
51 for( var e = 0; e < hna6.length; e++ )
52 {
53 address = hna6[e].address;
54 prefix = hna6[e].prefixlen;
55 if ( prefix == '128' )
56 {
57 ipstxt += address;
58 break;
59 }
60 }
61
62 tr.insertCell(-1).innerHTML = ipstxt;
63
64 tr.insertCell(-1).innerHTML = originators[i].viaDev;
65 tr.insertCell(-1).innerHTML = originators[i].metric;
66 tr.insertCell(-1).innerHTML = originators[i].lastDesc;
67 tr.insertCell(-1).innerHTML = originators[i].lastRef;
68 tr.insertCell(-1).innerHTML = originators[i].blocked;
69
70 }
71
72 if( tb.rows.length == 1 )
73 {
74 var tr = tb.insertRow(-1);
75 tr.className = 'cbi-section-table-row';
76
77 var td = tr.insertCell(-1);
78 td.colSpan = 7;
79 td.innerHTML = '<em><br /><%:There are no nodes available.%></em>';
80 }
81 }
82 }
83 );
84 //]]></script>
85
86 <div class="cbi-map">
87
88 <fieldset class="cbi-section">
89 <legend><%:Mesh nodes%></legend>
90 <table class="cbi-section-table" id="descriptions_table">
91 <tr class="cbi-section-table-titles">
92 <th class="cbi-section-table-cell"><%:Hostname%></th>
93 <th class="cbi-section-table-cell"><%:Primary IP%></th>
94 <th class="cbi-section-table-cell"><%:Via Device%></th>
95 <th class="cbi-section-table-cell"><%:Metric%></th>
96 <th class="cbi-section-table-cell"><%:Last Desc%></th>
97 <th class="cbi-section-table-cell"><%:Last Ref%></th>
98 <th class="cbi-section-table-cell"><%:Blocked%></th>
99 </tr>
100 <tr class="cbi-section-table-row">
101 <td colspan="7"><em><br /><%:Collecting data...%></em></td>
102 </tr>
103 </table>
104 </fieldset>
105
106 </div>
107
108