* luci/applications: statistics: pick up new rrdtool translations in controller and...
[project/luci.git] / applications / luci-statistics / luasrc / controller / luci_statistics / luci_statistics.lua
index 04cdd7ce2663af8c16860303501ec20d94d0dffd..53ce34ec3be7a05ec466ecd2a345059006e799a2 100644 (file)
@@ -22,7 +22,8 @@ function index()
        require("luci.i18n")
        require("luci.statistics.datatree")
 
-       -- load language file
+       -- load language files
+       luci.i18n.loadc("rrdtool")
        luci.i18n.loadc("statistics")
 
        -- get rrd data tree
@@ -44,7 +45,7 @@ function index()
        -- our collectd menu
        local collectd_menu = {
                output  = { "rrdtool", "network", "unixsock", "csv" },
-               system  = { "exec", "email", "cpu", "df", "disk", "irq", "processes" },
+               system  = { "exec", "email", "cpu", "df", "disk", "irq", "processes", "load" },
                network = { "interface", "netlink", "iptables", "tcpconns", "ping", "dns", "wireless" }
        }
 
@@ -80,7 +81,7 @@ function index()
              page.setuser  = "nobody"
              page.setgroup = "nogroup"
 
-       local vars = luci.http.formvalues()
+       local vars = luci.http.formvalue(nil, true)
        local span = vars.timespan or nil
 
        for i, plugin in luci.util.vspairs( tree:plugins() ) do
@@ -148,22 +149,22 @@ function statistics_render()
        require("luci.template")
        require("luci.model.uci")
 
-       local vars  = luci.http.formvalues()
-       local req   = luci.dispatcher.request
-       local path  = luci.dispatcher.dispatched.path
-       local uci   = luci.model.uci
-       local spans = luci.util.split( uci.get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true )
-       local span  = vars.timespan or uci.get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
+       local vars  = luci.http.formvalue()
+       local req   = luci.dispatcher.context.request
+       local path  = luci.dispatcher.context.dispatched.path
+       local uci   = luci.model.uci.cursor()
+       local spans = luci.util.split( uci:get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true )
+       local span  = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
        local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
 
        local plugin, instances
        local images = { }
 
        -- find requested plugin and instance
-        for i, p in ipairs( luci.dispatcher.dispatched.path ) do
-                if luci.dispatcher.dispatched.path[i] == "graph" then
-                        plugin    = luci.dispatcher.dispatched.path[i+1]
-                        instances = { luci.dispatcher.dispatched.path[i+2] }
+        for i, p in ipairs( luci.dispatcher.context.dispatched.path ) do
+                if luci.dispatcher.context.dispatched.path[i] == "graph" then
+                        plugin    = luci.dispatcher.context.dispatched.path[i+1]
+                        instances = { luci.dispatcher.context.dispatched.path[i+2] }
                 end
         end