summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-network/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-07 20:14:18 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-07 20:14:18 +0200
commit875a96f6535a97b93d09af5756db53d91e83dc49 (patch)
tree25896d1b03af317ab4ff7e1e7f9f83a838dbec1a /modules/luci-mod-network/htdocs/luci-static/resources/view
parent91afb6fae2527174f264c9008569783a79b49dae (diff)
luci-mod-network: switch hostname configuration to client side js
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources/view')
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js
new file mode 100644
index 0000000000..2a49b04817
--- /dev/null
+++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js
@@ -0,0 +1,41 @@
+'use strict';
+'require rpc';
+'require form';
+
+return L.view.extend({
+ callHostHints: rpc.declare({
+ object: 'luci',
+ method: 'host_hints'
+ }),
+
+ load: function() {
+ return this.callHostHints();
+ },
+
+ render: function(hosts) {
+ var m, s, o;
+
+ m = new form.Map('dhcp', _('Hostnames'));
+
+ s = m.section(form.GridSection, 'domain', _('Host entries'));
+ s.addremove = true;
+ s.anonymous = true;
+ s.sortable = true;
+
+ o = s.option(form.Value, 'name', _('Hostname'));
+ o.datatype = 'hostname';
+ o.rmempty = true;
+
+ o = s.option(form.Value, 'ip', _('IP address'));
+ o.datatype = 'ipaddr';
+ o.rmempty = true;
+ L.sortedKeys(hosts, 'ipv4', 'addr').forEach(function(mac) {
+ o.value(hosts[mac].ipv4, '%s (%s)'.format(
+ hosts[mac].ipv4,
+ hosts[mac].name || mac
+ ));
+ });
+
+ return m.render();
+ }
+});