Skip to content

Commit

Permalink
luci-mod-network: dhcp.js: group DNS record related options in one tab
Browse files Browse the repository at this point in the history
In order to unclutter the default dnmasq configuration view, move the
Hostnames (A+PTR), SRV, MX and CNAME sections into a new dedicated
"DNS Records" tab.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  • Loading branch information
jow- committed Apr 8, 2024
1 parent 9fc659a commit cdfbf78
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ return view.extend({
duids = hosts_duids_pools[1],
pools = hosts_duids_pools[2],
networks = hosts_duids_pools[3],
m, s, o, ss, so;
m, s, o, ss, so, dnss;

let noi18nstrings = {
etc_hosts: '<code>/etc/hosts</code>',
Expand Down Expand Up @@ -355,19 +355,16 @@ return view.extend({

s.tab('general', _('General'));
s.tab('devices', _('Devices &amp; Ports'));
s.tab('dnsrecords', _('DNS Records'));
s.tab('dnssecopt', _('DNSSEC'));
s.tab('filteropts', _('Filter'));
s.tab('forward', _('Forwards'));
s.tab('limits', _('Limits'));
s.tab('logging', _('Log'));
s.tab('files', _('Resolv &amp; Hosts Files'));
s.tab('leases', _('Static Leases'));
s.tab('hosts', _('Hostnames'));
s.tab('ipsets', _('IP Sets'));
s.tab('relay', _('Relay'));
s.tab('srvhosts', _('SRV'));
s.tab('mxhosts', _('MX'));
s.tab('cnamehosts', _('CNAME'));
s.tab('pxe_tftp', _('PXE/TFTP'));

s.taboption('filteropts', form.Flag, 'domainneeded',
Expand Down Expand Up @@ -836,7 +833,19 @@ return view.extend({
so.value(index, display_str);
});

o = s.taboption('srvhosts', form.SectionValue, '__srvhosts__', form.TableSection, 'srvhost', null,
o = s.taboption('dnsrecords', form.SectionValue, '__dnsrecords__', form.TypedSection, '__dnsrecords__');

dnss = o.subsection;

dnss.anonymous = true;
dnss.cfgsections = function() { return [ '__dnsrecords__' ] };

dnss.tab('hosts', _('Hostnames'));
dnss.tab('srvhosts', _('SRV'));
dnss.tab('mxhosts', _('MX'));
dnss.tab('cnamehosts', _('CNAME'));

o = dnss.taboption('srvhosts', form.SectionValue, '__srvhosts__', form.TableSection, 'srvhost', null,
_('Bind service records to a domain name: specify the location of services. See <a href="%s">RFC2782</a>.').format('https://datatracker.ietf.org/doc/html/rfc2782')
+ '<br />' + _('_service: _sip, _ldap, _imap, _stun, _xmpp-client, … . (Note: while _http is possible, no browsers support SRV records.)')
+ '<br />' + _('_proto: _tcp, _udp, _sctp, _quic, … .')
Expand Down Expand Up @@ -875,7 +884,7 @@ return view.extend({
so.datatype = 'range(0,65535)';
so.placeholder = '50';

o = s.taboption('mxhosts', form.SectionValue, '__mxhosts__', form.TableSection, 'mxhost', null,
o = dnss.taboption('mxhosts', form.SectionValue, '__mxhosts__', form.TableSection, 'mxhost', null,
_('Bind service records to a domain name: specify the location of services.')
+ '<br />' + _('You may add multiple records for the same domain.'));

Expand All @@ -902,7 +911,7 @@ return view.extend({
so.datatype = 'range(0,65535)';
so.placeholder = '0';

o = s.taboption('cnamehosts', form.SectionValue, '__cname__', form.TableSection, 'cname', null,
o = dnss.taboption('cnamehosts', form.SectionValue, '__cname__', form.TableSection, 'cname', null,
_('Set an alias for a hostname.'));

ss = o.subsection;
Expand All @@ -923,7 +932,7 @@ return view.extend({
so.datatype = 'hostname';
so.placeholder = 'example.com.';

o = s.taboption('hosts', form.SectionValue, '__hosts__', form.GridSection, 'domain', null,
o = dnss.taboption('hosts', form.SectionValue, '__hosts__', form.GridSection, 'domain', null,
_('Hostnames are used to bind a domain name to an IP address. This setting is redundant for hostnames already configured with static leases, but it can be useful to rebind an FQDN.'));

ss = o.subsection;
Expand Down

0 comments on commit cdfbf78

Please sign in to comment.