4f0ae4673497d4ba5ddaaeb46c9c0a1c555f1070
[project/luci2/ui.git] / luci2 / htdocs / luci2 / proto / dhcp.js
1 L.NetworkModel.Protocol.extend({
2         protocol:    'dhcp',
3         description: L.tr('DHCP client'),
4         tunnel:      false,
5         virtual:     false,
6
7         populateForm: function(section, iface)
8         {
9                 section.taboption('general', L.cbi.InputValue, 'hostname', {
10                         caption:     L.tr('Hostname'),
11                         description: L.tr('Hostname to send when requesting DHCP'),
12                         datatype:    'hostname',
13                         optional:    true
14                 }).load = function() {
15                         var self = this;
16                         return L.system.getBoardInfo().then(function(info) {
17                                 self.options.placeholder = info.hostname;
18                         });
19                 };
20
21                 section.taboption('advanced', L.cbi.CheckboxValue, 'broadcast', {
22                         caption:     L.tr('Use broadcast'),
23                         description: L.tr('Required for certain ISPs, e.g. Charter with DOCSIS3'),
24                         optional:    true
25                 });
26
27                 section.taboption('advanced', L.cbi.CheckboxValue, 'defaultroute', {
28                         caption:     L.tr('Use gateway'),
29                         description: L.tr('Create default route via DHCP gateway'),
30                         optional:    true,
31                         initial:     true
32                 });
33
34                 section.taboption('advanced', L.cbi.CheckboxValue, 'peerdns', {
35                         caption:     L.tr('Use DNS'),
36                         description: L.tr('Use DNS servers advertised by DHCP'),
37                         optional:    true,
38                         initial:     true
39                 });
40
41                 section.taboption('advanced', L.cbi.DynamicList, 'dns', {
42                         caption:     L.tr('Custom DNS'),
43                         description: L.tr('Use custom DNS servers instead of DHCP ones'),
44                         datatype:    'ipaddr',
45                         optional:    true
46                 }).depends('peerdns', false);
47
48                 section.taboption('advanced', L.cbi.InputValue, 'clientid', {
49                         caption:     L.tr('Client ID'),
50                         description: L.tr('Client ID to send when requesting DHCP'),
51                         optional:    true
52                 });
53
54                 section.taboption('advanced', L.cbi.InputValue, 'vendorid', {
55                         caption:     L.tr('Vendor Class'),
56                         description: L.tr('Vendor Class to send when requesting DHCP'),
57                         optional:    true
58                 });
59         }
60 });