From 5c323f4b65c1c3276af8ab6aa8a3a57d3d6bc795 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 30 Oct 2015 14:27:10 +0000 Subject: Modify logfile to get logging info from the config and use common view --- gross-controller.lua | 4 ++++ gross-logfile-html.lsp | 7 +------ gross-model.lua | 7 +++++++ 3 files changed, 12 insertions(+), 6 deletions(-) mode change 100644 => 120000 gross-logfile-html.lsp diff --git a/gross-controller.lua b/gross-controller.lua index 916511e..ee54de9 100644 --- a/gross-controller.lua +++ b/gross-controller.lua @@ -18,4 +18,8 @@ function mymodule.expert(self) return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Gross Config", "Configuration Set") end +function mymodule.logfile(self) + return self.model.get_logfile(self, self.clientdata) +end + return mymodule diff --git a/gross-logfile-html.lsp b/gross-logfile-html.lsp deleted file mode 100644 index 24cad72..0000000 --- a/gross-logfile-html.lsp +++ /dev/null @@ -1,6 +0,0 @@ -<% local data, viewlibrary = ... -%> - -<% if viewlibrary and viewlibrary.dispatch_component then - viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename="/var/log/messages", grep="gross"}) -end %> diff --git a/gross-logfile-html.lsp b/gross-logfile-html.lsp new file mode 120000 index 0000000..ac8854f --- /dev/null +++ b/gross-logfile-html.lsp @@ -0,0 +1 @@ +../logfile-html.lsp \ No newline at end of file diff --git a/gross-model.lua b/gross-model.lua index 94a2685..e3d5241 100644 --- a/gross-model.lua +++ b/gross-model.lua @@ -42,4 +42,11 @@ function mymodule.update_filedetails(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}) end +function mymodule.get_logfile(self, clientdata) + local retval = cfe({ type="group", value={}, label="Log File Configuration" }) + retval.value.facility = cfe({value=format.parse_ini_file(fs.read_file(configfile), "", "syslog_facility") or "mail", label="Syslog Facility"}) + retval.value.grep = cfe({ value="gross", label="Grep" }) + return retval +end + return mymodule -- cgit v1.2.3