From 8b651d5f13bef88a7b9ce846e7f18c724fb946ed Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 2 Aug 2021 18:29:02 +0200 Subject: [PATCH 1/2] Donut: allow big label to indicate a specific state refs #4494 --- library/Icinga/Chart/Donut.php | 40 +++++++++++++++++++++++++++------- public/css/icinga/widgets.less | 5 +---- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/library/Icinga/Chart/Donut.php b/library/Icinga/Chart/Donut.php index 48b28f267..9d2a2a838 100644 --- a/library/Icinga/Chart/Donut.php +++ b/library/Icinga/Chart/Donut.php @@ -23,11 +23,11 @@ class Donut protected $labelBigUrl; /** - * Whether the big label shall be eye-catching + * The state the big label shall indicate * - * @var bool + * @var string|null */ - protected $labelBigEyeCatching = true; + protected $labelBigState = 'critical'; /** * Small label in the lower part of the donuts hole @@ -194,7 +194,7 @@ class Donut */ public function getLabelBigEyeCatching() { - return $this->labelBigEyeCatching; + return $this->labelBigState !== null; } /** @@ -206,7 +206,31 @@ class Donut */ public function setLabelBigEyeCatching($labelBigEyeCatching = true) { - $this->labelBigEyeCatching = $labelBigEyeCatching; + $this->labelBigState = $labelBigEyeCatching ? 'critical' : null; + + return $this; + } + + /** + * Get the state the big label shall indicate + * + * @return string|null + */ + public function getLabelBigState() + { + return $this->labelBigState; + } + + /** + * Set the state the big label shall indicate + * + * @param string|null $labelBigState + * + * @return $this + */ + public function setLabelBigState($labelBigState) + { + $this->labelBigState = $labelBigState; return $this; } @@ -332,9 +356,9 @@ class Donut 'attributes' => array( 'aria-label' => $labelBig . ' ' . $labelSmall, 'href' => $this->getLabelBigUrl() ? $this->getLabelBigUrl()->getAbsoluteUrl() : null, - 'class' => $this->labelBigEyeCatching - ? 'donut-label-big donut-label-big-eye-catching' - : 'donut-label-big' + 'class' => $this->labelBigState === null + ? 'donut-label-big' + : 'donut-label-big state-' . $this->labelBigState ), 'content' => $this->shortenLabel($labelBig) ); diff --git a/public/css/icinga/widgets.less b/public/css/icinga/widgets.less index 8212c785f..146f7f150 100644 --- a/public/css/icinga/widgets.less +++ b/public/css/icinga/widgets.less @@ -586,6 +586,7 @@ ul.tree li a.error:hover { .donut-label-big { .var(color, gray-light); + .fg-stateful(); font-size: 6em; line-height: 0; text-anchor: middle; @@ -594,10 +595,6 @@ ul.tree li a.error:hover { } } -.donut-label-big-eye-catching { - .var(color, color-critical); -} - .donut-label-small { .var(fill, text-color); font-size: 1.2em; From 6e1ab2c0ea32054896d5cb75c8ee08671a4c7bad Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 2 Aug 2021 14:16:04 +0200 Subject: [PATCH 2/2] /monitoring/tactical: fall back to unknown services if none critical refs #4494 --- .../application/controllers/TacticalController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/application/controllers/TacticalController.php b/modules/monitoring/application/controllers/TacticalController.php index 181341865..1545d1093 100644 --- a/modules/monitoring/application/controllers/TacticalController.php +++ b/modules/monitoring/application/controllers/TacticalController.php @@ -92,9 +92,13 @@ class TacticalController extends Controller ->addSlice($summary->services_unknown_unhandled, array('class' => 'slice-state-unknown')) ->addSlice($summary->services_pending, array('class' => 'slice-state-pending')) ->addSlice($summary->services_pending_not_checked, array('class' => 'slice-state-not-checked')) - ->setLabelBig($summary->services_critical_unhandled) - ->setLabelBigEyeCatching($summary->services_critical_unhandled > 0) - ->setLabelSmall($this->translate('Services Critical')); + ->setLabelBig($summary->services_critical_unhandled ?: $summary->services_unknown_unhandled) + ->setLabelBigState($summary->services_critical_unhandled > 0 ? 'critical' : ( + $summary->services_unknown_unhandled > 0 ? 'unknown' : null + )) + ->setLabelSmall($summary->services_critical_unhandled > 0 || $summary->services_unknown_unhandled < 1 + ? $this->translate('Services Critical') + : $this->translate('Services Unknown')); $this->view->hostStatusSummaryChart = $hostSummaryChart ->setLabelBigUrl($this->view->filteredUrl(