luci2: add missing depends to OpenWrt Makefile
[project/luci2/ui.git] / luci2 / htdocs / luci2 / view / status.routes.js
1 L.ui.view.extend({
2         title: L.tr('Routes'),
3         description: L.tr('The following rules are currently active on this system.'),
4
5         getRoutes: L.rpc.declare({
6                 object: 'luci2.network',
7                 method: 'routes',
8                 expect: { routes: [ ] }
9         }),
10
11         getIPv6Routes: L.rpc.declare({
12                 object: 'luci2.network',
13                 method: 'routes',
14                 expect: { routes: [ ] }
15         }),
16
17         getARPTable: L.rpc.declare({
18                 object: 'luci2.network',
19                 method: 'arp_table',
20                 expect: { entries: [ ] }
21         }),
22
23         execute: function() {
24                 var self = this;
25                 return $.when(
26                         self.getARPTable().then(function(arp) {
27                                 var arpTable = new L.ui.table({
28                                         caption: L.tr('ARP'),
29                                         columns: [{
30                                                 caption: L.tr('IPv4-Address'),
31                                                 key:     'ipaddr'
32                                         }, {
33                                                 caption: L.tr('MAC-Address'),
34                                                 key:     'macaddr'
35                                         }, {
36                                                 caption: L.tr('Interface'),
37                                                 key:     'device'
38                                         }]
39                                 });
40
41                                 arpTable.rows(arp);
42                                 arpTable.insertInto('#arp_table');
43                         }),
44                         self.getRoutes().then(function(routes) {
45                                 var routeTable = new L.ui.table({
46                                         caption: L.tr('Active IPv4-Routes'),
47                                         columns: [{
48                                                 caption: L.tr('Target'),
49                                                 key:     'target'
50                                         }, {
51                                                 caption: L.tr('Gateway'),
52                                                 key:     'nexthop'
53                                         }, {
54                                                 caption: L.tr('Metric'),
55                                                 key:     'metric'
56                                         }, {
57                                                 caption: L.tr('Interface'),
58                                                 key:     'device'
59                                         }]
60                                 });
61
62                                 routeTable.rows(routes);
63                                 routeTable.insertInto('#route_table');
64                         }),
65                         self.getIPv6Routes().then(function(routes) {
66                                 var route6Table = new L.ui.table({
67                                         caption: L.tr('Active IPv6-Routes'),
68                                         columns: [{
69                                                 caption: L.tr('Target'),
70                                                 key:     'target'
71                                         }, {
72                                                 caption: L.tr('Gateway'),
73                                                 key:     'nexthop'
74                                         }, {
75                                                 caption: L.tr('Source'),
76                                                 key:     'source'
77                                         }, {
78                                                 caption: L.tr('Metric'),
79                                                 key:     'metric'
80                                         }, {
81                                                 caption: L.tr('Interface'),
82                                                 key:     'device'
83                                         }]
84                                 });
85
86                                 for (var i = 0; i < routes.length; i++)
87                                 {
88                                         var prefix = routes[i].target.substr(0, 5).toLowerCase();
89                                         if (prefix == 'fe80:' || prefix == 'fe90:' || prefix == 'fea0:' || prefix == 'feb0:' || prefix == 'ff00:')
90                                                 continue;
91
92                                         route6Table.row(routes[i]);
93                                 }
94
95                                 route6Table.insertInto('#route6_table');
96                         })
97                 )
98         }
99 });