diff --git a/detail.php b/detail.php index 503a411..20f250a 100644 --- a/detail.php +++ b/detail.php @@ -21,11 +21,29 @@ $width = GET('x'); $heigth = GET('y'); $seconds = GET('s'); +if (!$plugin) { + $selected_plugins = $CONFIG['overview']; +} +else { + $selected_plugins = array($plugin); +} + html_start(); -printf('

%s

'."\n", - $CONFIG['weburl'].'host.php?h='.htmlentities($host), $host -); +printf('

%s

'."\n", $host); + +$plugins = collectd_plugins($host); + +if(!$plugins) { + echo "Unknown host\n"; + return false; +} + +plugins_list($host, $CONFIG['overview'], $plugins, $selected_plugins); + + +echo '
'; +plugin_header($host, $plugin); $term = array( '2hour' => 3600*2, @@ -38,23 +56,17 @@ $term = array( ); $args = $_GET; -print "
'; html_end(); diff --git a/host.php b/host.php index 8e3b695..6799123 100644 --- a/host.php +++ b/host.php @@ -5,7 +5,14 @@ require_once 'inc/html.inc.php'; require_once 'inc/collectd.inc.php'; $host = validate_get(GET('h'), 'host'); -$splugin = validate_get(GET('p'), 'plugin'); +$plugin = validate_get(GET('p'), 'plugin'); + +if (!$plugin) { + $selected_plugins = $CONFIG['overview']; +} +else { + $selected_plugins = array($plugin); +} html_start(); @@ -18,29 +25,14 @@ if(!$plugins) { return false; } -# first the ones defined in overview -foreach($CONFIG['overview'] as $plugin) { - if (in_array($plugin, $plugins)) { - printf('
'."\n", $plugin); - plugin_header($host, $plugin, 0); - graphs_from_plugin($host, $plugin); - print "
\n"; - } -} +plugins_list($host, $CONFIG['overview'], $plugins, $selected_plugins); -# other plugins -foreach($plugins as $plugin) { - if (!in_array($plugin, $CONFIG['overview'])) { - printf('
'."\n", $plugin); - if ($splugin == $plugin) { - plugin_header($host, $plugin, 0); - graphs_from_plugin($host, $plugin); - } else { - plugin_header($host, $plugin, 1); - } - print "
\n"; - } +echo '
'; +foreach ($selected_plugins as $selected_plugin) { + plugin_header($host, $selected_plugin); + graphs_from_plugin($host, $selected_plugin); } +echo '
'; html_end(); diff --git a/inc/html.inc.php b/inc/html.inc.php index 2e71488..f0390ce 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -13,7 +13,7 @@ function html_start() { $path = htmlentities(breadcrumbs()); echo << + @@ -58,20 +58,55 @@ function html_end() { EOT; } -function plugin_header($host, $plugin, $status) { - global $CONFIG; +function plugin_header($host, $plugin) { + return printf("

%s

\n", $CONFIG['weburl'], $host, $plugin, $plugin); +} + +function plugins_list($host, $overview_plugins, $other_plugins, $selected_plugins = array()) { + echo '
'; + echo '

Plugins

'; + echo ''; + echo '
'; +} + +function selected_overview($selected_plugins) { + if (count($selected_plugins) > 1) { + return 'class="selected"'; + } + return ''; +} - if ($status == 1) { - $f = 'get'; - $i = 'plus'; - $a = '+'; - } else { - $f = 'rm'; - $i = 'minus'; - $a = '-'; +function selected_plugin($plugin, $selected_plugins) { + if (in_array($plugin, $selected_plugins)) { + return 'class="selected"'; } + return ''; +} - return printf("

\"[%s]\" %s

\n", $f, $host, $plugin, $CONFIG['weburl'], $i, $a, $plugin); +function selected_timerange($value1, $value2) { + if ($value1 == $value2) { + return 'class="selected"'; + } + return ''; } function host_summary($hosts) { diff --git a/layout/style.css b/layout/style.css index e478203..f61b0ad 100644 --- a/layout/style.css +++ b/layout/style.css @@ -25,8 +25,8 @@ h1 { } h2 { - font-size: 1.5em; - margin: 0.5em 0; + font-size: 1.3em; + margin: 1em 0 0 0; } h3 { @@ -43,7 +43,7 @@ a:hover { } table.summary th { - width: 150px; + width: 300px; font-weight: normal; text-align: left; } @@ -68,10 +68,10 @@ img { ul { margin: 0; padding: 0; + list-style-type: none; } li { - display: inline; margin-left: 10px; } @@ -94,3 +94,37 @@ hr { font-weight: bold; color: #D50100; } + +.graphs { + display: inline-block; + margin: 0 0 0 20px; + width: 83%; + vertical-align: top; +} + +.graphs img { + margin: 0 5px 12px 0; + vertical-align: top; +} + +.plugins { + display: inline-block; + width: 12%; +} + +.plugins ul > li:first-of-type { + display: block; + margin-bottom: 0.5em; + padding-bottom: 0.5em; + border-bottom: 1px dotted #ddd; +} + +.selected:link, .selected:visited, .selected:active { + font-style: italic; + color: #4D79B5; +} + +.time-range li { + display: inline-block; + margin-bottom: 0.3em; +}