summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-23 21:12:54 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-23 21:13:53 +0100
commit4efc7cbbda86280343683a7d1c2563233c499550 (patch)
treeac99f534e954adcf422ffc1373eaa911dcec48f5 /modules/luci-mod-status
parent8083868d70223c0d32fe19e7e86bc4ddf7051974 (diff)
luci-mod-status: hide DHCP status if dnsmasq/odhcpd aren't present
Fixes: #3674 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-status')
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js12
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js2
2 files changed, 11 insertions, 3 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js
index b1068f0e3..9975a648f 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js
@@ -9,7 +9,7 @@ var callLuciDHCPLeases = rpc.declare({
});
return L.Class.extend({
- title: _('Active DHCP Leases'),
+ title: '',
load: function() {
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 : [],
leases6 = Array.isArray(data[0].dhcp6_leases) ? data[0].dhcp6_leases : [],
machints = data[1].getMACHints(false);
@@ -88,9 +88,17 @@ return L.Class.extend({
}), E('em', _('There are no active leases')));
return E([
+ E('h3', _('Active DHCP Leases')),
table,
E('h3', _('Active DHCPv6 Leases')),
table6
]);
+ },
+
+ render: function(data) {
+ if (L.hasSystemFeature('dnsmasq') || L.hasSystemFeature('odhcpd'))
+ return this.renderLeases(data);
+
+ return E([]);
}
});
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js
index bb6947d66..01a8e1835 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js
@@ -82,7 +82,7 @@ return L.view.extend({
var container = E('div');
rv.appendChild(E('div', { 'class': 'cbi-section', 'style': 'display:none' }, [
- E('h3', title),
+ title != '' ? E('h3', title) : '',
container
]));