luci-lua-runtime: add compatibility template for legacy Lua status includes
authorJo-Philipp Wich <jo@mein.io>
Wed, 14 Sep 2022 11:29:19 +0000 (13:29 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 24 Oct 2022 23:03:37 +0000 (01:03 +0200)
Add a compatibility template containing legacy Lua logic extracted from
the luci-mod-status main status page in order to free the status module
from any explicit or implicit Lua dependencies.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-lua-runtime/luasrc/view/admin_status/luaindex.htm [new file with mode: 0644]

diff --git a/modules/luci-lua-runtime/luasrc/view/admin_status/luaindex.htm b/modules/luci-lua-runtime/luasrc/view/admin_status/luaindex.htm
new file mode 100644 (file)
index 0000000..ef664ed
--- /dev/null
@@ -0,0 +1,18 @@
+<%-
+       local util = require "luci.util"
+       local fs = require "nixio.fs"
+
+       local incdir = util.libpath() .. "/view/admin_status/index/"
+       if fs.access(incdir) then
+               local _, inc
+               local includes = {}
+               for inc in fs.dir(incdir) do
+                       if inc:match("%.htm$") then
+                               includes[#includes + 1] = inc:gsub("%.htm$", "")
+                       end
+               end
+               for _, inc in luci.util.vspairs(includes) do
+                       include("admin_status/index/" .. inc)
+               end
+       end
+-%>