diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index 310a88b3c..bd86acde1 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -33,14 +33,14 @@ class InlinePie extends AbstractWidget * @var string */ private $template =<<<'EOD' - + {noscript} EOD; private $noscript =<<<'EOD' EOD; @@ -216,8 +216,7 @@ EOD; $template = str_replace('{class}', $this->class, $template); // style - $template = str_replace('{size}', - isset($this->size) ? 'sparkWidth="' . $this->size . '" sparkHeight="' . $this->size . '" ' : '', $template); + $template = str_replace('{size}', isset($this->size) ? $this->size : 16, $template); $template = str_replace('{title}', $this->title, $template); $template = str_replace('{colors}', implode(',', $this->colors), $template); diff --git a/modules/monitoring/application/views/helpers/Perfdata.php b/modules/monitoring/application/views/helpers/Perfdata.php index e3b92510f..8e79fceeb 100644 --- a/modules/monitoring/application/views/helpers/Perfdata.php +++ b/modules/monitoring/application/views/helpers/Perfdata.php @@ -18,11 +18,11 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract * * @return string */ - public function perfdata($perfdataStr, $compact = false, $color = Perfdata::PERFDATA_OK) + public function perfdata($perfdataStr, $compact = false, $limit = 0, $color = Perfdata::PERFDATA_OK) { $pieChartData = PerfdataSet::fromString($perfdataStr)->asArray(); - $result = ''; + $results = array(); $table = array( '' . implode( '', @@ -32,7 +32,7 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract foreach ($pieChartData as $perfdata) { if ($compact && $perfdata->isVisualizable()) { - $result .= $perfdata->asInlinePie($color)->render(); + $results[] = $perfdata->asInlinePie($color)->render(); } else { $row = ''; @@ -56,8 +56,13 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract } } + if ($limit > 0) { + $table = array_slice ($table, 0, $limit); + $results = array_slice ($results, 0, $limit); + } + if ($compact) { - return $result; + return join('', $results); } else { $pieCharts = empty($table) ? '' : '' . implode("\n", $table) . '
'; return $pieCharts; diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 45d59adf5..f7bbffe57 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -65,7 +65,7 @@ foreach ($services as $service): - perfdata($service->service_perfdata, true) ?> +
perfdata($service->service_perfdata, true, 8) ?>
service_handled && $service->service_state > 0): ?> icon('attention-alt', $this->translate('Unhandled')) ?> diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 87818bbaa..6263a6f0b 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -285,6 +285,15 @@ li li .badge { background-color: #eee; } +.sparkline-box { + position: relative; + top: -9px; +} + +.dashboard .sparkline-box { + top: -3px; +} + .sparkline { width: 12px; height: 12px; diff --git a/public/js/icinga/behavior/navigation.js b/public/js/icinga/behavior/navigation.js index ebe74b422..d9f2060a6 100644 --- a/public/js/icinga/behavior/navigation.js +++ b/public/js/icinga/behavior/navigation.js @@ -85,8 +85,7 @@ $menu.data('icinga-url', menuDataUrl); }; - Navigation.prototype.setActiveByUrl = function(url) - { + Navigation.prototype.setActiveByUrl = function(url) { this.resetActive(); this.setActive($('#menu [href="' + url + '"]')); } diff --git a/public/js/icinga/behavior/sparkline.js b/public/js/icinga/behavior/sparkline.js index 43fa2a4c9..4a5cbefd5 100644 --- a/public/js/icinga/behavior/sparkline.js +++ b/public/js/icinga/behavior/sparkline.js @@ -28,10 +28,12 @@ if ($spark.hasClass('sparkline-perfdata')) { options = { enableTagOptions: true, - width: 12, - height: 12, + width: 16, + height: 16, title: title, - disableTooltips: true + disableTooltips: true, + borderWidth: 1.4, + borderColor: '#FFF' }; $spark.sparkline('html', options); } else if ($spark.hasClass('sparkline-multi')) {