Translated using Weblate (Japanese)
[oweals/luci.git] / modules / luci-mod-network / htdocs / luci-static / resources / view / network / hosts.js
1 'use strict';
2 'require view';
3 'require rpc';
4 'require form';
5
6 return view.extend({
7         callHostHints: rpc.declare({
8                 object: 'luci-rpc',
9                 method: 'getHostHints',
10                 expect: { '': {} }
11         }),
12
13         load: function() {
14                 return this.callHostHints();
15         },
16
17         render: function(hosts) {
18                 var m, s, o;
19
20                 m = new form.Map('dhcp', _('Hostnames'));
21
22                 s = m.section(form.GridSection, 'domain', _('Host entries'));
23                 s.addremove = true;
24                 s.anonymous = true;
25                 s.sortable  = true;
26
27                 o = s.option(form.Value, 'name', _('Hostname'));
28                 o.datatype = 'hostname';
29                 o.rmempty = true;
30
31                 o = s.option(form.Value, 'ip', _('IP address'));
32                 o.datatype = 'ipaddr';
33                 o.rmempty = true;
34                 L.sortedKeys(hosts, 'ipv4', 'addr').forEach(function(mac) {
35                         o.value(hosts[mac].ipv4, '%s (%s)'.format(
36                                 hosts[mac].ipv4,
37                                 hosts[mac].name || mac
38                         ));
39                 });
40
41                 return m.render();
42         }
43 });