diff options
author | Pim van den Berg | 2013-03-30 14:08:23 +0100 |
---|---|---|
committer | Pim van den Berg | 2013-03-30 14:13:23 +0100 |
commit | 1ad4de5b08e5d9fde394380418dda6f909ff91b4 (patch) | |
tree | d15865f975c4e21c1e4dfa87ef519d5a8c8e0683 | |
parent | conf: disable overview_filter by default (diff) | |
download | apt-panopticon_cgp-1ad4de5b08e5d9fde394380418dda6f909ff91b4.zip apt-panopticon_cgp-1ad4de5b08e5d9fde394380418dda6f909ff91b4.tar.gz apt-panopticon_cgp-1ad4de5b08e5d9fde394380418dda6f909ff91b4.tar.bz2 apt-panopticon_cgp-1ad4de5b08e5d9fde394380418dda6f909ff91b4.tar.xz |
rewrite some code of added overview_filter feature
Use less variables, less code.
-rw-r--r-- | host.php | 4 | ||||
-rw-r--r-- | inc/collectd.inc.php | 11 |
2 files changed, 5 insertions, 10 deletions
@@ -22,13 +22,11 @@ if(!$plugins) { | |||
22 | 22 | ||
23 | plugins_list($host, $selected_plugins); | 23 | plugins_list($host, $selected_plugins); |
24 | 24 | ||
25 | $overview = empty($plugin) ? true : false; | ||
26 | |||
27 | echo '<div class="graphs">'; | 25 | echo '<div class="graphs">'; |
28 | foreach ($selected_plugins as $selected_plugin) { | 26 | foreach ($selected_plugins as $selected_plugin) { |
29 | if (in_array($selected_plugin, $plugins)) { | 27 | if (in_array($selected_plugin, $plugins)) { |
30 | plugin_header($host, $selected_plugin); | 28 | plugin_header($host, $selected_plugin); |
31 | graphs_from_plugin($host, $selected_plugin, $overview); | 29 | graphs_from_plugin($host, $selected_plugin, empty($plugin)); |
32 | } | 30 | } |
33 | } | 31 | } |
34 | echo '</div>'; | 32 | echo '</div>'; |
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index e8f3662..ad15774 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php | |||
@@ -154,15 +154,12 @@ function graphs_from_plugin($host, $plugin, $overview=false) { | |||
154 | $plugindata = group_plugindata($plugindata); | 154 | $plugindata = group_plugindata($plugindata); |
155 | $plugindata = plugin_sort($plugindata); | 155 | $plugindata = plugin_sort($plugindata); |
156 | 156 | ||
157 | $f = array(); | ||
158 | |||
159 | if ($overview == true && isset($CONFIG['overview_filter'][$plugin])) { | ||
160 | $f = $CONFIG['overview_filter'][$plugin]; | ||
161 | } | ||
162 | |||
163 | foreach ($plugindata as $items) { | 157 | foreach ($plugindata as $items) { |
164 | 158 | ||
165 | if (!empty($f) && ($f !== array_intersect_assoc($f, $items))) { | 159 | if ( |
160 | $overview && isset($CONFIG['overview_filter'][$plugin]) && | ||
161 | $CONFIG['overview_filter'][$plugin] !== array_intersect_assoc($CONFIG['overview_filter'][$plugin], $items) | ||
162 | ) { | ||
166 | continue; | 163 | continue; |
167 | } | 164 | } |
168 | 165 | ||