summaryrefslogtreecommitdiff
path: root/luci2
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-10-13 22:38:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-10-13 22:38:59 +0000
commit5abf327e7b688454224f15aab71b65f33ebfd0ba (patch)
treebc5ce24374cf69249ae3e64153765907c6d69816 /luci2
parentc59141ddc324d259467d08ec222b4041b24f68f5 (diff)
downloadluci2-ui-5abf327e7b688454224f15aab71b65f33ebfd0ba.tar.gz
luci2: add network routes view
Diffstat (limited to 'luci2')
-rw-r--r--luci2/htdocs/luci2/template/network.routes.htm1
-rw-r--r--luci2/htdocs/luci2/view/network.routes.js103
-rw-r--r--luci2/share/menu.d/network.json6
3 files changed, 110 insertions, 0 deletions
diff --git a/luci2/htdocs/luci2/template/network.routes.htm b/luci2/htdocs/luci2/template/network.routes.htm
new file mode 100644
index 0000000..ad19e7d
--- /dev/null
+++ b/luci2/htdocs/luci2/template/network.routes.htm
@@ -0,0 +1 @@
+<div id="map"></div>
diff --git a/luci2/htdocs/luci2/view/network.routes.js b/luci2/htdocs/luci2/view/network.routes.js
new file mode 100644
index 0000000..4c23a69
--- /dev/null
+++ b/luci2/htdocs/luci2/view/network.routes.js
@@ -0,0 +1,103 @@
+L.ui.view.extend({
+ title: L.tr('Routes'),
+ description: L.tr('Routes specify over which interface and gateway a certain host or network can be reached.'),
+
+ execute: function() {
+ var self = this;
+ return L.network.listNetworkNames().then(function(list) {
+ var m = new L.cbi.Map('network', {
+ readonly: !self.options.acls.network
+ });
+
+ var s4 = m.section(L.cbi.TableSection, 'route', {
+ caption: L.tr('Static IPv4 Routes'),
+ anonymous: true,
+ addremove: true,
+ add_caption: L.tr('Add new route'),
+ remove_caption: L.tr('Remove route')
+ });
+
+ var ifc = s4.option(L.cbi.ListValue, 'interface', {
+ caption: L.tr('Interface')
+ });
+
+ for (var i = 0; i < list.length; i++)
+ ifc.value(list[i]);
+
+ s4.option(L.cbi.InputValue, 'target', {
+ caption: L.tr('Target'),
+ datatype: 'ip4addr'
+ });
+
+ s4.option(L.cbi.InputValue, 'netmask', {
+ caption: L.tr('IPv4-Netmask'),
+ datatype: 'ip4addr',
+ placeholder: '255.255.255.255',
+ optional: true
+ });
+
+ s4.option(L.cbi.InputValue, 'gateway', {
+ caption: L.tr('IPv4-Gateway'),
+ datatype: 'ip4addr',
+ optional: true
+ });
+
+ s4.option(L.cbi.InputValue, 'metric', {
+ caption: L.tr('Metric'),
+ datatype: 'range(0,255)',
+ placeholder: 0,
+ optional: true
+ });
+
+ s4.option(L.cbi.InputValue, 'mtu', {
+ caption: L.tr('MTU'),
+ datatype: 'range(64,9000)',
+ placeholder: 1500,
+ optional: true
+ });
+
+
+ var s6 = m.section(L.cbi.TableSection, 'route6', {
+ caption: L.tr('Static IPv6 Routes'),
+ anonymous: true,
+ addremove: true,
+ add_caption: L.tr('Add new route'),
+ remove_caption: L.tr('Remove route')
+ });
+
+ var ifc = s6.option(L.cbi.ListValue, 'interface', {
+ caption: L.tr('Interface')
+ });
+
+ for (var i = 0; i < list.length; i++)
+ ifc.value(list[i]);
+
+ s6.option(L.cbi.InputValue, 'target', {
+ caption: L.tr('Target'),
+ datatype: 'ip6addr'
+ });
+
+ s6.option(L.cbi.InputValue, 'gateway', {
+ caption: L.tr('IPv6-Gateway'),
+ datatype: 'ip6addr',
+ optional: true
+ });
+
+ s6.option(L.cbi.InputValue, 'metric', {
+ caption: L.tr('Metric'),
+ datatype: 'range(0,255)',
+ placeholder: 0,
+ optional: true
+ });
+
+ s6.option(L.cbi.InputValue, 'mtu', {
+ caption: L.tr('MTU'),
+ datatype: 'range(64,9000)',
+ placeholder: 1500,
+ optional: true
+ });
+
+ m.insertInto('#map');
+ });
+ }
+});
diff --git a/luci2/share/menu.d/network.json b/luci2/share/menu.d/network.json
index e88dff6..e577d70 100644
--- a/luci2/share/menu.d/network.json
+++ b/luci2/share/menu.d/network.json
@@ -15,6 +15,12 @@
"view": "network/hosts",
"index": 50
},
+ "network/routes": {
+ "title": "Routes",
+ "acls": [ "network" ],
+ "view": "network/routes",
+ "index": 70
+ },
"network/diagnostics": {
"title": "Diagnostics",
"acls": [ "diagnostics" ],