commit
f2d89aee74
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
||||
/**
|
||||
* Display detailed information about a comment
|
||||
*/
|
||||
class Monitoring_CommentController extends Controller
|
||||
{
|
||||
/**
|
||||
* The fetched comment
|
||||
*
|
||||
* @var stdClass
|
||||
*/
|
||||
protected $comment;
|
||||
|
||||
/**
|
||||
* Fetch the first comment with the given id and add tabs
|
||||
*
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$commentId = $this->params->get('comment_id');
|
||||
|
||||
$this->comment = $this->backend->select()->from('comment', array(
|
||||
'id' => 'comment_internal_id',
|
||||
'objecttype' => 'comment_objecttype',
|
||||
'comment' => 'comment_data',
|
||||
'author' => 'comment_author_name',
|
||||
'timestamp' => 'comment_timestamp',
|
||||
'type' => 'comment_type',
|
||||
'persistent' => 'comment_is_persistent',
|
||||
'expiration' => 'comment_expiration',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
))->where('comment_internal_id', $commentId)->getQuery()->fetchRow();
|
||||
|
||||
if (false === $this->comment) {
|
||||
throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
|
||||
}
|
||||
|
||||
$this->getTabs()->add(
|
||||
'comment',
|
||||
array(
|
||||
'title' => $this->translate(
|
||||
'Display detailed information about a comment.'
|
||||
),
|
||||
'icon' => 'comment',
|
||||
'label' => $this->translate('Comment'),
|
||||
'url' =>'monitoring/comments/show'
|
||||
)
|
||||
)->activate('comment')->extend(new DashboardAction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display comment detail view
|
||||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->comment = $this->comment;
|
||||
if ($this->hasPermission('monitoring/command/comment/delete')) {
|
||||
$this->view->delCommentForm = $this->createDelCommentForm();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive DeleteCommentCommandForm post from other controller
|
||||
*/
|
||||
public function removeAction()
|
||||
{
|
||||
$this->assertHttpMethod('POST');
|
||||
$this->createDelCommentForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a command form to delete a single comment
|
||||
*
|
||||
* @return DeleteCommentCommandForm
|
||||
*/
|
||||
private function createDelCommentForm()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/delete');
|
||||
|
||||
$delCommentForm = new DeleteCommentCommandForm();
|
||||
$delCommentForm->setAction(
|
||||
Url::fromPath('monitoring/comment/show')
|
||||
->setParam('comment_id', $this->comment->id)
|
||||
);
|
||||
$delCommentForm->populate(
|
||||
array(
|
||||
'redirect' => Url::fromPath('monitoring/list/comments'),
|
||||
'comment_id' => $this->comment->id
|
||||
)
|
||||
);
|
||||
$delCommentForm->handleRequest();
|
||||
return $delCommentForm;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||
|
||||
use Icinga\Module\Monitoring\Controller;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
|
||||
/**
|
||||
* Display detailed information about a comment
|
||||
*/
|
||||
class Monitoring_CommentsController extends Controller
|
||||
{
|
||||
/**
|
||||
* The fetched comments
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $comments;
|
||||
|
||||
/**
|
||||
* Fetch all comments matching the current filter and add tabs
|
||||
*
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->filter = Filter::fromQueryString(str_replace(
|
||||
'comment_id',
|
||||
'comment_internal_id',
|
||||
(string)$this->params
|
||||
));
|
||||
$this->comments = $this->backend->select()->from('comment', array(
|
||||
'id' => 'comment_internal_id',
|
||||
'objecttype' => 'comment_objecttype',
|
||||
'comment' => 'comment_data',
|
||||
'author' => 'comment_author_name',
|
||||
'timestamp' => 'comment_timestamp',
|
||||
'type' => 'comment_type',
|
||||
'persistent' => 'comment_is_persistent',
|
||||
'expiration' => 'comment_expiration',
|
||||
'host_name',
|
||||
'service_description',
|
||||
'host_display_name',
|
||||
'service_display_name'
|
||||
))->addFilter($this->filter)->getQuery()->fetchAll();
|
||||
|
||||
if (false === $this->comments) {
|
||||
throw new Zend_Controller_Action_Exception($this->translate('Comment not found'));
|
||||
}
|
||||
|
||||
$this->getTabs()->add(
|
||||
'comments',
|
||||
array(
|
||||
'title' => $this->translate(
|
||||
'Display detailed information about multiple comments.'
|
||||
),
|
||||
'icon' => 'comment',
|
||||
'label' => $this->translate('Comments'),
|
||||
'url' =>'monitoring/comments/show'
|
||||
)
|
||||
)->activate('comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the detail view for a comment list
|
||||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->comments = $this->comments;
|
||||
$this->view->listAllLink = Url::fromPath('monitoring/list/comments')
|
||||
->setQueryString($this->filter->toQueryString());
|
||||
$this->view->removeAllLink = Url::fromPath('monitoring/comments/remove-all')
|
||||
->setParams($this->params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form for removing a comment list
|
||||
*/
|
||||
public function removeAllAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/delete');
|
||||
$this->view->comments = $this->comments;
|
||||
$this->view->listAllLink = Url::fromPath('monitoring/list/comments')
|
||||
->setQueryString($this->filter->toQueryString());
|
||||
$delCommentForm = new DeleteCommentCommandForm();
|
||||
$delCommentForm->setTitle($this->view->translate('Remove all Comments'));
|
||||
$delCommentForm->addDescription(sprintf(
|
||||
$this->translate('Confirm removal of %d comments.'),
|
||||
count($this->comments)
|
||||
));
|
||||
$delCommentForm->setObjects($this->comments)
|
||||
->setRedirectUrl(Url::fromPath('monitoring/list/downtimes'))
|
||||
->handleRequest();
|
||||
$this->view->delCommentForm = $delCommentForm;
|
||||
}
|
||||
}
|
|
@ -8,23 +8,29 @@ use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
|
|||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display detailed information about a downtime
|
||||
*/
|
||||
class Monitoring_DowntimeController extends Controller
|
||||
{
|
||||
/**
|
||||
* The fetched downtime
|
||||
*
|
||||
* @var stdClass
|
||||
*/
|
||||
protected $downtime;
|
||||
|
||||
/**
|
||||
* If the downtime is a service or not
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $isService;
|
||||
|
||||
/**
|
||||
* Add tabs
|
||||
* Fetch the downtime matching the given id and add tabs
|
||||
*
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
|
@ -78,6 +84,9 @@ class Monitoring_DowntimeController extends Controller
|
|||
)->activate('downtime')->extend(new DashboardAction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the detail view for a downtime
|
||||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->downtime = $this->downtime;
|
||||
|
@ -96,6 +105,20 @@ class Monitoring_DowntimeController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive DeleteDowntimeCommandForm post from other controller
|
||||
*/
|
||||
public function removeAction()
|
||||
{
|
||||
$this->assertHttpMethod('POST');
|
||||
$this->createDelDowntimeForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a command form to delete a single comment
|
||||
*
|
||||
* @return DeleteDowntimeCommandForm
|
||||
*/
|
||||
private function createDelDowntimeForm()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/downtime/delete');
|
||||
|
|
|
@ -7,33 +7,37 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display detailed information about a downtime
|
||||
*/
|
||||
class Monitoring_DowntimesController extends Controller
|
||||
{
|
||||
/**
|
||||
* The fetched downtimes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $downtimes;
|
||||
|
||||
/**
|
||||
* A filter matching all current downtimes
|
||||
*
|
||||
* @var Filter
|
||||
*/
|
||||
protected $filter;
|
||||
|
||||
/**
|
||||
* Add tabs
|
||||
* Fetch all downtimes matching the current filter and add tabs
|
||||
*
|
||||
* @throws Zend_Controller_Action_Exception
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->filter = Filter::fromQueryString(str_replace(
|
||||
'downtime_id',
|
||||
'downtime_internal_id',
|
||||
(string)$this->params
|
||||
'downtime_id',
|
||||
'downtime_internal_id',
|
||||
(string)$this->params
|
||||
));
|
||||
$this->downtimes = $this->backend->select()->from('downtime', array(
|
||||
'id' => 'downtime_internal_id',
|
||||
|
@ -58,24 +62,24 @@ class Monitoring_DowntimesController extends Controller
|
|||
'host_display_name',
|
||||
'service_display_name'
|
||||
))->addFilter($this->filter)->getQuery()->fetchAll();
|
||||
|
||||
if (false === $this->downtimes) {
|
||||
throw new Zend_Controller_Action_Exception(
|
||||
$this->translate('Downtime not found')
|
||||
$this->translate('Downtime not found')
|
||||
);
|
||||
}
|
||||
|
||||
$this->getTabs()
|
||||
->add(
|
||||
'downtimes',
|
||||
array(
|
||||
'title' => $this->translate(
|
||||
'Display detailed information about multiple downtimes.'
|
||||
),
|
||||
'icon' => 'plug',
|
||||
'label' => $this->translate('Downtimes'),
|
||||
'url' =>'monitoring/downtimes/show'
|
||||
)
|
||||
)->activate('downtimes')->extend(new DashboardAction());
|
||||
$this->getTabs()->add(
|
||||
'downtimes',
|
||||
array(
|
||||
'title' => $this->translate(
|
||||
'Display detailed information about multiple downtimes.'
|
||||
),
|
||||
'icon' => 'plug',
|
||||
'label' => $this->translate('Downtimes'),
|
||||
'url' =>'monitoring/downtimes/show'
|
||||
)
|
||||
)->activate('downtimes');
|
||||
|
||||
foreach ($this->downtimes as $downtime) {
|
||||
if (isset($downtime->service_description)) {
|
||||
|
@ -92,6 +96,9 @@ class Monitoring_DowntimesController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the detail view for a downtime list
|
||||
*/
|
||||
public function showAction()
|
||||
{
|
||||
$this->view->downtimes = $this->downtimes;
|
||||
|
@ -101,6 +108,9 @@ class Monitoring_DowntimesController extends Controller
|
|||
->setParams($this->params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the form for removing a downtime list
|
||||
*/
|
||||
public function removeAllAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/downtime/delete');
|
||||
|
|
|
@ -12,6 +12,11 @@ use Icinga\Web\Notification;
|
|||
*/
|
||||
class DeleteDowntimesCommandForm extends CommandForm
|
||||
{
|
||||
/**
|
||||
* The downtimes to delete on success
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $downtimes;
|
||||
|
||||
/**
|
||||
|
@ -31,12 +36,12 @@ class DeleteDowntimesCommandForm extends CommandForm
|
|||
{
|
||||
$this->addElements(array(
|
||||
array(
|
||||
'hidden',
|
||||
'redirect',
|
||||
array(
|
||||
'decorators' => array('ViewHelper')
|
||||
)
|
||||
'hidden',
|
||||
'redirect',
|
||||
array(
|
||||
'decorators' => array('ViewHelper')
|
||||
)
|
||||
)
|
||||
));
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<div class="controls">
|
||||
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $this->tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->render('partials/downtime/downtime-header.phtml'); ?>
|
||||
</div>
|
||||
<div class="content object-command">
|
||||
<?= $delDowntimeForm; ?>
|
||||
</div>
|
|
@ -0,0 +1,78 @@
|
|||
<div class="controls">
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $this->tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<div data-base-target='_next'>
|
||||
<?= $this->render('partials/comment/comment-header.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
<h3><?= $this->translate('Comment detail information') ?></h3>
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<tr data-base-target='_next'>
|
||||
<?php if ($this->comment->objecttype === 'service'): ?>
|
||||
<th> <?= $this->translate('Service') ?> </th>
|
||||
<td>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$this->comment->service_description,
|
||||
$this->comment->service_display_name,
|
||||
$this->comment->host_name,
|
||||
$this->comment->host_display_names
|
||||
); ?>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<th> <?= $this->translate('Host') ?> </th>
|
||||
<td>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host(
|
||||
$this->comment->host_name,
|
||||
$this->comment->host_display_name
|
||||
); ?>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?= $this->translate('Author') ?></th>
|
||||
<td><?= $this->icon('user', $this->translate('User')) ?> <?= $this->escape($this->comment->author) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?= $this->translate('Persistent') ?></th>
|
||||
<td><?= $this->escape($this->comment->persistent) ? $this->translate('Yes') : $this->translate('No') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?= $this->translate('Created') ?></th>
|
||||
<td><?= date('d.m.y H:i' ,$this->escape($this->comment->timestamp)) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th><?= $this->translate('Expires') ?></th>
|
||||
<td>
|
||||
<?= $this->comment->expiration ? sprintf(
|
||||
$this->translate('This comment expires on %s at %s.'),
|
||||
date('d.m.y', $this->comment->expiration),
|
||||
date('H:i', $this->comment->expiration)
|
||||
) : $this->translate('This comment does not expire.'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if (isset($delCommentForm)): // Form is unset if the current user lacks the respective permission ?>
|
||||
<tr class="newsection">
|
||||
<th><?= $this->translate('Commands') ?></th>
|
||||
<td>
|
||||
<?= $delCommentForm ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<div class="controls">
|
||||
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $this->tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->render('partials/comment/comments-header.phtml'); ?>
|
||||
</div>
|
||||
|
||||
<div class="content object-command">
|
||||
<?= $delCommentForm ?>
|
||||
</div>
|
|
@ -0,0 +1,34 @@
|
|||
<div class="controls">
|
||||
<?php if (! $this->compact): ?>
|
||||
<?= $this->tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<div data-base-target='_next'>
|
||||
<?= $this->render('partials/comment/comments-header.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<h3><?= $this->icon('reschedule') ?> <?= $this->translate('Commands') ?> </h3>
|
||||
<p>
|
||||
<?= sprintf(
|
||||
$this->translate('Issue commands to all %s selected comments.'),
|
||||
'<b>' . count($comments) . '</b>'
|
||||
)
|
||||
?>
|
||||
<div>
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translate('Remove all %d scheduled comments'),
|
||||
count($comments)
|
||||
),
|
||||
$removeAllLink,
|
||||
null,
|
||||
array(
|
||||
'icon' => 'trash',
|
||||
'title' => $this->translate('Remove all selected comments.')
|
||||
)
|
||||
) ?>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
|
@ -29,5 +29,5 @@
|
|||
)
|
||||
) ?>
|
||||
</div>
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?php if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
<div class="dontprint">
|
||||
<?= $this->render('list/components/selectioninfo.phtml'); ?>
|
||||
</div>
|
||||
<div class="tinystatesummary">
|
||||
<?= $comments->getTotalItemCount() ?> <?= $this->translate('Comments') ?>:
|
||||
</div>
|
||||
<?= $this->sortBox; ?>
|
||||
<?= $this->limiter; ?>
|
||||
<?= $this->paginator; ?>
|
||||
|
@ -15,57 +21,50 @@ if (count($comments) === 0) {
|
|||
return;
|
||||
}
|
||||
?>
|
||||
<table data-base-target="_next" class="action comments">
|
||||
<table data-base-target="_next"
|
||||
class="action comments multiselect"
|
||||
data-icinga-multiselect-url="/icingaweb2/monitoring/comments/show"
|
||||
data-icinga-multiselect-data="comment_id">
|
||||
<tbody>
|
||||
<?php foreach ($comments as $comment): ?>
|
||||
<?php
|
||||
switch ($comment->type) {
|
||||
case 'flapping':
|
||||
$icon = 'flapping';
|
||||
$title = $this->translate('Flapping');
|
||||
$tooltip = $this->translate('Comment was caused by a flapping host or service.');
|
||||
break;
|
||||
case 'comment':
|
||||
$icon = 'user';
|
||||
$title = $this->translate('User Comment');
|
||||
$tooltip = $this->translate('Comment was created by an user.');
|
||||
break;
|
||||
case 'downtime':
|
||||
$icon = 'plug';
|
||||
$title = $this->translate('Downtime');
|
||||
$tooltip = $this->translate('Comment was caused by a downtime.');
|
||||
break;
|
||||
case 'ack':
|
||||
$icon = 'ok';
|
||||
$title = $this->translate('Acknowledgement');
|
||||
$tooltip = $this->translate('Comment was caused by an acknowledgement.');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php foreach ($comments as $comment):
|
||||
$this->comment = $comment; ?>
|
||||
|
||||
<tr class="state invalid">
|
||||
<td class="state" style="width: 12em;">
|
||||
<?= $this->icon($icon, $tooltip) ?>
|
||||
<br>
|
||||
<strong><?= $this->escape($title); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($comment->timestamp); ?>
|
||||
<?= $this->render('partials/comment/comment-description.phtml'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($comment->objecttype === 'service'): ?>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$comment->service_description,
|
||||
$comment->service_display_name,
|
||||
$comment->host_name,
|
||||
$comment->host_display_name
|
||||
); ?>
|
||||
|
||||
<?= $this->qlink(
|
||||
sprintf(
|
||||
$this->translate('%s on %s', 'Service running on host'),
|
||||
$comment->service_display_name,
|
||||
$comment->host_display_name
|
||||
),
|
||||
'monitoring/comment/show',
|
||||
array('comment_id' => $comment->id),
|
||||
array('title' => sprintf(
|
||||
$this->translate('Show detailed information for comment on %s for %s'),
|
||||
$comment->service_display_name,
|
||||
$comment->host_display_name
|
||||
))) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host($comment->host_name, $comment->host_display_name); ?>
|
||||
|
||||
<?= $this->qlink(
|
||||
$comment->host_display_name,
|
||||
'monitoring/comment/show',
|
||||
array('comment_id' => $comment->id),
|
||||
array('title' => sprintf(
|
||||
$this->translate('Show detailed information for comment on %s'),
|
||||
$comment->host_display_name
|
||||
))) ?>
|
||||
<?php endif ?>
|
||||
<br>
|
||||
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
||||
? '[' . $comment->author . '] '
|
||||
? '[' . $this->escape($comment->author) . '] '
|
||||
: '';
|
||||
?><?= $this->escape($comment->comment); ?>
|
||||
<br>
|
||||
|
@ -85,16 +84,7 @@ if (count($comments) === 0) {
|
|||
<?php
|
||||
$delCommentForm = clone $delCommentForm;
|
||||
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
||||
if ($comment->objecttype === 'host') {
|
||||
$delCommentForm->setAction(
|
||||
$this->url('monitoring/host/delete-comment', array('host' => $comment->host_name))
|
||||
);
|
||||
} else {
|
||||
$delCommentForm->setAction($this->url('monitoring/service/delete-comment', array(
|
||||
'host' => $comment->host_name,
|
||||
'service' => $comment->service_description
|
||||
)));
|
||||
}
|
||||
$delCommentForm->setAction($this->url('monitoring/comment/remove', array('comment_id' => $comment->id)));
|
||||
echo $delCommentForm;
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -5,6 +5,12 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
<div class="dontprint">
|
||||
<?= $this->render('list/components/selectioninfo.phtml'); ?>
|
||||
</div>
|
||||
<div class="tinystatesummary">
|
||||
<?= $downtimes->getTotalItemCount() ?> <?= $this->translate('Downtimes') ?>
|
||||
</div>
|
||||
<?= $this->sortBox; ?>
|
||||
<?= $this->limiter; ?>
|
||||
<?= $this->paginator; ?>
|
||||
|
@ -123,14 +129,7 @@ if (count($downtimes) === 0) {
|
|||
<?php
|
||||
$delDowntimeForm = clone $delDowntimeForm;
|
||||
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
|
||||
if (! $isService) {
|
||||
$delDowntimeForm->setAction($this->url('monitoring/host/delete-downtime', array('host' => $downtime->host_name)));
|
||||
} else {
|
||||
$delDowntimeForm->setAction($this->url('monitoring/service/delete-downtime', array(
|
||||
'host' => $downtime->host_name,
|
||||
'service' => $downtime->service_description
|
||||
)));
|
||||
}
|
||||
$delDowntimeForm->setAction($this->url('monitoring/downtime/remove', array('downtime_id' => $downtime->id)));
|
||||
echo $delDowntimeForm;
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
switch ($comment->type) {
|
||||
case 'flapping':
|
||||
$icon = 'flapping';
|
||||
$title = $this->translate('Flapping');
|
||||
$tooltip = $this->translate('Comment was caused by a flapping host or service.');
|
||||
break;
|
||||
case 'comment':
|
||||
$icon = 'user';
|
||||
$title = $this->translate('User Comment');
|
||||
$tooltip = $this->translate('Comment was created by an user.');
|
||||
break;
|
||||
case 'downtime':
|
||||
$icon = 'plug';
|
||||
$title = $this->translate('Downtime');
|
||||
$tooltip = $this->translate('Comment was caused by a downtime.');
|
||||
break;
|
||||
case 'ack':
|
||||
$icon = 'ok';
|
||||
$title = $this->translate('Acknowledgement');
|
||||
$tooltip = $this->translate('Comment was caused by an acknowledgement.');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<strong><?= $this->escape($title); ?></strong><br>
|
||||
<?= $this->icon($icon, $tooltip) ?>
|
||||
<?= $this->prefixedTimeSince($comment->timestamp); ?>
|
|
@ -0,0 +1,18 @@
|
|||
<?php if ($comment->objecttype === 'service'): ?>
|
||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||
<?= $this->link()->service(
|
||||
$comment->service_description,
|
||||
$comment->service_display_name,
|
||||
$comment->host_name,
|
||||
$comment->host_display_name
|
||||
); ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
<?= $this->link()->host($comment->host_name, $comment->host_display_name); ?>
|
||||
<?php endif ?>
|
||||
|
||||
<br>
|
||||
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
||||
? '[' . $this->escape($comment->author) . '] '
|
||||
: '';
|
||||
?><?= $this->escape($comment->comment); ?>
|
|
@ -0,0 +1,10 @@
|
|||
<table class="action">
|
||||
<tr class="state invalid">
|
||||
<td class="state" style="width: 12em;">
|
||||
<?= $this->render('partials/comment/comment-description.phtml'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $this->render('partials/comment/comment-detail.phtml'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -0,0 +1,30 @@
|
|||
<table class="action">
|
||||
<?php $i = 0; foreach ($comments as $comment):
|
||||
if (++ $i > 5) {
|
||||
continue;
|
||||
}
|
||||
$this->comment = $comment;
|
||||
?>
|
||||
|
||||
<tr class="state invalid">
|
||||
<td class="state" style="width: 12em;">
|
||||
<?= $this->render('partials/comment/comment-description.phtml'); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $this->render('partials/comment/comment-detail.phtml'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('List all %d comments …'), count($comments)),
|
||||
$listAllLink,
|
||||
null,
|
||||
array(
|
||||
'title' => $this->translate('List all'),
|
||||
'data-base-target' => "_next"
|
||||
)
|
||||
) ?>
|
||||
</p>
|
|
@ -303,6 +303,10 @@
|
|||
var data = self.icinga.ui.getSelectionKeys($table);
|
||||
var url = $table.data('icinga-multiselect-url');
|
||||
|
||||
if ($(event.target).closest('form').length) {
|
||||
// allow form actions in table rows to pass through
|
||||
return;
|
||||
}
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
|
|
Loading…
Reference in New Issue