mirror of
https://github.com/openwrt/routing.git
synced 2025-02-23 13:56:13 +00:00
Compile tested: mips_24kc, arm_cortex-a9_vfpv3-d16, i386_pentium4, x86_64, i386_pentium-mmx, mipsel_24kc Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
'use strict';
|
|
'require view';
|
|
'require ui';
|
|
'require rpc';
|
|
'require poll';
|
|
|
|
var callgetData = rpc.declare({
|
|
object: 'status.olsrd2',
|
|
method: 'getAttached_network'
|
|
});
|
|
|
|
function createTable(data) {
|
|
let tableData = [];
|
|
data.attached_network.forEach(row => {
|
|
let node = E('a',{ 'href': 'https://' + row.node + '/cgi-bin-olsrd2-neigh.html'},row.node);
|
|
tableData.push([
|
|
node,
|
|
row.attached_net,
|
|
row.attached_net_src,
|
|
row.domain_metric_out
|
|
])
|
|
});
|
|
return tableData;
|
|
}
|
|
|
|
return view.extend({
|
|
title: _('OLSRD2 networks'),
|
|
handleSaveApply: null,
|
|
handleSave: null,
|
|
handleReset: null,
|
|
|
|
render: function(data) {
|
|
|
|
var tr = E('table', { 'class': 'table' });
|
|
tr.appendChild(E('div', { 'class': 'tr cbi-section-table-titles' }, [
|
|
E('th', { 'class': 'th left' }, [ 'IP address' ]),
|
|
E('th', { 'class': 'th left' }, [ 'Network' ]),
|
|
E('th', { 'class': 'th left' }, [ 'Source' ]),
|
|
E('th', { 'class': 'th left' }, [ 'Metric' ])
|
|
]));
|
|
poll.add(() => {
|
|
Promise.all([
|
|
callgetData()
|
|
]).then((results) => {
|
|
cbi_update_table(tr, createTable(results[0]));
|
|
})
|
|
}, 30);
|
|
return tr
|
|
}
|
|
|
|
});
|