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 0894d3d4d174..b83531d3dd4e 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 @@ -66,6 +66,10 @@ return baseclass.extend({ hosts = uci.sections('dhcp', 'host'), isReadonlyView = !L.hasViewPermission(); + if (leases.length < 1 && leases6.length < 1) { + return E([]); + } + for (var i = 0; i < hosts.length; i++) { var host = hosts[i]; @@ -178,12 +182,17 @@ return baseclass.extend({ return rows; }, this)), E('em', _('There are no active leases'))); - return E([ - E('h3', _('Active DHCP Leases')), - table, - E('h3', _('Active DHCPv6 Leases')), - table6 - ]); + var result = []; + + if (leases.length > 0) { + result.push(E('h3', _('Active DHCP Leases')), table) + } + + if (leases6.length > 0) { + result.push(E('h3', _('Active DHCPv6 Leases')), table6) + } + + return E(result); }, render: function(data) {