Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions src/Centreon/Domain/Monitoring/ResourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,13 @@ public function findResources(ResourceFilter $filter): array
*/
public function enrichHostWithDetails(ResourceEntity $resource): void
{
$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getId(),
0
);
$resource->setDowntimes($downtimes);
if ($resource->getInDowntime() === true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to rename later getInDowtime by isInDowntime

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I did not take the time to do it as multiple impacts which are not that mandatory as 21.10 will reach EOL soon

$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getId(),
0
);
$resource->setDowntimes($downtimes);
}

if ($resource->getAcknowledged()) {
$acknowledgements = $this->monitoringRepository->findAcknowledgements(
Expand Down Expand Up @@ -196,11 +198,13 @@ public function enrichServiceWithDetails(ResourceEntity $resource): void
throw new ResourceException(_('Parent of resource type service cannot be null'));
}

$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getParent()->getId(),
$resource->getId()
);
$resource->setDowntimes($downtimes);
if ($resource->getInDowntime() === true) {
$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getParent()->getId(),
$resource->getId()
);
$resource->setDowntimes($downtimes);
}

if ($resource->getAcknowledged()) {
$acknowledgements = $this->monitoringRepository->findAcknowledgements(
Expand Down Expand Up @@ -236,11 +240,13 @@ public function enrichServiceWithDetails(ResourceEntity $resource): void
*/
public function enrichMetaServiceWithDetails(ResourceEntity $resource): void
{
$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getHostId(),
$resource->getServiceId()
);
$resource->setDowntimes($downtimes);
if ($resource->getInDowntime() === true) {
$downtimes = $this->monitoringRepository->findDowntimes(
$resource->getHostId(),
$resource->getServiceId()
);
$resource->setDowntimes($downtimes);
}

if ($resource->getAcknowledged()) {
$acknowledgements = $this->monitoringRepository->findAcknowledgements(
Expand Down