diff options
author | Jo-Philipp Wich <jo@mein.io> | 2016-12-09 13:07:42 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2016-12-09 13:07:42 +0100 |
commit | 70bad4da4fcd44715445c36d8c4b9f8a00d92b4d (patch) | |
tree | d433d3e10f4f61f66ae2fd8e19d7224477245ae5 | |
parent | 8e9e92a630a9e18eef642c02b8a7fa476440ab37 (diff) |
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 <jo@mein.io>
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm | 16 | ||||
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm | 8 |
2 files changed, 12 insertions, 12 deletions
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 f7787dd1ea..b4baedff28 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 = '<em><%:unlimited%></em>'; + else if (st[0][i].expires <= 0) timestr = '<em><%:expired%></em>'; - } 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 = '<em><%:unlimited%></em>'; + else if (st[1][i].expires <= 0) timestr = '<em><%:expired%></em>'; - } 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 eb46488062..8976e30cba 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 = '<em><%:unlimited%></em>'; + else if (info.leases[i].expires <= 0) timestr = '<em><%:expired%></em>'; 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 = '<em><%:unlimited%></em>'; + else if (info.leases6[i].expires <= 0) timestr = '<em><%:expired%></em>'; else timestr = String.format('%t', info.leases6[i].expires); |