Skip to content

Commit

Permalink
list/downtimes: Ensure dashboard compliance
Browse files Browse the repository at this point in the history
refs #7876
  • Loading branch information
Johannes Meyer committed Apr 17, 2015
1 parent 2964819 commit 5f19ec1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
8 changes: 5 additions & 3 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -250,8 +250,10 @@ public function downtimesAction()
if ($url = $this->hasBetterUrl()) {
return $this->redirectNow($url);
}

$this->addTitleTab('downtimes', $this->translate('Downtimes'), $this->translate('List downtimes'));
$this->setAutorefreshInterval(12);

$query = $this->backend->select()->from('downtime', array(
'id' => 'downtime_internal_id',
'objecttype' => 'downtime_objecttype',
Expand All @@ -273,9 +275,11 @@ public function downtimesAction()
'host_display_name',
'service_display_name'
));

$this->filterQuery($query);
$this->view->downtimes = $query->paginate();

$this->setupLimitControl();
$this->setupPaginationControl($this->view->downtimes);
$this->setupSortControl(array(
'downtime_is_in_effect' => $this->translate('Is In Effect'),
'host_display_name' => $this->translate('Host'),
Expand All @@ -289,8 +293,6 @@ public function downtimesAction()
'downtime_duration' => $this->translate('Duration')
));

$this->view->downtimes = $query->paginate();

if ($this->Auth()->hasPermission('monitoring/command/downtime/delete')) {
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
}
Expand Down
32 changes: 13 additions & 19 deletions modules/monitoring/application/views/scripts/list/downtimes.phtml
@@ -1,30 +1,24 @@
<?php

use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;

?>

<?php if (false === $this->compact): ?>
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs->render($this); ?>
<div style="margin: 1em" class="dontprint">
<?= $this->translate('Sort by'); ?> <?= $this->sortControl->render($this); ?>
<?php if (! $this->filterEditor): ?>
<?= $this->filterPreview ?>
<?php endif; ?>
</div>
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $downtimes->count())); ?>
<?= $this->paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
<?= $this->tabs; ?>
<?= $this->sortBox; ?>
<?= $this->limiter; ?>
<?= $this->paginator; ?>
<?= $this->filterEditor; ?>
</div>
<?php endif ?>

<div class="content">
<?= $this->filterEditor ?>
<?php if (count($downtimes) === 0): ?>
<?= $this->translate('No active downtimes'); ?>
</div>
<?php return; endif ?>
<?php

if (count($downtimes) === 0) {
echo $this->translate('No downtimes found matching the filter') . '</div>';
return;
}
?>

<table data-base-target="_next" class="action">
<tbody>
Expand Down

0 comments on commit 5f19ec1

Please sign in to comment.