git.99rst.org
/
openwrt-luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
3289e13
)
luci-app-statistics: add support for sorting RRD data sources
author
Jo-Philipp Wich
<redacted>
Mon, 5 Oct 2015 17:11:13 +0000
(19:11 +0200)
committer
Jo-Philipp Wich
<redacted>
Mon, 5 Oct 2015 17:11:13 +0000
(19:11 +0200)
Signed-off-by: Jo-Philipp Wich <redacted>
applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
patch
|
blob
|
history
diff --git
a/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
b/applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
index d8317a8177f69c041c02e3a1de40c1d98d0123dc..5d4ad9859d0a1e39691fc80935f34a5b86df55e3 100644
(file)
--- a/
applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
+++ b/
applications/luci-app-statistics/luasrc/statistics/rrdtool.lua
@@
-397,6
+397,7
@@
function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
transform_rpn = dopts.transform_rpn or "0,+",
noarea = dopts.noarea or false,
title = dopts.title or nil,
+ weight = dopts.weight or nil,
ds = dsource,
type = dtype,
instance = dinst,
@@
-469,6
+470,12
@@
function Graph._generic( self, opts, plugin, plugin_instance, dtype, index )
for i, o in ipairs(opts.rrdopts) do _ti( _args, o ) end
end
+ -- sort sources
+ table.sort(_sources, function(a, b)
+ local x = a.weight or a.index or 0
+ local y = b.weight or b.index or 0
+ return x < y
+ end)
-- create DEF statements for each instance
for i, source in ipairs(_sources) do
git clone https://git.99rst.org/PROJECT