Merge pull request #4498 from Icinga/bugfix/tactical-4494

/monitoring/tactical: fall back to unknown services if none critical
This commit is contained in:
Johannes Meyer 2021-12-14 10:24:57 +01:00 committed by GitHub
commit 316885b271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 15 deletions

View File

@ -23,11 +23,11 @@ class Donut
protected $labelBigUrl; 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 * Small label in the lower part of the donuts hole
@ -194,7 +194,7 @@ class Donut
*/ */
public function getLabelBigEyeCatching() public function getLabelBigEyeCatching()
{ {
return $this->labelBigEyeCatching; return $this->labelBigState !== null;
} }
/** /**
@ -206,7 +206,31 @@ class Donut
*/ */
public function setLabelBigEyeCatching($labelBigEyeCatching = true) 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; return $this;
} }
@ -332,9 +356,9 @@ class Donut
'attributes' => array( 'attributes' => array(
'aria-label' => $labelBig . ' ' . $labelSmall, 'aria-label' => $labelBig . ' ' . $labelSmall,
'href' => $this->getLabelBigUrl() ? $this->getLabelBigUrl()->getAbsoluteUrl() : null, 'href' => $this->getLabelBigUrl() ? $this->getLabelBigUrl()->getAbsoluteUrl() : null,
'class' => $this->labelBigEyeCatching 'class' => $this->labelBigState === null
? 'donut-label-big donut-label-big-eye-catching' ? 'donut-label-big'
: 'donut-label-big' : 'donut-label-big state-' . $this->labelBigState
), ),
'content' => $this->shortenLabel($labelBig) 'content' => $this->shortenLabel($labelBig)
); );

View File

@ -92,9 +92,13 @@ class TacticalController extends Controller
->addSlice($summary->services_unknown_unhandled, array('class' => 'slice-state-unknown')) ->addSlice($summary->services_unknown_unhandled, array('class' => 'slice-state-unknown'))
->addSlice($summary->services_pending, array('class' => 'slice-state-pending')) ->addSlice($summary->services_pending, array('class' => 'slice-state-pending'))
->addSlice($summary->services_pending_not_checked, array('class' => 'slice-state-not-checked')) ->addSlice($summary->services_pending_not_checked, array('class' => 'slice-state-not-checked'))
->setLabelBig($summary->services_critical_unhandled) ->setLabelBig($summary->services_critical_unhandled ?: $summary->services_unknown_unhandled)
->setLabelBigEyeCatching($summary->services_critical_unhandled > 0) ->setLabelBigState($summary->services_critical_unhandled > 0 ? 'critical' : (
->setLabelSmall($this->translate('Services 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 $this->view->hostStatusSummaryChart = $hostSummaryChart
->setLabelBigUrl($this->view->filteredUrl( ->setLabelBigUrl($this->view->filteredUrl(

View File

@ -602,6 +602,7 @@ ul.tree li a.error:hover {
.donut-label-big { .donut-label-big {
.var(color, gray-light); .var(color, gray-light);
.fg-stateful();
font-size: 6em; font-size: 6em;
line-height: 0; line-height: 0;
text-anchor: middle; text-anchor: middle;
@ -610,10 +611,6 @@ ul.tree li a.error:hover {
} }
} }
.donut-label-big-eye-catching {
.var(color, color-critical);
}
.donut-label-small { .donut-label-small {
.var(fill, text-color); .var(fill, text-color);
font-size: 1.2em; font-size: 1.2em;