luci-mod-status: hide DHCP status if dnsmasq/odhcpd aren't present
Fixes: #3674
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4efc7cbbda
)
This commit is contained in:
parent
087e6acbf4
commit
02c68f2838
2 changed files with 11 additions and 3 deletions
|
@ -9,7 +9,7 @@ var callLuciDHCPLeases = rpc.declare({
|
||||||
});
|
});
|
||||||
|
|
||||||
return L.Class.extend({
|
return L.Class.extend({
|
||||||
title: _('Active DHCP Leases'),
|
title: '',
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
|
@ -18,7 +18,7 @@ return L.Class.extend({
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function(data) {
|
renderLeases: function(data) {
|
||||||
var leases = Array.isArray(data[0].dhcp_leases) ? data[0].dhcp_leases : [],
|
var leases = Array.isArray(data[0].dhcp_leases) ? data[0].dhcp_leases : [],
|
||||||
leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [],
|
leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [],
|
||||||
machints = data[1].getMACHints(false);
|
machints = data[1].getMACHints(false);
|
||||||
|
@ -88,9 +88,17 @@ return L.Class.extend({
|
||||||
}), E('em', _('There are no active leases')));
|
}), E('em', _('There are no active leases')));
|
||||||
|
|
||||||
return E([
|
return E([
|
||||||
|
E('h3', _('Active DHCP Leases')),
|
||||||
table,
|
table,
|
||||||
E('h3', _('Active DHCPv6 Leases')),
|
E('h3', _('Active DHCPv6 Leases')),
|
||||||
table6
|
table6
|
||||||
]);
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function(data) {
|
||||||
|
if (L.hasSystemFeature('dnsmasq') || L.hasSystemFeature('odhcpd'))
|
||||||
|
return this.renderLeases(data);
|
||||||
|
|
||||||
|
return E([]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,7 +82,7 @@ return L.view.extend({
|
||||||
var container = E('div');
|
var container = E('div');
|
||||||
|
|
||||||
rv.appendChild(E('div', { 'class': 'cbi-section', 'style': 'display:none' }, [
|
rv.appendChild(E('div', { 'class': 'cbi-section', 'style': 'display:none' }, [
|
||||||
E('h3', title),
|
title != '' ? E('h3', title) : '',
|
||||||
container
|
container
|
||||||
]));
|
]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue