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\Url;
|
||||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
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
|
* Display detailed information about a downtime
|
||||||
*/
|
*/
|
||||||
class Monitoring_DowntimeController extends Controller
|
class Monitoring_DowntimeController extends Controller
|
||||||
{
|
{
|
||||||
protected $downtime;
|
|
||||||
|
|
||||||
protected $isService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add tabs
|
* The fetched downtime
|
||||||
|
*
|
||||||
|
* @var stdClass
|
||||||
|
*/
|
||||||
|
protected $downtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the downtime is a service or not
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $isService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the downtime matching the given id and add tabs
|
||||||
|
*
|
||||||
|
* @throws Zend_Controller_Action_Exception
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
@ -63,7 +69,7 @@ class Monitoring_DowntimeController extends Controller
|
||||||
} else {
|
} else {
|
||||||
$this->isService = false;
|
$this->isService = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getTabs()
|
$this->getTabs()
|
||||||
->add(
|
->add(
|
||||||
'downtime',
|
'downtime',
|
||||||
|
@ -77,7 +83,10 @@ class Monitoring_DowntimeController extends Controller
|
||||||
)
|
)
|
||||||
)->activate('downtime')->extend(new DashboardAction());
|
)->activate('downtime')->extend(new DashboardAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the detail view for a downtime
|
||||||
|
*/
|
||||||
public function showAction()
|
public function showAction()
|
||||||
{
|
{
|
||||||
$this->view->downtime = $this->downtime;
|
$this->view->downtime = $this->downtime;
|
||||||
|
@ -95,7 +104,21 @@ class Monitoring_DowntimeController extends Controller
|
||||||
$this->view->delDowntimeForm = $this->createDelDowntimeForm();
|
$this->view->delDowntimeForm = $this->createDelDowntimeForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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()
|
private function createDelDowntimeForm()
|
||||||
{
|
{
|
||||||
$this->assertPermission('monitoring/command/downtime/delete');
|
$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\Object\Host;
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm;
|
||||||
use Icinga\Web\Url;
|
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
|
* Display detailed information about a downtime
|
||||||
*/
|
*/
|
||||||
class Monitoring_DowntimesController extends Controller
|
class Monitoring_DowntimesController extends Controller
|
||||||
{
|
{
|
||||||
protected $downtimes;
|
|
||||||
|
|
||||||
protected $filter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add tabs
|
* The fetched downtimes
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $downtimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A filter matching all current downtimes
|
||||||
|
*
|
||||||
|
* @var Filter
|
||||||
|
*/
|
||||||
|
protected $filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch all downtimes matching the current filter and add tabs
|
||||||
|
*
|
||||||
|
* @throws Zend_Controller_Action_Exception
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->filter = Filter::fromQueryString(str_replace(
|
$this->filter = Filter::fromQueryString(str_replace(
|
||||||
'downtime_id',
|
'downtime_id',
|
||||||
'downtime_internal_id',
|
'downtime_internal_id',
|
||||||
(string)$this->params
|
(string)$this->params
|
||||||
));
|
));
|
||||||
$this->downtimes = $this->backend->select()->from('downtime', array(
|
$this->downtimes = $this->backend->select()->from('downtime', array(
|
||||||
'id' => 'downtime_internal_id',
|
'id' => 'downtime_internal_id',
|
||||||
|
@ -58,24 +62,24 @@ class Monitoring_DowntimesController extends Controller
|
||||||
'host_display_name',
|
'host_display_name',
|
||||||
'service_display_name'
|
'service_display_name'
|
||||||
))->addFilter($this->filter)->getQuery()->fetchAll();
|
))->addFilter($this->filter)->getQuery()->fetchAll();
|
||||||
|
|
||||||
if (false === $this->downtimes) {
|
if (false === $this->downtimes) {
|
||||||
throw new Zend_Controller_Action_Exception(
|
throw new Zend_Controller_Action_Exception(
|
||||||
$this->translate('Downtime not found')
|
$this->translate('Downtime not found')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getTabs()
|
$this->getTabs()->add(
|
||||||
->add(
|
'downtimes',
|
||||||
'downtimes',
|
array(
|
||||||
array(
|
'title' => $this->translate(
|
||||||
'title' => $this->translate(
|
'Display detailed information about multiple downtimes.'
|
||||||
'Display detailed information about multiple downtimes.'
|
),
|
||||||
),
|
'icon' => 'plug',
|
||||||
'icon' => 'plug',
|
'label' => $this->translate('Downtimes'),
|
||||||
'label' => $this->translate('Downtimes'),
|
'url' =>'monitoring/downtimes/show'
|
||||||
'url' =>'monitoring/downtimes/show'
|
)
|
||||||
)
|
)->activate('downtimes');
|
||||||
)->activate('downtimes')->extend(new DashboardAction());
|
|
||||||
|
|
||||||
foreach ($this->downtimes as $downtime) {
|
foreach ($this->downtimes as $downtime) {
|
||||||
if (isset($downtime->service_description)) {
|
if (isset($downtime->service_description)) {
|
||||||
|
@ -91,7 +95,10 @@ class Monitoring_DowntimesController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the detail view for a downtime list
|
||||||
|
*/
|
||||||
public function showAction()
|
public function showAction()
|
||||||
{
|
{
|
||||||
$this->view->downtimes = $this->downtimes;
|
$this->view->downtimes = $this->downtimes;
|
||||||
|
@ -100,7 +107,10 @@ class Monitoring_DowntimesController extends Controller
|
||||||
$this->view->removeAllLink = Url::fromPath('monitoring/downtimes/remove-all')
|
$this->view->removeAllLink = Url::fromPath('monitoring/downtimes/remove-all')
|
||||||
->setParams($this->params);
|
->setParams($this->params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the form for removing a downtime list
|
||||||
|
*/
|
||||||
public function removeAllAction()
|
public function removeAllAction()
|
||||||
{
|
{
|
||||||
$this->assertPermission('monitoring/command/downtime/delete');
|
$this->assertPermission('monitoring/command/downtime/delete');
|
||||||
|
|
|
@ -84,7 +84,7 @@ class DeleteDowntimeCommandForm extends CommandForm
|
||||||
$delDowntime = new DeleteDowntimeCommand();
|
$delDowntime = new DeleteDowntimeCommand();
|
||||||
$delDowntime->setDowntimeId($id);
|
$delDowntime->setDowntimeId($id);
|
||||||
$delDowntime->setDowntimeType(
|
$delDowntime->setDowntimeType(
|
||||||
isset($firstDowntime->service_description) ?
|
isset($firstDowntime->service_description) ?
|
||||||
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
|
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
|
||||||
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
|
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,6 +12,11 @@ use Icinga\Web\Notification;
|
||||||
*/
|
*/
|
||||||
class DeleteDowntimesCommandForm extends CommandForm
|
class DeleteDowntimesCommandForm extends CommandForm
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The downtimes to delete on success
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $downtimes;
|
protected $downtimes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,12 +36,12 @@ class DeleteDowntimesCommandForm extends CommandForm
|
||||||
{
|
{
|
||||||
$this->addElements(array(
|
$this->addElements(array(
|
||||||
array(
|
array(
|
||||||
'hidden',
|
'hidden',
|
||||||
'redirect',
|
'redirect',
|
||||||
array(
|
array(
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
));
|
));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +65,7 @@ class DeleteDowntimesCommandForm extends CommandForm
|
||||||
$delDowntime = new DeleteDowntimeCommand();
|
$delDowntime = new DeleteDowntimeCommand();
|
||||||
$delDowntime->setDowntimeId($downtime->id);
|
$delDowntime->setDowntimeId($downtime->id);
|
||||||
$delDowntime->setDowntimeType(
|
$delDowntime->setDowntimeType(
|
||||||
isset($downtime->service_description) ?
|
isset($downtime->service_description) ?
|
||||||
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
|
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
|
||||||
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
|
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
|
||||||
);
|
);
|
||||||
|
@ -76,9 +81,9 @@ class DeleteDowntimesCommandForm extends CommandForm
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the downtimes to be deleted upon success
|
* Set the downtimes to be deleted upon success
|
||||||
*
|
*
|
||||||
* @param type $downtimes
|
* @param type $downtimes
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setDowntimes($downtimes)
|
public function setDowntimes($downtimes)
|
||||||
|
|
|
@ -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>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<?php if (! $this->compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
|
<div class="dontprint">
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="tinystatesummary">
|
||||||
|
<?= $comments->getTotalItemCount() ?> <?= $this->translate('Comments') ?>:
|
||||||
|
</div>
|
||||||
<?= $this->sortBox; ?>
|
<?= $this->sortBox; ?>
|
||||||
<?= $this->limiter; ?>
|
<?= $this->limiter; ?>
|
||||||
<?= $this->paginator; ?>
|
<?= $this->paginator; ?>
|
||||||
|
@ -15,57 +21,50 @@ if (count($comments) === 0) {
|
||||||
return;
|
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>
|
<tbody>
|
||||||
<?php foreach ($comments as $comment): ?>
|
<?php foreach ($comments as $comment):
|
||||||
<?php
|
$this->comment = $comment; ?>
|
||||||
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;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr class="state invalid">
|
<tr class="state invalid">
|
||||||
<td class="state" style="width: 12em;">
|
<td class="state" style="width: 12em;">
|
||||||
<?= $this->icon($icon, $tooltip) ?>
|
<?= $this->render('partials/comment/comment-description.phtml'); ?>
|
||||||
<br>
|
|
||||||
<strong><?= $this->escape($title); ?></strong>
|
|
||||||
<br>
|
|
||||||
<?= $this->prefixedTimeSince($comment->timestamp); ?>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($comment->objecttype === 'service'): ?>
|
<?php if ($comment->objecttype === 'service'): ?>
|
||||||
<?= $this->icon('service', $this->translate('Service')); ?>
|
<?= $this->icon('service', $this->translate('Service')); ?>
|
||||||
<?= $this->link()->service(
|
|
||||||
$comment->service_description,
|
<?= $this->qlink(
|
||||||
$comment->service_display_name,
|
sprintf(
|
||||||
$comment->host_name,
|
$this->translate('%s on %s', 'Service running on host'),
|
||||||
$comment->host_display_name
|
$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: ?>
|
<?php else: ?>
|
||||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
<?= $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 ?>
|
<?php endif ?>
|
||||||
<br>
|
<br>
|
||||||
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
<?= $this->icon('comment', $this->translate('Comment')); ?> <?= isset($comment->author)
|
||||||
? '[' . $comment->author . '] '
|
? '[' . $this->escape($comment->author) . '] '
|
||||||
: '';
|
: '';
|
||||||
?><?= $this->escape($comment->comment); ?>
|
?><?= $this->escape($comment->comment); ?>
|
||||||
<br>
|
<br>
|
||||||
|
@ -85,16 +84,7 @@ if (count($comments) === 0) {
|
||||||
<?php
|
<?php
|
||||||
$delCommentForm = clone $delCommentForm;
|
$delCommentForm = clone $delCommentForm;
|
||||||
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
$delCommentForm->populate(array('comment_id' => $comment->id, 'redirect' => $this->url));
|
||||||
if ($comment->objecttype === 'host') {
|
$delCommentForm->setAction($this->url('monitoring/comment/remove', array('comment_id' => $comment->id)));
|
||||||
$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
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
echo $delCommentForm;
|
echo $delCommentForm;
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -5,6 +5,12 @@ use Icinga\Module\Monitoring\Object\Service;
|
||||||
if (! $this->compact): ?>
|
if (! $this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
|
<div class="dontprint">
|
||||||
|
<?= $this->render('list/components/selectioninfo.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="tinystatesummary">
|
||||||
|
<?= $downtimes->getTotalItemCount() ?> <?= $this->translate('Downtimes') ?>
|
||||||
|
</div>
|
||||||
<?= $this->sortBox; ?>
|
<?= $this->sortBox; ?>
|
||||||
<?= $this->limiter; ?>
|
<?= $this->limiter; ?>
|
||||||
<?= $this->paginator; ?>
|
<?= $this->paginator; ?>
|
||||||
|
@ -123,14 +129,7 @@ if (count($downtimes) === 0) {
|
||||||
<?php
|
<?php
|
||||||
$delDowntimeForm = clone $delDowntimeForm;
|
$delDowntimeForm = clone $delDowntimeForm;
|
||||||
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
|
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->url));
|
||||||
if (! $isService) {
|
$delDowntimeForm->setAction($this->url('monitoring/downtime/remove', array('downtime_id' => $downtime->id)));
|
||||||
$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
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
echo $delDowntimeForm;
|
echo $delDowntimeForm;
|
||||||
?>
|
?>
|
||||||
</td>
|
</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 data = self.icinga.ui.getSelectionKeys($table);
|
||||||
var url = $table.data('icinga-multiselect-url');
|
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.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue