summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-statistics
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-06-05 09:19:46 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-06-05 09:19:46 +0000
commite9cbb96685a035328bb02c70712892380127db78 (patch)
tree66468dcff63a89e478e4b2239adf14339829c466 /applications/luci-statistics
parent788cbb263325a9c0405ba22db6ea5a85ced70833 (diff)
* luci/statistics: fix dispatcher again: drop redirect; use first available instance if no instance requested; breaks menu highlight but lets statistics work in every context (at least for now)
Diffstat (limited to 'applications/luci-statistics')
-rw-r--r--applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua31
1 files changed, 11 insertions, 20 deletions
diff --git a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
index df20d58d0..becfdb50e 100644
--- a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
+++ b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua
@@ -151,29 +151,20 @@ function statistics_render()
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 = path[4]
- local instances = { path[5] }
- local images = { }
+ 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] }
+ end
+ end
-- no instance requested, find all instances
if #instances == 0 then
-
- instances = graph.tree:plugin_instances( plugin )
-
- -- more than one available instance
- if #instances > 1 then
-
- -- redirect to first instance and return
- local r = luci.dispatcher.request
- local i = instances[1]
- if i:len() == 0 then i = "-" end
-
- luci.http.redirect( luci.dispatcher.build_url(
- req[1], req[2], req[3], req[4], i
- ) )
-
- return
- end
+ instances = { graph.tree:plugin_instances( plugin )[1] }
-- index instance requested
elseif instances[1] == "-" then