luci-app-statistics: processes: fix graph visibility
authorHannu Nyman <hannu.nyman@iki.fi>
Tue, 9 May 2017 06:42:42 +0000 (09:42 +0300)
committerHannu Nyman <hannu.nyman@iki.fi>
Tue, 9 May 2017 06:46:50 +0000 (09:46 +0300)
Fix graph visibility on processes page based on plugin
instance. The overview instance is empty, while monitored
processes have their own instances.

Original version of the patch created by @koblack and
discussed in #1021

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/processes.lua

index 323c3c2308ac02e8f41a269e4def25649493f724..62d054597323e05bb751ff4ae88d15577c2c04ab 100644 (file)
@@ -5,8 +5,8 @@ module("luci.statistics.rrdtool.definitions.processes", package.seeall)
 
 function rrdargs( graph, plugin, plugin_instance, dtype )
 
+    if  plugin_instance == "" then
        return {
-               {
                        title = "%H: Processes",
                        vlabel = "Processes/s",
                        data = {
@@ -26,8 +26,9 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
                                        ps_state_zombies  = { color = "ff0000", title = "Zombies" }
                                }
                        }
-               },
-
+       }
+    else
+       return {
                {
                        title = "%H: CPU time used by %pi",
                        vlabel = "Jiffies",
@@ -112,4 +113,5 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
                        }
                }
        }
+    end
 end