summaryrefslogtreecommitdiffstats
path: root/logfiles-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'logfiles-model.lua')
-rw-r--r--logfiles-model.lua19
1 files changed, 7 insertions, 12 deletions
diff --git a/logfiles-model.lua b/logfiles-model.lua
index df35f0c..b5b08cf 100644
--- a/logfiles-model.lua
+++ b/logfiles-model.lua
@@ -137,20 +137,15 @@ mymodule.tail = function(self, clientdata)
end
mymodule.get = function ()
- -- Loop through each file and present its info
- local listed_files = {}
+ local retval = {}
for i,file in pairs(list_files()) do
- -- Get info on this specific file and put it in a table
- local st = posix.stat(file)
- local filename = cfe({ value=file, label="File name" })
- local size = cfe({ value=st.size, label="File size" })
- local mtime = cfe({ value=st.mtime, label="File date" })
- local inuse = cfe({ type="boolean", value=is_file_in_use(file), label="File in use" })
- table.insert ( listed_files , cfe({ type="group", value={filename=filename, size=size, mtime=mtime,
- inuse=inuse, label="File details"} }) )
+ local details = posix.stat(file)
+ details.filename = file
+ details.inuse = is_file_in_use(file)
+ table.insert(retval, details)
end
- table.sort(listed_files, function (a,b) return (a.value.filename.value < b.value.filename.value) end )
- return cfe({ type="list", value=listed_files, label="Log Files" })
+ table.sort(retval, function(a,b) return a.filename < b.filename end)
+ return cfe({ type="structure", value=retval, label="Log Files" })
end
mymodule.get_delete = function()