luci-mod-network: reorder tabs in dhcp.js
authorDavid Härdeman <[email protected]>
Tue, 21 Oct 2025 20:20:39 +0000 (22:20 +0200)
committerPaul Donald <[email protected]>
Fri, 24 Oct 2025 13:57:43 +0000 (15:57 +0200)
This is just in preparation for the following patches.

Signed-off-by: David Härdeman <[email protected]>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js

index de2c8aedb8e563285c4456bedf9b2d51fec68ca5..5ae0c12cc28f5c4df09bbb2f157247772b730e2c 100644 (file)
@@ -279,8 +279,8 @@ return view.extend({
                s.tab('devices', _('Devices &amp; Ports'));
                s.tab('logging', _('Log'));
                s.tab('files', _('Files'));
-               s.tab('leases', _('Static Leases'));
                s.tab('relay', _('Relay'));
+               s.tab('leases', _('Static Leases'));
                s.tab('pxe_tftp', _('PXE/TFTP'));
 
                // Begin general
@@ -373,6 +373,74 @@ return view.extend({
                        _('File to store DHCP lease information.'));
                // End files
 
+               // Begin relay
+               o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null,
+                       _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.')
+                       + '<br />' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(<code>addr#port</code>).')
+                       + '<br />' + _('You may add multiple unique Relay To on the same Listen addr.'));
+
+               ss = o.subsection;
+
+               ss.addremove = true;
+               ss.anonymous = true;
+               ss.sortable  = true;
+               ss.rowcolors = true;
+               ss.nodescriptions = true;
+
+               so = ss.option(form.Value, 'local_addr', _('Relay from'));
+               so.rmempty = false;
+               so.datatype = 'ipaddr';
+
+               for (var family = 4; family <= 6; family += 2) {
+                       for (var i = 0; i < networks.length; i++) {
+                               if (networks[i].getName() != 'loopback') {
+                                       var addrs = (family == 6) ? networks[i].getIP6Addrs() : networks[i].getIPAddrs();
+                                       for (var j = 0; j < addrs.length; j++) {
+                                               var addr = addrs[j].split('/')[0];
+                                               so.value(addr, E([], [
+                                                       addr, ' (',
+                                                       widgets.NetworkSelect.prototype.renderIfaceBadge(networks[i]),
+                                                       ')'
+                                               ]));
+                                       }
+                               }
+                       }
+               }
+
+               so = ss.option(form.Value, 'server_addr', _('Relay to address'));
+               so.rmempty = false;
+               so.optional = false;
+               so.placeholder = '192.168.10.1#535';
+               so.validate = function(section, value) {
+                       var m = this.section.formvalue(section, 'local_addr'),
+                           n = this.section.formvalue(section, 'server_addr'),
+                           p;
+
+                       if (!m || !n) {
+                               return _('Both "Relay from" and "Relay to address" must be specified.');
+                       }
+                       else {
+                               p = n.split('#');
+                               if (p.length > 1 && !/^[0-9]+$/.test(p[1]))
+                                       return _('Expected port number.');
+                               else
+                                       n = p[0];
+
+                               if ((validation.parseIPv6(m) && validation.parseIPv6(n)) ||
+                                       validation.parseIPv4(m) && validation.parseIPv4(n))
+                                       return true;
+                               else
+                                       return _('Address families of "Relay from" and "Relay to address" must match.')
+                       }
+                       return true;
+               };
+
+               so = ss.option(widgets.NetworkSelect, 'interface', _('Only accept replies via'));
+               so.optional = true;
+               so.rmempty = false;
+               so.placeholder = 'lan';
+               // End relay
+
                // Begin leases
                o = s.taboption('leases', form.SectionValue, '__leases__', form.GridSection, 'host', null,
                        _('Static leases are used to assign fixed IP addresses and symbolic hostnames to DHCP clients. They are also required for non-dynamic interface configurations where only hosts with a corresponding lease are served.') + '<br /><br />' +
@@ -555,74 +623,6 @@ return view.extend({
                        o = s.taboption('leases', CBILease6Status, '__status6__');
                // End leases
 
-               // Begin relay
-               o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null,
-                       _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.')
-                       + '<br />' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(<code>addr#port</code>).')
-                       + '<br />' + _('You may add multiple unique Relay To on the same Listen addr.'));
-
-               ss = o.subsection;
-
-               ss.addremove = true;
-               ss.anonymous = true;
-               ss.sortable  = true;
-               ss.rowcolors = true;
-               ss.nodescriptions = true;
-
-               so = ss.option(form.Value, 'local_addr', _('Relay from'));
-               so.rmempty = false;
-               so.datatype = 'ipaddr';
-
-               for (var family = 4; family <= 6; family += 2) {
-                       for (var i = 0; i < networks.length; i++) {
-                               if (networks[i].getName() != 'loopback') {
-                                       var addrs = (family == 6) ? networks[i].getIP6Addrs() : networks[i].getIPAddrs();
-                                       for (var j = 0; j < addrs.length; j++) {
-                                               var addr = addrs[j].split('/')[0];
-                                               so.value(addr, E([], [
-                                                       addr, ' (',
-                                                       widgets.NetworkSelect.prototype.renderIfaceBadge(networks[i]),
-                                                       ')'
-                                               ]));
-                                       }
-                               }
-                       }
-               }
-
-               so = ss.option(form.Value, 'server_addr', _('Relay to address'));
-               so.rmempty = false;
-               so.optional = false;
-               so.placeholder = '192.168.10.1#535';
-               so.validate = function(section, value) {
-                       var m = this.section.formvalue(section, 'local_addr'),
-                           n = this.section.formvalue(section, 'server_addr'),
-                           p;
-
-                       if (!m || !n) {
-                               return _('Both "Relay from" and "Relay to address" must be specified.');
-                       }
-                       else {
-                               p = n.split('#');
-                               if (p.length > 1 && !/^[0-9]+$/.test(p[1]))
-                                       return _('Expected port number.');
-                               else
-                                       n = p[0];
-
-                               if ((validation.parseIPv6(m) && validation.parseIPv6(n)) ||
-                                       validation.parseIPv4(m) && validation.parseIPv4(n))
-                                       return true;
-                               else
-                                       return _('Address families of "Relay from" and "Relay to address" must match.')
-                       }
-                       return true;
-               };
-
-               so = ss.option(widgets.NetworkSelect, 'interface', _('Only accept replies via'));
-               so.optional = true;
-               so.rmempty = false;
-               so.placeholder = 'lan';
-               // End relay
-
                // Begin pxe_tftp
                o = s.taboption('pxe_tftp', form.Flag, 'enable_tftp',
                        _('Enable TFTP server'),