diff options
| author | Patrick Grimm <patrick@lunatiki.de> | 2023-01-15 10:43:07 +0100 |
|---|---|---|
| committer | Moritz Warning <moritzwarning@web.de> | 2023-01-23 14:25:30 +0100 |
| commit | d27be8dad93d17b80a057389207ffd1d75c5c683 (patch) | |
| tree | 9d978a4be94eec3670b41872bb7c6051789475ac /luci-app-olsrd2/htdocs | |
| parent | c8ba43a99b67b5a56fe2a1a29bc33e9aa2c3a773 (diff) | |
luci-app-olsrd2: New Package for OLSR2 configuration and status visualisation'
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>
Diffstat (limited to 'luci-app-olsrd2/htdocs')
14 files changed, 611 insertions, 0 deletions
diff --git a/luci-app-olsrd2/htdocs/cgi-bin-olsrd2-neigh.html b/luci-app-olsrd2/htdocs/cgi-bin-olsrd2-neigh.html new file mode 100644 index 0000000..849f55e --- /dev/null +++ b/luci-app-olsrd2/htdocs/cgi-bin-olsrd2-neigh.html @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/public/status/olsrd2/neighbors" /> +</head> +<body style="background-color: black"> +<a style="color: white; text-decoration: none" href="/cgi-bin/luci/public/status/olsrd2/neighbors">LuCI - Lua Configuration Interface</a> +</body> +</html> diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/attachednetwork.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/attachednetwork.js new file mode 100644 index 0000000..af4703b --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/attachednetwork.js @@ -0,0 +1,51 @@ +'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 + } + +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/domain.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/domain.js new file mode 100644 index 0000000..ea9597b --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/domain.js @@ -0,0 +1,32 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'domain', _('domain configuration section')); + s.anonymous = true; + s.addremove = false; + o = s.option(form.Value, "table", _("table defines the routing table for the local routing entries."), "0-254"); + o.optional = true; + o.placeholder = 254; + o.datatype = "range(0,254)"; + o = s.option(form.Value, "protocol", _("protocol defines the protocol number for the local routing entries."), "0-254"); + o.optional = true; + o.placeholder = 100; + o.datatype = "range(0,254)"; + o = s.option(form.Value, "distance", _("distance defines the 'metric' (hopcount) of the local routing entries."), "0-254"); + o.optional = true; + o.placeholder = 2; + o.datatype = "range(0,254)"; + o = s.option(form.Flag, "srcip_routes", _("srcip_routes defines if the router sets the originator address as the source-ip entry into the local routing entries."), ""); + o.optional = true; + o.datatype = "bool"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/global.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/global.js new file mode 100644 index 0000000..d3a9e27 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/global.js @@ -0,0 +1,32 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'global', _('It controls the basic behavior of the OONF core.')); + s.anonymous = true; + s.addremove = false; + + o = s.option(form.Flag, "failfast", _("failfast is another boolean setting which can activate an error during startup if a requested plugin does not load or an unknown configuration variable is set."), ""); + o.optional = true; + o.rmempty = true; + o.datatype = 'bool'; + o = s.option(form.Value, "pidfile", _("pidfile is used together with the fork option to store the pid of the background process in a file."), "Filename"); + o.optional = true; + o.rmempty = true; + o.placeholder = '/var/run/olsrd2.pid'; + o.datatype = 'string'; + o = s.option(form.Value, "lockfile", _("lockfile creates a file on disk and keeps a lock on it as long as the OONF application is running to prevent the application from running multiple times at once."), "Filename"); + o.rmempty = false; + o.optional = true; + o.placeholder = "/var/lock/olsrd2"; + o.datatype = "string"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/interface.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/interface.js new file mode 100644 index 0000000..26e0a89 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/interface.js @@ -0,0 +1,103 @@ +'use strict'; +'require view'; +'require form'; +'require tools.widgets as widgets'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + m.tabbed = true; + s = m.section(form.GridSection, 'interface', _('interface configuration section')); + s.anonymous = true; + s.addremove = true; + s.addbtntitle = _('Add new interface...'); + s.tab('general', _('General Settings')); + s.tab('oonf', _('OONF RFC5444 Plugin')); + s.tab('nhdp', _('NHDP Plugin')); + s.tab('link', _('Link Config Plugin')); + s.modaltitle = function(section_id) { + return _('Interfaces') + ' ยป ' + section_id.toUpperCase(); + }; + + o = s.taboption("general", form.Flag, "ignore", _("Enabled")); + o.enabled = "0"; + o.disabled = "1"; + o.rmempty = false; + o = s.taboption("general", form.Value, "ifname", _("Network"), _("The interface OLSR2 should serve.")); + o.datatype = "string"; + o = s.taboption("oonf", form.DynamicList, "acl", _("acl defines the IP addresses that are allowed to use the RFC5444 socket."), _("ip6prefix, ip4prefix, default_accept, default_reject")); + o.datatype = "string"; + o.optional = true; + o.modalonly = true; + o = s.taboption("oonf", form.DynamicList, "bindto", _("bindto defines the IP addresses which the RFC5444 socket will be bound to."), _("ip6prefix, ip4prefix, default_accept, default_reject")); + o.datatype = "string"; + o.optional = true; + o.modalonly = true; + o = s.taboption("oonf", form.Value, "multicast_v4", _("multicast_v4 defines the IPv4 multicast address used for RFC5444 packets."), _("ip4addr")); + o.datatype = "ip4addr"; + o.placeholder = "224.0.0.109"; + o.optional = true; + o.modalonly = true; + o = s.taboption("oonf", form.Value, "multicast_v6", _("multicast_v6 defines the IPv6 multicast address used for RFC5444 packets."), _("ip6addr")); + o.datatype = "ip6addr"; + o.placeholder = "ff02::6d"; + o.optional = true; + o.modalonly = true; + o = s.taboption("oonf", form.Value, "dscp", _("dscp defines the DSCP value set for each outgoing RFC5444 packet. The value must be between 0 and 252 without fractional digits. The value should be a multiple of 4."), _("0-255")); + o.optional = true; + o.placeholder = 192; + o.datatype = "range(0,255)"; + o.modalonly = true; + o = s.taboption("oonf", form.Value, "rawip", _("rawip defines if the interface should put RFC5444 packets directly into IP headers (skipping the UDP header)."), _("bool")); + o.optional = true; + o.rmempty = true; + o.datatype = "bool"; + o.modalonly = true; + o = s.taboption("nhdp", form.DynamicList, "ifaddr_filter", _("ifaddr_filter defines the IP addresses that are allowed to NHDP interface addresses."), _("ip6prefix, ip4prefix, default_accept, default_reject")); + o.datatype = "string"; + o.optional = true; + o.modalonly = true; + o = s.taboption("nhdp", form.Value, "hello_validity", _("hello_validity defines the time the local HELLO messages will be valid for the neighbors."), _(">0.1 s")); + o.optional = true; + o.placeholder = 20.0; + o.datatype = "and(min(0.1), ufloat)"; + o.modalonly = true; + o = s.taboption("nhdp", form.Value, "hello_interval", _("hello_interval defines the time between two HELLO messages on the interface."), _(">0.1 s")); + o.optional = true; + o.placeholder = 2.0; + o.datatype = "and(min(0.1), ufloat)"; + o.modalonly = true; + o = s.taboption("link", form.Value, "rx_bitrate", _("rx_bitrate")); + o.optional = true; + o.rmempty = false; + o.placeholder = "1G"; + o.datatype = "string"; + o = s.taboption("link", form.Value, "tx_bitrate", _("tx_bitrate")); + o.optional = true; + o.rmempty = false; + o.placeholder = "1G"; + o.datatype = "string"; + o = s.taboption("link", form.Value, "rx_max_bitrate", _("rx_max_bitrate")); + o.optional = true; + o.rmempty = false; + o.placeholder = "1G"; + o.datatype = "string"; + o.modalonly = true; + o = s.taboption("link", form.Value, "tx_max_bitrate", _("tx_max_bitrate")); + o.optional = true; + o.rmempty = false; + o.placeholder = "1G"; + o.datatype = "string"; + o.modalonly = true; + o = s.taboption("link", form.Value, "rx_signal", _("rx_signal")); + o.optional = true; + o.rmempty = false; + o.placeholder = "1G"; + o.datatype = "string"; + o.modalonly = true; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/lan_import.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/lan_import.js new file mode 100644 index 0000000..3839f7b --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/lan_import.js @@ -0,0 +1,25 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'lan_import', _('Automatic import of routing tables as locally attached networks.')); + s.anonymous = true; + s.addremove = true; + o = s.option(form.Value, "name", _("Name"), "Text"); + o.datatype = "string"; + o = s.option(form.Value, "interface", _("Interface"), "Name Interface"); + o.datatype = "string"; + o = s.option(form.Value, "table", _("IP Table"), "1-255"); + o.datatype = "range(1,255)"; + o = s.option(form.Value, "protocol", _("IP protocol"), "1-255"); + o.datatype = "range(1,255)"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/log.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/log.js new file mode 100644 index 0000000..f8fe2b5 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/log.js @@ -0,0 +1,37 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'log', _('OONF Logging')); + s.anonymous = true; + s.addremove = false; + + o = s.option(form.Flag, "syslog", _("syslog are boolean options that activate or deactivate the syslog Logging Target."), ""); + o.optional = true; + o.datatype = "bool"; + o = s.option(form.Flag, "stderr", _("stderr are boolean options that activate or deactivate the stderr Logging Target."), ""); + o.optional = true; + o.datatype = "bool"; + o = s.option(form.Value, "file", _("file asks for a filename for logging output"),"Filename"); + o.rmempty = false; + o.optional = true; + o.placeholder = "/tmp/olsrd2.log"; + o.datatype = "string"; + o = s.option(form.Value, "debug", _("debug ask for a list of Logging Sources that will be logged by the OONF Core Logging Targets.")); + o.rmempty = false; + o.optional = true; + o.datatype = "string"; + o = s.option(form.Value, "info", _("info ask for a list of Logging Sources that will be logged by the OONF Core Logging Targets.")); + o.rmempty = false; + o.optional = true; + o.datatype = "string"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/luci.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/luci.js new file mode 100644 index 0000000..7348040 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/luci.js @@ -0,0 +1,22 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('luci_olsrd2', 'Luci options'); + + s = m.section(form.TypedSection, 'olsrd2', _('LUCI')); + s.anonymous = true; + s.addremove = false; + + o = s.option(form.Flag, "resolve", _("do Hostname lookup"), ""); + o.datatype = "bool"; + o = s.option(form.Value, "domain", _("optional Public domain forwarding with dnsmasq-full (auth-zone=example.com) on the internetgateway "), "default is olsr"); + o.datatype = "string"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/mesh.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/mesh.js new file mode 100644 index 0000000..763068b --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/mesh.js @@ -0,0 +1,29 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'mesh', _('mesh configuration section')); + s.anonymous = true; + s.addremove = false; + o = s.option(form.Value, "port", _("port defines the UDP port number of the RFC5444 socket."), "1-65535"); + o.optional = true; + o.placeholder = 269; + o.datatype = "range(1,65535)"; + o = s.option(form.Value, "ip_proto", _("ip_proto defines the IP protocol number that can be used for RFC5444 communication."), "1-255"); + o.optional = true; + o.placeholder = 138; + o.datatype = "range(1,255)"; + o = s.option(form.Value, "aggregation_interval", _("aggregation_interval defines the time the local RFC5444 implementation will keep messages to aggregate them before creating a new RFC5444 packet to forward them."), ">0.1 s"); + o.optional = true; + o.placeholder = 1.0; + o.datatype = "and(min(0.1), ufloat)"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/neighbors.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/neighbors.js new file mode 100644 index 0000000..e38af4a --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/neighbors.js @@ -0,0 +1,58 @@ +'use strict'; +'require view'; +'require ui'; +'require rpc'; +'require poll'; + +var callgetData = rpc.declare({ + object: 'status.olsrd2', + method: 'getNeighbors' +}); + +function createTable(data) { + let tableData = []; + data.neighbors.forEach(row => { + let hostname = E('a',{ 'href': 'https://' + row.hostname + '/cgi-bin-olsrd2-neigh.html'},row.hostname); + let orginator = E('a',{ 'href': 'https://[' + row.originator + ']/cgi-bin-olsrd2-neigh.html'},row.originator); + tableData.push([ + hostname, + orginator, + row.lladdr, + row.interface, + row.metric_in, + row.metric_in_raw + ]) + }); + return tableData; +}; + +return view.extend({ + title: _('OLSRD2 mesh neighbors'), + handleSaveApply: null, + handleSave: null, + handleReset: null, + + + render: function(data) { + + var tr = E('table', { 'class': 'table' }); + tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ + E('th', { 'class': 'th left' }, [ 'Hostname' ]), + E('th', { 'class': 'th left' }, [ 'Orginator' ]), + E('th', { 'class': 'th left' }, [ 'MAC' ]), + E('th', { 'class': 'th left' }, [ 'Interface' ]), + E('th', { 'class': 'th left' }, [ 'Metric' ]), + E('th', { 'class': 'th left' }, [ 'raw' ]) + ])); + poll.add(() => { + Promise.all([ + callgetData() + ]).then((results) => { + cbi_update_table(tr, createTable(results[0])); + }) + }, 30); + return tr + + } + +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/node.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/node.js new file mode 100644 index 0000000..982d5a5 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/node.js @@ -0,0 +1,46 @@ +'use strict'; +'require view'; +'require ui'; +'require rpc'; +'require poll'; + +var callgetData = rpc.declare({ + object: 'status.olsrd2', + method: 'getNode' +}); + +function createTable(data) { + let tableData = []; + data.node.forEach(row => { + let node = E('a',{ 'href': 'https://' + row.node + '/cgi-bin-olsrd2-neigh.html'},row.node); + tableData.push([ + node + ]) + }); + return tableData; +}; + +return view.extend({ + title: _('OLSRD2 mesh nodes'), + handleSaveApply: null, + handleSave: null, + handleReset: null, + + render: function(data) { + + var tr = E('table', { 'class': 'table' }); + tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ + E('th', { 'class': 'th left' }, [ 'IP Address' ]) + ])); + poll.add(() => { + Promise.all([ + callgetData() + ]).then((results) => { + cbi_update_table(tr, createTable(results[0])); + }) + }, 30); + + return tr; + } + +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2.js new file mode 100644 index 0000000..ae12e33 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2.js @@ -0,0 +1,60 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'olsrv2', _('the OLSRv2 implementation including the OLSRv2 API for other plugins.')); + s.anonymous = true; + s.addremove = false; + + o = s.option(form.Value, "tc_interval", _("defines the time between two TC messages."), "s"); + o.optional = true; + o.placeholder = 5.0; + o.datatype = "ufloat"; + o = s.option(form.Value, "tc_validity", _("tc_validity defines the validity time of the TC messages."), "s"); + o.optional = true; + o.placeholder = 300.0; + o.datatype = "ufloat"; + o = s.option(form.Value, "forward_hold_time", _("forward_hold_time defines the time until the router will forget an entry in its forwarding duplicate database."), "s"); + o.optional = true; + o.placeholder = 300.0; + o.datatype = "ufloat"; + o = s.option(form.Value, "processing_hold_time", _("processing_hold_time defines the time until the router will forget an entry in its processing duplicate database."), "s"); + o.optional = true; + o.placeholder = 300.0; + o.datatype = "ufloat"; + o = s.option(form.DynamicList, "routable", _("routable defines the ACL which declares an IP address routable. Other IP addresses will not be included in TC messages."), "ip6prefix, ip4prefix, default_accept, default_reject"); + o.datatype = "string"; +//TODO +//svc.datatype = "or(negm(ip6addr), negm(ip4addr), 'default_accept', 'default_reject')" +//modules/luci-base/htdocs/luci-static/resources/cbi.js:545 +// negm: function() { +// return this.apply('or', this.value.replace(/^[ \t]*-[ \t]*/, ''), arguments); +// }, + //modules/luci-base/luasrc/cbi/datatypes.lua:51 +//function negm(v, ...) +// return _M['or'](v:gsub("^%s*-%s*", ""), ...) +//end + o.optional = true; + o = s.option(form.DynamicList, "originator", _("originator defines the ACL which declares a valid originator IP address for the router."), "ip6prefix, ip4prefix, default_accept, default_reject"); + o.datatype = "string"; +//TODO +//svc.datatype = "or(negm(ip6addr), negm(ip4addr), 'default_accept', 'default_reject')" +//modules/luci-base/htdocs/luci-static/resources/cbi.js:545 +// negm: function() { +// return this.apply('or', this.value.replace(/^[ \t]*-[ \t]*/, ''), arguments); +// }, + //modules/luci-base/luasrc/cbi/datatypes.lua:51 +//function negm(v, ...) +// return _M['or'](v:gsub("^%s*-%s*", ""), ...) +//end + o.optional = true; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2_lan.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2_lan.js new file mode 100644 index 0000000..f846c77 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/olsrv2_lan.js @@ -0,0 +1,32 @@ +'use strict'; +'require view'; +'require form'; + +return view.extend({ + render: function() { + var m, s, o; + + m = new form.Map('olsrd2', 'OLSRD2 Daemon'); + + s = m.section(form.TypedSection, 'olsrv2_lan', _('Prefix configuration section')); + s.anonymous = true; + s.addremove = true; + o = s.option(form.Value, "name", _("Name"), "Text"); + o.datatype = "string"; + o = s.option(form.Value, "prefix", _("locally attached network prefix"), ""); + o.datatype = "string"; + o = s.option(form.Value, "domain", _("domain for this LAN entry, -1 for all domains"), "-1-254"); + o.optional = true; + o.placeholder = -1; + o.datatype = "range(-1,254)"; + o = s.option(form.Value, "metric", _("metric value for this LAN entry"), "0-254"); + o.optional = true; + o.placeholder = 2; + o.datatype = "range(0,254)"; + o = s.option(form.Flag, "source_prefix", _("source prefix for lan (source specific routing)"), ""); + o.optional = true; + o.datatype = "bool"; + + return m.render(); + } +}); diff --git a/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/overview.js b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/overview.js new file mode 100644 index 0000000..29500e1 --- /dev/null +++ b/luci-app-olsrd2/htdocs/luci-static/resources/view/olsrd2/overview.js @@ -0,0 +1,74 @@ +'use strict'; +'require view'; +'require ui'; +'require rpc'; +'require poll'; + +var callgetVersion = rpc.declare({ + object: 'status.olsrd2', + method: 'getVersion' +}); +var callgetLan = rpc.declare({ + object: 'status.olsrd2', + method: 'getLan' +}); + +function createTable(data) { + let tableData = []; + if ( data && data[0] && data[0].version && data[0].version[0] ) { + if ( data[0].version[0].version_text != undefined ) { + tableData.push([_('Version'),data[0].version[0].version_text]); + } + if ( data[0].version[0].version_commit != undefined) { + tableData.push([_('GIT commit'),data[0].version[0].version_commit]); + } + } + if ( data && data[1] && data[1].lan && data[1].lan[0] ) { + if ( data[1].lan[0].lan != undefined ) { + tableData.push([_('LAN IP'),data[1].lan[0].lan]); + } + if ( data[1].lan[0].domain != undefined) { + tableData.push([_('Domain'),data[1].lan[0].domain]); + } + if ( data[1].lan[0].domain_metric != undefined) { + tableData.push([_('Domain metric'),data[1].lan[0].domain_metric]); + } + if ( data[1].lan[0].domain_metric_out != undefined) { + tableData.push([_('Domain metric outgoing'),data[1].lan[0].domain_metric_out]); + } + if ( data[1].lan[0].domain_metric_out_raw != undefined) { + tableData.push([_('domain_metric_out_raw'),data[1].lan[0].domain_metric_out_raw]); + } + if ( data[1].lan[0].domain_distance != undefined) { + tableData.push([_('Domain distance'),data[1].lan[0].domain_distance]); + } + } + return tableData; +} + +return view.extend({ + title: _('Version'), + handleSaveApply: null, + handleSave: null, + handleReset: null, + + render: function() { + + var tr = E('table',{ 'class': 'table'}); + tr.appendChild(E('tr', { 'class': 'tr cbi-section-table-titles' }, [ + E('th', { 'class': 'th left' }), + E('th', { 'class': 'th left' }) + ])); + poll.add(() => { + Promise.all([ + callgetVersion(), + callgetLan() + ]).then((results) => { + cbi_update_table(tr, createTable(results)); + }) + }, 30); + + return tr; + } + +}); |
