Show better error message for unknown downtimes

refs #8902
This commit is contained in:
Matthias Jentsch 2015-04-23 12:19:58 +02:00
parent 9114a34223
commit 20b25e656b
3 changed files with 11 additions and 2 deletions

View File

@ -76,12 +76,14 @@ class Monitoring_DowntimeController extends Controller
public function showAction() public function showAction()
{ {
if (false === $this->downtime) {
return;
}
$this->view->downtime = $this->downtime; $this->view->downtime = $this->downtime;
$this->view->isService = $this->isService; $this->view->isService = $this->isService;
$this->view->stateName = isset($this->downtime->service_description) ? $this->view->stateName = isset($this->downtime->service_description) ?
Service::getStateText($this->downtime->service_state) : Service::getStateText($this->downtime->service_state) :
Host::getStateText($this->downtime->host_state); Host::getStateText($this->downtime->host_state);
$this->view->delDowntimeForm = $this->createDelDowntimeForm(); $this->view->delDowntimeForm = $this->createDelDowntimeForm();
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes'); $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
$this->view->showHostLink = Url::fromPath('monitoring/host/show') $this->view->showHostLink = Url::fromPath('monitoring/host/show')

View File

@ -1,4 +1,10 @@
<div class="controls"> <div class="controls">
<?php if (! isset($downtime)): ?>
<?= $this->translate('No scheduled downtime matching the filter.') ?>
</div>
<?php return; ?>
<?php endif; ?>
<?php if (! $this->compact): ?> <?php if (! $this->compact): ?>
<?= $this->tabs; ?> <?= $this->tabs; ?>
<?php endif ?> <?php endif ?>

View File

@ -15,7 +15,8 @@ if (! $this->compact): ?>
<?php <?php
if (count($downtimes) === 0) { if (count($downtimes) === 0) {
echo $this->translate('No downtimes found matching the filter') . '</div>'; echo $this->translate('No downtimes found matching the filter,'
. ' maybe the downtime already expired.') . '</div>';
return; return;
} }
?> ?>