Skip to content

Commit

Permalink
Use case-sensitive query columns when filtering downtimes by object
Browse files Browse the repository at this point in the history
refs #8613
  • Loading branch information
Johannes Meyer committed Apr 10, 2015
1 parent b8efe01 commit fda261b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Expand Up @@ -123,7 +123,7 @@ public function showAction()
}
if ((bool) $host->in_downtime === true) {
$objectsInDowntime[] = $host;
$downtimeFilterExpressions[] = Filter::where('downtime_host', $host->getName());
$downtimeFilterExpressions[] = Filter::where('host_name', $host->getName());
}
++$hostStates[$host::getStateText($host->state)];
}
Expand Down
4 changes: 2 additions & 2 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -280,10 +280,10 @@ public function downtimesAction()
'is_fixed' => 'downtime_is_fixed',
'is_in_effect' => 'downtime_is_in_effect',
'entry_time' => 'downtime_entry_time',
'host' => 'host_name',
'service' => 'service_description',
'host_state' => 'downtime_host_state',
'service_state' => 'downtime_service_state',
'host_name',
'service_description',
'host_display_name',
'service_display_name'
));
Expand Down
Expand Up @@ -158,8 +158,8 @@ public function showAction()
if ((bool) $service->in_downtime === true) {
$objectsInDowntime[] = $service;
$downtimeFilterExpressions[] = Filter::matchAll(
Filter::where('downtime_host', $service->getHost()->getName()),
Filter::where('downtime_service', $service->getName())
Filter::where('host_name', $service->getHost()->getName()),
Filter::where('service_description', $service->getName())
);
}
++$serviceStates[$service::getStateText($service->state)];
Expand Down
22 changes: 11 additions & 11 deletions modules/monitoring/application/views/scripts/list/downtimes.phtml
Expand Up @@ -30,7 +30,7 @@ use Icinga\Module\Monitoring\Object\Service;
<tbody>
<?php foreach ($downtimes as $downtime): ?>
<?php
if (isset($downtime->service)) {
if (isset($downtime->service_description)) {
$isService = true;
$stateName = Service::getStateText($downtime->service_state);
} else {
Expand All @@ -57,11 +57,11 @@ use Icinga\Module\Monitoring\Object\Service;
<?php if ($isService): ?>
<?= $this->icon('service', $this->translate('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: ?>
<?= $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 ?>
<br>
<?= $this->icon('comment', $this->translate('Comment')); ?> [<?= $this->escape($downtime->author) ?>] <?= $this->escape($downtime->comment) ?>
Expand All @@ -70,7 +70,7 @@ use Icinga\Module\Monitoring\Object\Service;
<?php if ($downtime->is_flexible): ?>
<?php if ($downtime->is_in_effect): ?>
<?= 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 host downtime was started on %s at %s and lasts for %s until %s at %s.'),
date('d.m.y', $downtime->start),
Expand All @@ -81,7 +81,7 @@ use Icinga\Module\Monitoring\Object\Service;
); ?>
<?php else: ?>
<?= 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 host downtime has been scheduled to start between %s - %s and to last for %s.'),
date('d.m.y H:i', $downtime->scheduled_start),
Expand All @@ -92,7 +92,7 @@ use Icinga\Module\Monitoring\Object\Service;
<?php else: ?>
<?php if ($downtime->is_in_effect): ?>
<?= 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 host downtime was started on %s at %s and expires on %s at %s.'),
date('d.m.y', $downtime->start),
Expand All @@ -102,7 +102,7 @@ use Icinga\Module\Monitoring\Object\Service;
); ?>
<?php else: ?>
<?= 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 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),
Expand All @@ -119,12 +119,12 @@ use Icinga\Module\Monitoring\Object\Service;
<?php
$delDowntimeForm = clone $delDowntimeForm;
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
if (! isset($downtime->service)) {
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host_name' => $downtime->host)));
if (! $isService) {
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host_name' => $downtime->host_name)));
} else {
$delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array(
'host_name' => $downtime->host,
'service_description' => $downtime->service
'host_name' => $downtime->host_name,
'service_description' => $downtime->service_description
)));
}
echo $delDowntimeForm;
Expand Down

0 comments on commit fda261b

Please sign in to comment.