mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-20 12:24:29 +02:00
Display acknowledgement action for all unacknowledged objects
Instead of displaying the ack for all unhandled problem host, make acknowledgement possible for all monitored objects in multi views. fixes #7931
This commit is contained in:
parent
068bfc0c71
commit
29cc92a3f3
@ -133,13 +133,14 @@ class Monitoring_HostsController extends Controller
|
||||
$this->view->objects = $this->hostList;
|
||||
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
||||
$this->view->problemObjects = $this->hostList->getProblemObjects();
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($this->hostList->getProblemObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
||||
$this->view->acknowledgeLink = Url::fromPath('monitoring/hosts/acknowledge-problem')
|
||||
->setQueryString($this->hostList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->unacknowledgedObjects = $this->hostList->getUnacknowledgedObjects();
|
||||
$this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts')
|
||||
->setQueryString(
|
||||
|
@ -149,13 +149,14 @@ class Monitoring_ServicesController extends Controller
|
||||
$this->view->objects = $this->serviceList;
|
||||
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
|
||||
$this->view->problemObjects = $this->serviceList->getProblemObjects();
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/services/acknowledge-problem')
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
||||
$this->view->acknowledgeLink = Url::fromPath('monitoring/services/acknowledge-problem')
|
||||
->setQueryString($this->serviceList->getUnacknowledgedObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->unacknowledgedObjects = $this->serviceList->getUnacknowledgedObjects();
|
||||
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/services')
|
||||
->setQueryString($this->serviceList->getObjectsInDowntime()
|
||||
|
@ -72,9 +72,10 @@
|
||||
<?php
|
||||
$unhandledCount = count($unhandledObjects);
|
||||
$problemCount = count($problemObjects);
|
||||
$unackCount = count($unacknowledgedObjects);
|
||||
?>
|
||||
|
||||
<?php if ($problemCount || $unhandledCount): ?>
|
||||
<?php if ($problemCount || $unhandledCount || $unackCount): ?>
|
||||
<h3>
|
||||
<?= $this->icon('attention-alt') ?>
|
||||
<?= $this->translatePlural(
|
||||
@ -110,6 +111,24 @@
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if ($unackCount > 0): ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unacknowledged problem hosts',
|
||||
'Acknowledge %u unacknowledged problem hosts',
|
||||
$unackCount
|
||||
),
|
||||
$unackCount
|
||||
),
|
||||
$acknowledgeLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($unhandledCount): ?>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
@ -136,21 +155,6 @@
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled problem host',
|
||||
'Acknowledge %u unhandled problem hosts',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif;?>
|
||||
|
||||
|
@ -70,9 +70,10 @@
|
||||
<?php
|
||||
$unhandledCount = count($unhandledObjects);
|
||||
$problemCount = count($problemObjects);
|
||||
$unackCount = count($unacknowledgedObjects);
|
||||
?>
|
||||
|
||||
<?php if ($problemCount || $unhandledCount): ?>
|
||||
<?php if ($problemCount || $unhandledCount || $unackCount): ?>
|
||||
<div>
|
||||
<h3>
|
||||
<?= $this->icon('attention-alt') ?>
|
||||
@ -105,6 +106,25 @@
|
||||
); ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
?>
|
||||
<?php if ($unackCount > 0): ?>
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unacknowledged problem service',
|
||||
'Acknowledge %u unacknowledged problem services',
|
||||
$unackCount
|
||||
),
|
||||
$unackCount
|
||||
),
|
||||
$acknowledgeLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($unhandledCount): ?>
|
||||
<p>
|
||||
<?= sprintf($this->translate('There are %s unhandled problem services. ' .
|
||||
@ -126,20 +146,6 @@
|
||||
array('icon' => 'plug')
|
||||
); ?>
|
||||
|
||||
<br>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translatePlural(
|
||||
'Acknowledge %u unhandled problem service',
|
||||
'Acknowledge %u unhandled problem services',
|
||||
$unhandledCount
|
||||
),
|
||||
$unhandledCount
|
||||
),
|
||||
$acknowledgeUnhandledLink,
|
||||
null,
|
||||
array('icon' => 'ok')
|
||||
); ?>
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
||||
|
@ -99,4 +99,19 @@ class HostList extends ObjectList
|
||||
->applyFilter(clone $this->filter)
|
||||
->where('downtime_objecttype', 'host');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getUnacknowledgedObjects()
|
||||
{
|
||||
$unhandledObjects = array();
|
||||
foreach ($this as $object) {
|
||||
if (! in_array((int) $object->state, array(0, 99)) &&
|
||||
(bool) $object->host_acknowledged === false) {
|
||||
$unhandledObjects[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($unhandledObjects);
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +193,11 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
||||
return $this->newFromArray($handledObjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public abstract function getUnacknowledgedObjects();
|
||||
|
||||
/**
|
||||
* Create a ObjectList from an array of hosts without querying a backend
|
||||
*
|
||||
|
@ -147,4 +147,19 @@ class ServiceList extends ObjectList
|
||||
->applyFilter(clone $this->filter)
|
||||
->where('downtime_objecttype', 'service');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectList
|
||||
*/
|
||||
public function getUnacknowledgedObjects()
|
||||
{
|
||||
$unhandledObjects = array();
|
||||
foreach ($this as $object) {
|
||||
if (! in_array((int) $object->state, array(0, 99)) &&
|
||||
(bool) $object->service_acknowledged === false) {
|
||||
$unhandledObjects[] = $object;
|
||||
}
|
||||
}
|
||||
return $this->newFromArray($unhandledObjects);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user