diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index eaa3d03a4..ec4e470a2 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -111,14 +111,19 @@ class Monitoring_HostsController extends Controller $objectsInDowntime = array(); $downtimeFilterExpressions = array(); $hostStates = array( - Host::getStateText(Host::STATE_UP) => 0, - Host::getStateText(Host::STATE_DOWN) => 0, - Host::getStateText(Host::STATE_UNREACHABLE) => 0, - Host::getStateText(Host::STATE_PENDING) => 0, + 'hosts_' . Host::getStateText(Host::STATE_UP) => 0, + 'hosts_' . Host::getStateText(Host::STATE_UP) . '_unhandled' => 0, + 'hosts_' . Host::getStateText(Host::STATE_DOWN) => 0, + 'hosts_' . Host::getStateText(Host::STATE_DOWN) . '_unhandled' => 0, + 'hosts_' . Host::getStateText(Host::STATE_UNREACHABLE) => 0, + 'hosts_' . Host::getStateText(Host::STATE_UNREACHABLE) . '_unhandled' => 0, + 'hosts_' . Host::getStateText(Host::STATE_PENDING) => 0, + 'hosts_' . Host::getStateText(Host::STATE_PENDING) . '_unhandled' => 0, ); foreach ($this->hostList as $host) { /** @var Host $host */ - if ((bool) $host->problem === true && (bool) $host->handled === false) { + $unhandled = (bool) $host->problem === true && (bool) $host->handled === false; + if ($unhandled) { $unhandledObjects[] = $host; $unhandledFilterExpressions[] = Filter::where('host', $host->getName()); } @@ -129,7 +134,7 @@ class Monitoring_HostsController extends Controller $objectsInDowntime[] = $host; $downtimeFilterExpressions[] = Filter::where('downtime_host', $host->getName()); } - ++$hostStates[$host::getStateText($host->state)]; + ++$hostStates['hosts_' . $host::getStateText($host->state) . ($unhandled ? '_unhandled' : '')]; } if (! empty($acknowledgedObjects)) { $removeAckForm = new RemoveAcknowledgementCommandForm(); @@ -145,7 +150,7 @@ class Monitoring_HostsController extends Controller $this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result'); $this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment'); $this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/hosts/delete-comment'); - $this->view->hostStates = $hostStates; + $this->view->hostStates = (object)$hostStates; $this->view->objects = $this->hostList; $this->view->unhandledObjects = $unhandledObjects; $unhandledFilterQueryString = Filter::matchAny($unhandledFilterExpressions)->toQueryString(); diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index c8a4f9484..f4ac40904 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -8,12 +8,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm; -

- qlink( - sprintf($this->translate('%d Hosts Selected'), count($objects)), - $listAllLink - ); ?> -

+ render('partials/host/objects-tinysummary.phtml') ?> render('partials/host/objects-header.phtml'); ?> diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml index c2f016ceb..d535f367e 100644 --- a/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/host/objects-header.phtml @@ -2,14 +2,12 @@ use Icinga\Module\Monitoring\Object\Host; ?> - - 0): ?>

@@ -71,8 +69,8 @@ $hiddenRich = array(); - -

+
translate('%d more ...'), count($hidden)) ?>
diff --git a/modules/monitoring/application/views/scripts/partials/host/objects-tinysummary.phtml b/modules/monitoring/application/views/scripts/partials/host/objects-tinysummary.phtml new file mode 100644 index 000000000..fa841c633 --- /dev/null +++ b/modules/monitoring/application/views/scripts/partials/host/objects-tinysummary.phtml @@ -0,0 +1,44 @@ + + +

+ qlink( + sprintf($this->translate('%d Hosts Selected:'), count($objects)), + $listAllLink + ); ?> + + + hosts_up): ?> + + + + hosts_up ?> + + + + + 'down', + 2 => 'unreachable', + 99 => 'pending' + ) as $stateId => $state) { + + $stateName = 'hosts_' . $state; + $unhandledStateName = $stateName . '_unhandled'; + if ($hostStates->$unhandledStateName) { + echo '' . $hostStates->$unhandledStateName . ''; + } + if ($hostStates->$stateName) { + echo '' . $hostStates->$stateName . ''; + } + if ($hostStates->$unhandledStateName) { + echo ''; + } + $stateName .= '_unhandled'; + }?> + + +

\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml index 4501f0e7e..dd206a646 100644 --- a/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml +++ b/modules/monitoring/application/views/scripts/partials/service/objects-header.phtml @@ -1,6 +1,5 @@