Use case-sensitive query columns when filtering downtimes by object

refs #8613
This commit is contained in:
Johannes Meyer 2015-04-10 14:19:38 +02:00
parent b8efe01170
commit fda261bf22
4 changed files with 16 additions and 16 deletions

View File

@ -123,7 +123,7 @@ class Monitoring_HostsController extends Controller
} }
if ((bool) $host->in_downtime === true) { if ((bool) $host->in_downtime === true) {
$objectsInDowntime[] = $host; $objectsInDowntime[] = $host;
$downtimeFilterExpressions[] = Filter::where('downtime_host', $host->getName()); $downtimeFilterExpressions[] = Filter::where('host_name', $host->getName());
} }
++$hostStates[$host::getStateText($host->state)]; ++$hostStates[$host::getStateText($host->state)];
} }

View File

@ -280,10 +280,10 @@ class Monitoring_ListController extends Controller
'is_fixed' => 'downtime_is_fixed', 'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect', 'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time', 'entry_time' => 'downtime_entry_time',
'host' => 'host_name',
'service' => 'service_description',
'host_state' => 'downtime_host_state', 'host_state' => 'downtime_host_state',
'service_state' => 'downtime_service_state', 'service_state' => 'downtime_service_state',
'host_name',
'service_description',
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));

View File

@ -158,8 +158,8 @@ class Monitoring_ServicesController extends Controller
if ((bool) $service->in_downtime === true) { if ((bool) $service->in_downtime === true) {
$objectsInDowntime[] = $service; $objectsInDowntime[] = $service;
$downtimeFilterExpressions[] = Filter::matchAll( $downtimeFilterExpressions[] = Filter::matchAll(
Filter::where('downtime_host', $service->getHost()->getName()), Filter::where('host_name', $service->getHost()->getName()),
Filter::where('downtime_service', $service->getName()) Filter::where('service_description', $service->getName())
); );
} }
++$serviceStates[$service::getStateText($service->state)]; ++$serviceStates[$service::getStateText($service->state)];

View File

@ -30,7 +30,7 @@ use Icinga\Module\Monitoring\Object\Service;
<tbody> <tbody>
<?php foreach ($downtimes as $downtime): ?> <?php foreach ($downtimes as $downtime): ?>
<?php <?php
if (isset($downtime->service)) { if (isset($downtime->service_description)) {
$isService = true; $isService = true;
$stateName = Service::getStateText($downtime->service_state); $stateName = Service::getStateText($downtime->service_state);
} else { } else {
@ -57,11 +57,11 @@ use Icinga\Module\Monitoring\Object\Service;
<?php if ($isService): ?> <?php if ($isService): ?>
<?= $this->icon('service', $this->translate('Service')); ?> <?= $this->icon('service', $this->translate('Service')); ?>
<?= $this->link()->service( <?= $this->link()->service(
$downtime->service, $downtime->service_display_name, $downtime->host, $downtime->host_display_name $downtime->service_description, $downtime->service_display_name, $downtime->host_name, $downtime->host_display_name
) ?> ) ?>
<?php else: ?> <?php else: ?>
<?= $this->icon('host', $this->translate('Host')); ?> <?= $this->icon('host', $this->translate('Host')); ?>
<?= $this->link()->host($downtime->host, $downtime->host_display_name) ?> <?= $this->link()->host($downtime->host_name, $downtime->host_display_name) ?>
<?php endif ?> <?php endif ?>
<br> <br>
<?= $this->icon('comment', $this->translate('Comment')); ?> [<?= $this->escape($downtime->author) ?>] <?= $this->escape($downtime->comment) ?> <?= $this->icon('comment', $this->translate('Comment')); ?> [<?= $this->escape($downtime->author) ?>] <?= $this->escape($downtime->comment) ?>
@ -70,7 +70,7 @@ use Icinga\Module\Monitoring\Object\Service;
<?php if ($downtime->is_flexible): ?> <?php if ($downtime->is_flexible): ?>
<?php if ($downtime->is_in_effect): ?> <?php if ($downtime->is_in_effect): ?>
<?= sprintf( <?= sprintf(
isset($downtime->service) $isService
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.') ? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'), : $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
date('d.m.y', $downtime->start), date('d.m.y', $downtime->start),
@ -81,7 +81,7 @@ use Icinga\Module\Monitoring\Object\Service;
); ?> ); ?>
<?php else: ?> <?php else: ?>
<?= sprintf( <?= sprintf(
isset($downtime->service) $isService
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.') ? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'), : $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
date('d.m.y H:i', $downtime->scheduled_start), date('d.m.y H:i', $downtime->scheduled_start),
@ -92,7 +92,7 @@ use Icinga\Module\Monitoring\Object\Service;
<?php else: ?> <?php else: ?>
<?php if ($downtime->is_in_effect): ?> <?php if ($downtime->is_in_effect): ?>
<?= sprintf( <?= sprintf(
isset($downtime->service) $isService
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.') ? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'), : $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
date('d.m.y', $downtime->start), date('d.m.y', $downtime->start),
@ -102,7 +102,7 @@ use Icinga\Module\Monitoring\Object\Service;
); ?> ); ?>
<?php else: ?> <?php else: ?>
<?= sprintf( <?= sprintf(
isset($downtime->service) $isService
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.') ? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'), : $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
date('d.m.y', $downtime->scheduled_start), date('d.m.y', $downtime->scheduled_start),
@ -119,12 +119,12 @@ use Icinga\Module\Monitoring\Object\Service;
<?php <?php
$delDowntimeForm = clone $delDowntimeForm; $delDowntimeForm = clone $delDowntimeForm;
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url)); $delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
if (! isset($downtime->service)) { if (! $isService) {
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host_name' => $downtime->host))); $delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host_name' => $downtime->host_name)));
} else { } else {
$delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array( $delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array(
'host_name' => $downtime->host, 'host_name' => $downtime->host_name,
'service_description' => $downtime->service 'service_description' => $downtime->service_description
))); )));
} }
echo $delDowntimeForm; echo $delDowntimeForm;