mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-07 05:54:25 +02:00
Integrate comments and downtimes into MonitoredObjectsController
Add option to list all related commends and downtimes into the specific hosts and serivces views. refs #8565
This commit is contained in:
parent
fe2ee3617b
commit
00bbb762a1
@ -2,6 +2,7 @@
|
|||||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||||
|
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\Data\Filter\FilterEqual;
|
||||||
use Icinga\Module\Monitoring\Controller;
|
use Icinga\Module\Monitoring\Controller;
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\AcknowledgeProblemCommandForm;
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm;
|
||||||
@ -140,7 +141,6 @@ class Monitoring_HostsController extends Controller
|
|||||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
|
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
|
||||||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
|
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
|
||||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
|
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
|
||||||
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/hosts/delete-comment');
|
|
||||||
$this->view->stats = $hostStates;
|
$this->view->stats = $hostStates;
|
||||||
$this->view->objects = $this->hostList;
|
$this->view->objects = $this->hostList;
|
||||||
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
||||||
@ -154,9 +154,20 @@ class Monitoring_HostsController extends Controller
|
|||||||
->setQueryString($this->hostList->getProblemObjects()->objectsFilter());
|
->setQueryString($this->hostList->getProblemObjects()->objectsFilter());
|
||||||
$this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
$this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
||||||
$this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
|
$this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
|
||||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/hosts')
|
||||||
->setQueryString($this->hostList->getObjectsInDowntime()->objectsFilter(array('host' => 'downtime_host')));
|
->setQueryString(
|
||||||
|
$this->hostList
|
||||||
|
->getObjectsInDowntime()
|
||||||
|
->objectsFilter()
|
||||||
|
->toQueryString()
|
||||||
|
);
|
||||||
|
$this->view->showDowntimesLink = Url::fromPath('monitoring/list/downtimes')
|
||||||
|
->setQueryString(
|
||||||
|
$this->hostList
|
||||||
|
->objectsFilter()
|
||||||
|
->andFilter(FilterEqual::where('downtime_objecttype', 'host'))
|
||||||
|
->toQueryString()
|
||||||
|
);
|
||||||
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
||||||
$this->view->baseFilter = $this->hostList->getFilter();
|
$this->view->baseFilter = $this->hostList->getFilter();
|
||||||
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
|
$this->view->sendCustomNotificationLink = Url::fromRequest()->setPath('monitoring/hosts/send-custom-notification');
|
||||||
|
@ -160,9 +160,14 @@ class Monitoring_ServicesController extends Controller
|
|||||||
->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
|
->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
|
||||||
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
||||||
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
|
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
|
||||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/services')
|
||||||
->setQueryString($this->serviceList->getObjectsInDowntime()
|
->setQueryString($this->serviceList->getObjectsInDowntime()
|
||||||
->objectsFilter(array('host' => 'downtime_host', 'service' => 'downtime_service'))->toQueryString());
|
->objectsFilter(array('host' => 'host_name', 'service' => 'service_description'))->toQueryString());
|
||||||
|
$this->view->showDowntimesLink = Url::fromPath('monitoring/downtimes/show')
|
||||||
|
->setQueryString(
|
||||||
|
$this->serviceList->getObjectsInDowntime()
|
||||||
|
->objectsFilter()->toQueryString()
|
||||||
|
);
|
||||||
$this->view->commentsLink = Url::fromRequest()
|
$this->view->commentsLink = Url::fromRequest()
|
||||||
->setPath('monitoring/list/comments');
|
->setPath('monitoring/list/comments');
|
||||||
$this->view->baseFilter = $this->serviceList->getFilter();
|
$this->view->baseFilter = $this->serviceList->getFilter();
|
||||||
|
@ -86,4 +86,17 @@ class HostList extends ObjectList
|
|||||||
}
|
}
|
||||||
return FilterOr::matchAny($filterExpression);
|
return FilterOr::matchAny($filterExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scheduled downtimes
|
||||||
|
*
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public function getScheduledDowntimes()
|
||||||
|
{
|
||||||
|
return $this->backend->select()
|
||||||
|
->from('downtime')
|
||||||
|
->applyFilter(clone $this->filter)
|
||||||
|
->where('downtime_objecttype', 'host');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,16 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||||||
return $this->backend->select()->from('comment')->applyFilter($this->filter);
|
return $this->backend->select()->from('comment')->applyFilter($this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scheduled downtimes
|
||||||
|
*
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public function getScheduledDowntimes()
|
||||||
|
{
|
||||||
|
return $this->backend->select()->from('downtime')->applyFilter($this->filter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ObjectList
|
* @return ObjectList
|
||||||
*/
|
*/
|
||||||
|
@ -134,5 +134,17 @@ class ServiceList extends ObjectList
|
|||||||
}
|
}
|
||||||
return FilterOr::matchAny($filterExpression);
|
return FilterOr::matchAny($filterExpression);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the scheduled downtimes
|
||||||
|
*
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
public function getScheduledDowntimes()
|
||||||
|
{
|
||||||
|
return $this->backend->select()
|
||||||
|
->from('downtime')
|
||||||
|
->applyFilter(clone $this->filter)
|
||||||
|
->where('downtime_objecttype', 'service');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user