summaryrefslogtreecommitdiffstats
path: root/logfiles-controller.lua
blob: 3c50f3af0b2d7be4ac2beea6a8c1be0b963b6dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module (..., package.seeall)
require("posix")

default_action = "status"

-- Public methods

status = function (self )
	return self.model.get()
end

delete = function (self)
	return self:redirect_to_referrer(self.model.delete(self.clientdata.name or ""))
end

view = function (self)
	return self.model.get_filedetails(self.clientdata.name or "", self.clientdata.grep)
end

download = function (self)
	local filestatus = view(self)
	local filecontent = filestatus.value.filecontent
	filecontent.label = posix.basename(filestatus.value.filename.value)
	self.conf.viewtype = "stream"
	
	return filecontent
end

tail = function (self)
	if self.clientdata.offset then
		self.conf.viewtype = "ajax"
	end
	return self.model.tail(self.clientdata.name, self.clientdata.offset, self.clientdata.grep)
end