-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1634fcd
commit 20b7b4b
Showing
5 changed files
with
291 additions
and
354 deletions.
There are no files selected for viewing
265 changes: 120 additions & 145 deletions
265
modules/monitoring/application/views/scripts/list/comments.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,162 +1,137 @@ | ||
<?php | ||
$dateHelper = $this->getHelper('DateFormat'); | ||
$dateHelper = $this->getHelper('DateFormat'); | ||
$commandHelper = $this->getHelper('CommandForm'); | ||
$viewHelper = $this->getHelper('MonitoringState'); | ||
|
||
/** @var Zend_View_Helper_CommandForm $commandHelper */ | ||
$commandHelper = $this->getHelper('CommandForm'); | ||
$viewHelper = $this->getHelper('MonitoringState'); | ||
?> | ||
|
||
<div class="row"> | ||
<div class="pull-left"> | ||
<h1>Comments</h1> | ||
</div> | ||
<div class="pull-right"> | ||
<?= $this->tabs->render($this); ?> | ||
</div> | ||
<div class="controls"> | ||
<?= $this->tabs ?> | ||
<?= $this->sortControl->render($this); ?> | ||
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?> | ||
</div> | ||
|
||
<div data-icinga-component="app/mainDetailGrid" data-icinga-grid-selection-type="single"> | ||
|
||
<div class="container pull-left"> | ||
|
||
<div class="row"> | ||
<div class="col-md-12"> | ||
<?= $this->sortControl->render($this); ?> | ||
<div class="content"> | ||
<table class="action"> | ||
<tbody> | ||
<?php foreach ($comments as $comment): | ||
|
||
$objectType = ($comment->comment_objecttype_id === '1') ? 'host' : 'service'; | ||
$objectName = ($objectType === 'host') ? $comment->host_name : $comment->service_name; | ||
$hrefParameters = array( | ||
$objectType => $objectName, | ||
'comment_id' => $comment->comment_id | ||
); | ||
if ($objectType === 'service') { | ||
$hrefParameters['host'] = $comment->host_name; | ||
} | ||
|
||
$detailLink = $this->href( | ||
'monitoring/show/' . $objectType, | ||
$hrefParameters | ||
); | ||
|
||
$hostLink = $this->href( | ||
'monitoring/show/host', | ||
array( | ||
'host' => $comment->host_name | ||
) | ||
); | ||
?> | ||
<tr> | ||
<td> | ||
<?= date('d.m. H:i', $comment->comment_timestamp); ?> | ||
</td> | ||
|
||
<td> | ||
<?php if ($comment->comment_objecttype_id === '1'): ?> | ||
<?= $this->img('img/icons/host.png', array('title' => 'Host comment')) ?> | ||
<?php elseif ($comment->comment_objecttype_id === '2'): ?> | ||
<?= $this->img('img/icons/service.png', array('title' => 'Service comment')) ?> | ||
<?php endif; ?> | ||
<small> | ||
<?php | ||
switch ($comment->comment_type) { | ||
case 'flapping': | ||
$icon = 'flapping'; | ||
$tooltip = 'Comment was caused by a flapping host or service.'; | ||
break; | ||
case 'comment': | ||
$icon = 'user'; | ||
$tooltip = 'Comment was created by an user.'; | ||
break; | ||
case 'downtime': | ||
$icon = 'down'; | ||
$tooltip = 'Comment was caused by a downtime.'; | ||
case 'ack': | ||
$icon = 'acknowledgement'; | ||
$tooltip = 'Comment was caused by an acknowledgement.'; | ||
} | ||
?> | ||
<?= $this->img('img/icons/' . $icon . '.png', array('title' => $tooltip)) ?> | ||
</small> | ||
</td> | ||
|
||
<td> | ||
<a class="hidden" href="<?= $detailLink; ?>"></a> | ||
|
||
<div rel="tooltip" title="Comment #<?=$comment->comment_id ?>"> | ||
For | ||
<?php if ($comment->service_name): ?> | ||
<a href="<?= $detailLink ?>"> | ||
<?= $comment->service_name ?> | ||
on | ||
<?= $comment->host_name; ?> | ||
</a> | ||
<?php else: ?> | ||
<a href="<?= $hostLink ?>"> | ||
<?= $comment->host_name; ?> | ||
</a> | ||
<?php endif; ?> | ||
by | ||
<?= $comment->comment_author; ?> | ||
<div class="small-row"> | ||
<?= $comment->comment_data; ?> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?> | ||
</div> | ||
|
||
<div class="row"> | ||
<?= $this->selectionToolbar('single'); ?> | ||
</div> | ||
</div> | ||
|
||
<table class="table table-condensed pull-left"> | ||
<tbody> | ||
<?php foreach ($comments as $comment): ?> | ||
<small> | ||
<span> | ||
<b>Persists: </b><?= ($comment->comment_is_persistent === '1') ? 'Yes' : 'No'; ?> | ||
</span> | ||
<span> | ||
<b>Expires: </b> <?= | ||
($comment->comment_expiration_timestamp) ? | ||
'at ' . date('d.m H:i', $comment->comment_expiration_timestamp) : | ||
'Never'; | ||
?> | ||
</span> | ||
</small> | ||
|
||
</td> | ||
<td> | ||
<?php | ||
$objectType = ($comment->comment_objecttype_id === '1') ? 'host' : 'service'; | ||
$objectName = ($objectType === 'host') ? $comment->host_name : $comment->service_name; | ||
$hrefParameters = array( | ||
$objectType => $objectName, | ||
'comment_id' => $comment->comment_id | ||
$data = array( | ||
'commentid' => $comment->comment_id, | ||
'host' => $comment->host_name | ||
); | ||
|
||
if ($objectType === 'service') { | ||
$hrefParameters['host'] = $comment->host_name; | ||
$data['service'] = $comment->service_name; | ||
} | ||
|
||
$detailLink = $this->href( | ||
'monitoring/show/' . $objectType, | ||
$hrefParameters | ||
); | ||
|
||
$hostLink = $this->href( | ||
'monitoring/show/host', | ||
array( | ||
'host' => $comment->host_name | ||
) | ||
echo $commandHelper->iconSubmitForm( | ||
'img/icons/remove.png', | ||
'Remove comment', | ||
'btn-small', | ||
'removecomment', | ||
$data | ||
); | ||
?> | ||
<tr> | ||
<td> | ||
<?= date('d.m. H:i', $comment->comment_timestamp); ?> | ||
</td> | ||
|
||
<td> | ||
<?php if ($comment->comment_objecttype_id === '1'): ?> | ||
<?= $this->img('img/icons/host.png', array('title' => 'Host comment')) ?> | ||
<?php elseif ($comment->comment_objecttype_id === '2'): ?> | ||
<?= $this->img('img/icons/service.png', array('title' => 'Service comment')) ?> | ||
<?php endif; ?> | ||
<small> | ||
<?php | ||
switch ($comment->comment_type) { | ||
case 'flapping': | ||
$icon = 'flapping'; | ||
$tooltip = 'Comment was caused by a flapping host or service.'; | ||
break; | ||
case 'comment': | ||
$icon = 'user'; | ||
$tooltip = 'Comment was created by an user.'; | ||
break; | ||
case 'downtime': | ||
$icon = 'down'; | ||
$tooltip = 'Comment was caused by a downtime.'; | ||
case 'ack': | ||
$icon = 'acknowledgement'; | ||
$tooltip = 'Comment was caused by an acknowledgement.'; | ||
} | ||
?> | ||
<?= $this->img('img/icons/' . $icon . '.png', array('title' => $tooltip)) ?> | ||
</small> | ||
</td> | ||
|
||
<td> | ||
<a class="hidden" href="<?= $detailLink; ?>"></a> | ||
|
||
<div rel="tooltip" title="Comment #<?=$comment->comment_id ?>"> | ||
For | ||
<?php if ($comment->service_name): ?> | ||
<a href="<?= $detailLink ?>"> | ||
<?= $comment->service_name ?> | ||
on | ||
<?= $comment->host_name; ?> | ||
</a> | ||
<?php else: ?> | ||
<a href="<?= $hostLink ?>"> | ||
<?= $comment->host_name; ?> | ||
</a> | ||
<?php endif; ?> | ||
by | ||
<?= $comment->comment_author; ?> | ||
<div class="small-row"> | ||
<?= $comment->comment_data; ?> | ||
</div> | ||
|
||
<small> | ||
<span> | ||
<b>Persists: </b><?= ($comment->comment_is_persistent === '1') ? 'Yes' : 'No'; ?> | ||
</span> | ||
<span> | ||
<b>Expires: </b> <?= | ||
($comment->comment_expiration_timestamp) ? | ||
'at ' . date('d.m H:i', $comment->comment_expiration_timestamp) : | ||
'Never'; | ||
?> | ||
</span> | ||
</small> | ||
|
||
</td> | ||
<td> | ||
<?php | ||
$data = array( | ||
'commentid' => $comment->comment_id, | ||
'host' => $comment->host_name | ||
); | ||
|
||
if ($objectType === 'service') { | ||
$data['service'] = $comment->service_name; | ||
} | ||
|
||
echo $commandHelper->iconSubmitForm( | ||
'icinga-icon-remove', | ||
'Remove comment', | ||
'btn-small', | ||
'removecomment', | ||
$data | ||
); | ||
?> | ||
</td> | ||
</div> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> | ||
</td> | ||
</div> | ||
</tr> | ||
<?php endforeach; ?> | ||
</tbody> | ||
</table> | ||
|
||
<div class="container pull-left"> | ||
<?= $this->paginationControl($comments, null, null, array('preserve' => $this->preserve)); ?> | ||
</div> | ||
</div> |
Oops, something went wrong.