luci-mod-network: gate bonding behind kmod presence

The kmod install link only displays in new device dialogues so as not
to be too prominent.

Closes #6996
Closes #7086

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald 2024-12-19 18:41:25 +00:00
parent fb4cf432d2
commit ab15b5e379
No known key found for this signature in database
GPG Key ID: 3FC4A933962871D2
2 changed files with 11 additions and 3 deletions

View File

@ -196,6 +196,8 @@ const methods = {
firewall: access('/sbin/fw3') == true,
firewall4: access('/sbin/fw4') == true,
opkg: access('/bin/opkg') == true,
bonding: access('/sys/module/bonding'),
mii-tool: access('/usr/sbin/mii-tool'),
offloading: access('/sys/module/xt_FLOWOFFLOAD/refcnt') == true || access('/sys/module/nft_flow_offload/refcnt') == true,
br2684ctl: access('/usr/sbin/br2684ctl') == true,
swconfig: access('/sbin/swconfig') == true,

View File

@ -450,10 +450,14 @@ return baseclass.extend({
s.tab('brport', _('Bridge port specific options'));
s.tab('bridgevlan', _('Bridge VLAN filtering'));
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'));
o = this.replaceOption(s, 'devgeneral', form.ListValue, 'type', _('Device type'),
!L.hasSystemFeature('bonding') && isNew ? '<a href="' + L.url("admin", "system", "package-manager", "?query=kmod-bonding") + '">'+
_('For bonding, install %s').format('<code>kmod-bonding</code>') + '</a>' : null);
o.readonly = !isNew;
o.value('', _('Network device'));
o.value('bonding', _('Aggregation device'));
if (L.hasSystemFeature('bonding')) {
o.value('bonding', _('Bonding/Aggregation device'));
}
o.value('bridge', _('Bridge device'));
o.value('8021q', _('VLAN (802.1q)'));
o.value('8021ad', _('VLAN (802.1ad)'));
@ -864,7 +868,9 @@ return baseclass.extend({
};
o.depends('type', 'bonding');
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'));
o = this.replaceOption(s, 'devadvanced', form.ListValue, 'monitor_mode', _('Link monitoring mode'),
!L.hasSystemFeature('mii-tool') ? '<a href="' + L.url("admin", "system", "package-manager", "?query=mii-tool") + '">'+
_('Install %s').format('<code>mii-tool</code>') + '</a>' : null);
o.default = '';
o.value('arp', _('ARP link monitoring'));
o.value('mii', _('MII link monitoring'));