blob: 9a986482b9ca4b0fb1e464f88857f4c1bf6cbf47 [file] [log] [blame]
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -08001function prefix()
2{
3 var tmp = document.getElementById("prefixcontent").innerHTML;
4 var data = tmp.split("END");
5 var odd = "odd";
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -08006
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -08007 for (var i in data) {
8 // Parse the JSON data.
9 var obj = jQuery.parseJSON(data[i]);
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080010
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080011 if (i % 2 == 0) {
12 odd = "";
13 }
14 else {
15 odd = "odd";
16 }
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080017
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080018 // Create the HTML for each prefix.
19 var output = '<tr class="' + odd + '">\n';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080020
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080021 output +=
22 '<td rowspan="' + obj.prefixes.length + '">' + obj.router + '</td>';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080023
24
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080025 for (var i in obj.prefixes) {
26 output += '<td class="' + odd + '">' + obj.prefixes[i].timestamp + '</td>';
27 output += '<td class="' + odd + '">' + obj.prefixes[i].prefix + '</td>';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080028
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080029 if (obj.prefixes[i].status == "notintopology") {
30 output += '<td id="' + obj.prefixes[i].status + '">NPT</td>';
31 }
32 else {
33 output += '<td id="' + obj.prefixes[i].status + '">' +
34 obj.prefixes[i].status + '</td>';
35 }
36
37 output += '</tr>';
38 }
39
40 // Append the data to the prefix table.
41 $('.one > tbody:last').append(output);
42 }
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080043}
44
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080045function link()
46{
47 var tmp = document.getElementById("linkcontent").innerHTML;
48 var data = tmp.split("END");
49 var odd = "odd";
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080050
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080051 for (var i in data) {
52 // Parse the JSON data.
53 var obj = jQuery.parseJSON(data[i]);
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080054
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080055 if (i % 2 == 0) {
56 odd = "";
57 }
58 else {
59 odd = "odd";
60 }
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080061
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080062 // Create the HTML for each prefix.
63 var output = '<tr class="' + odd + '">\n';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080064
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080065 output += '<td rowspan="' + obj.links.length + '">' + obj.router + '</td>';
66 output +=
67 '<td rowspan="' + obj.links.length + '">' + obj.timestamp + '</td>';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080068
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080069 for (var i in obj.links) {
70 output +=
71 '<td id="' + obj.links[i].status + '">' + obj.links[i].link + '</td>';
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080072
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080073 if (obj.links[i].status == "notintopology") {
74 output += '<td id="' + obj.links[i].status + '">NPT</td>';
75 }
76 else {
77 output += '<td id="' + obj.links[i].status + '">' +
78 obj.links[i].status + '</td>';
79 }
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080080
Alexander Afanasyeveda3b7a2016-12-25 11:26:40 -080081 output += '</tr>';
82 }
83
84 // Append the data to the prefix table.
85 $('.two > tbody:last').append(output);
86 }
Zhenkai Zhu5c2475b2013-02-26 22:57:31 -080087}