From 70bad4da4fcd44715445c36d8c4b9f8a00d92b4d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 9 Dec 2016 13:07:42 +0100 Subject: luci-mod-admin-full: handle infinite lease times in output When a lease objects expires property is set to "false", its expiry time is unlimited, so adjust the templates to properly display that state. Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/admin_network/lease_status.htm | 16 ++++++---------- .../luasrc/view/admin_status/index.htm | 8 ++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'modules/luci-mod-admin-full') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm index f7787dd1e..b4baedff2 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm @@ -27,14 +27,12 @@ { var timestr; - if (st[0][i].expires <= 0) - { + if (st[0][i].expires === false) + timestr = '<%:unlimited%>'; + else if (st[0][i].expires <= 0) timestr = '<%:expired%>'; - } else - { timestr = String.format('%t', st[0][i].expires); - } var tr = tb.insertRow(-1); tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); @@ -69,14 +67,12 @@ { var timestr; - if (st[1][i].expires <= 0) - { + if (st[1][i].expires === false) + timestr = '<%:unlimited%>'; + else if (st[1][i].expires <= 0) timestr = '<%:expired%>'; - } else - { timestr = String.format('%t', st[1][i].expires); - } var tr = tb6.insertRow(-1); tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index eb4648806..8976e30cb 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -341,7 +341,9 @@ { var timestr; - if (info.leases[i].expires <= 0) + if (info.leases[i].expires === false) + timestr = '<%:unlimited%>'; + else if (info.leases[i].expires <= 0) timestr = '<%:expired%>'; else timestr = String.format('%t', info.leases[i].expires); @@ -379,7 +381,9 @@ { var timestr; - if (info.leases6[i].expires <= 0) + if (info.leases6[i].expires === false) + timestr = '<%:unlimited%>'; + else if (info.leases6[i].expires <= 0) timestr = '<%:expired%>'; else timestr = String.format('%t', info.leases6[i].expires); -- cgit v1.2.3