List host event history when showing a host

refs #4663
This commit is contained in:
Eric Lippmann 2013-09-27 14:38:42 +02:00
parent 18bd1c3221
commit 5d0eaa5cd3
5 changed files with 20 additions and 3 deletions

View File

@ -96,6 +96,7 @@ class Monitoring_ShowController extends ActionController
public function hostAction() public function hostAction()
{ {
$this->view->object->prefetch(); $this->view->object->prefetch();
$this->view->object->eventHistory = $this->view->object->eventHistory->limit(10)->fetchAll();
$this->view->preserve = array(); $this->view->preserve = array();
} }

View File

@ -11,7 +11,7 @@
<td><?= date('d.m. H:i', $event->timestamp); ?></td> <td><?= date('d.m. H:i', $event->timestamp); ?></td>
<td> <td>
<?php if (!$object instanceof Icinga\Module\Monitoring\Object\Service): ?> <?php if ($object instanceof Icinga\Module\Monitoring\Object\Service): ?>
<a href="<?= $this->href('monitoring/show/service', array( <a href="<?= $this->href('monitoring/show/service', array(
'host' => $object->host_name, 'host' => $object->host_name,
'service' => $event->service_description 'service' => $event->service_description
@ -84,6 +84,20 @@
<? endforeach; ?> <? endforeach; ?>
</tbody> </tbody>
</table> </table>
<?php if ($object instanceof Icinga\Module\Monitoring\Object\Service): ?>
<a href="<?= $this->href('monitoring/list/eventhistory', array(
'host' => $object->host_name,
'service' => $object->service_description
)); ?>">
All events for <?= $event->service_description ?>
</a>
<?php else: ?>
<a href="<?= $this->href('monitoring/list/eventhistory', array(
'host' => $object->host_name
)); ?>">
All events for <?= $event->host_name ?>
</a>
<?php endif; ?>
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>

View File

@ -15,3 +15,5 @@
<?= $this->render('show/components/flags.phtml'); ?> <?= $this->render('show/components/flags.phtml'); ?>
<?= $this->render('show/components/perfdata.phtml'); ?> <?= $this->render('show/components/perfdata.phtml'); ?>
<?= $this->render('show/components/eventHistory.phtml'); ?>

View File

@ -158,7 +158,6 @@ abstract class AbstractObject
'type' 'type'
)) ))
); );
// echo $this->foreign['eventHistory']->dump();die;
return $this; return $this;
} }
} }

View File

@ -30,7 +30,8 @@ class Host extends AbstractObject
->fetchContacts() ->fetchContacts()
->fetchContactgroups() ->fetchContactgroups()
->fetchCustomvars() ->fetchCustomvars()
->fetchComments(); ->fetchComments()
->fetchEventHistory();
} }
protected function fetchObject() protected function fetchObject()