1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 02:51:50 +00:00
openmptcprouter-feeds/luci-mod-network/htdocs/luci-static/resources/view/network/hosts.js

44 lines
856 B
JavaScript
Raw Normal View History

2020-03-27 09:27:18 +00:00
'use strict';
2020-04-09 12:39:09 +00:00
'require view';
2020-03-27 09:27:18 +00:00
'require rpc';
'require form';
2020-04-09 12:39:09 +00:00
return view.extend({
2020-03-27 09:27:18 +00:00
callHostHints: rpc.declare({
object: 'luci-rpc',
method: 'getHostHints',
expect: { '': {} }
}),
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();
}
});