mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 21:24:35 +04:00
luci-mod-network: predicate the display of dnsmasq and odhcpd tabs
First check the features are installed. Further, verify that some sections exist which some GUI functions depend on. Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@@ -207,8 +207,10 @@ return view.extend({
|
|||||||
m = new form.Map('dhcp', _('DHCP'));
|
m = new form.Map('dhcp', _('DHCP'));
|
||||||
m.tabbed = true;
|
m.tabbed = true;
|
||||||
|
|
||||||
|
if (L.hasSystemFeature('dnsmasq'))
|
||||||
this.add_dnsmasq_cfg(m, networks);
|
this.add_dnsmasq_cfg(m, networks);
|
||||||
|
|
||||||
|
if (L.hasSystemFeature('odhcpd'))
|
||||||
this.add_odhcpd_cfg(m);
|
this.add_odhcpd_cfg(m);
|
||||||
|
|
||||||
this.add_leases_cfg(m, hosts, duids, pools, macdata);
|
this.add_leases_cfg(m, hosts, duids, pools, macdata);
|
||||||
@@ -309,11 +311,11 @@ return view.extend({
|
|||||||
const sections = this.cfgsections();
|
const sections = this.cfgsections();
|
||||||
|
|
||||||
return Promise.resolve(renderTask).then(function(nodes) {
|
return Promise.resolve(renderTask).then(function(nodes) {
|
||||||
if (sections.length < 2) {
|
if (sections.length == 1) {
|
||||||
nodes.querySelector('#cbi-dhcp-dnsmasq > h3').remove();
|
nodes.querySelector('#cbi-dhcp-dnsmasq > h3').remove();
|
||||||
nodes.querySelector('#cbi-dhcp-dnsmasq > .cbi-section-remove').remove();
|
nodes.querySelector('#cbi-dhcp-dnsmasq > .cbi-section-remove').remove();
|
||||||
}
|
}
|
||||||
else {
|
else if (sections.length > 1) {
|
||||||
nodes.querySelectorAll('#cbi-dhcp-dnsmasq > .cbi-section-remove').forEach(function(div, i) {
|
nodes.querySelectorAll('#cbi-dhcp-dnsmasq > .cbi-section-remove').forEach(function(div, i) {
|
||||||
const section = uci.get('dhcp', sections[i]);
|
const section = uci.get('dhcp', sections[i]);
|
||||||
const hline = div.nextElementSibling;
|
const hline = div.nextElementSibling;
|
||||||
|
|||||||
Reference in New Issue
Block a user