parent
860cc59155
commit
ef16ba5f48
|
@ -10,7 +10,8 @@ use Icinga\Module\Monitoring\Forms\Command\Object\ProcessCheckResultCommandForm;
|
|||
use Icinga\Module\Monitoring\Forms\Command\Object\RemoveAcknowledgementCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceDowntimeCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\AddCommentCommandForm;
|
||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
use Icinga\Module\Monitoring\Object\ServiceList;
|
||||
|
@ -58,7 +59,8 @@ class Monitoring_ServicesController extends Controller
|
|||
'service_is_flapping',
|
||||
'service_notifications_enabled',
|
||||
'service_output',
|
||||
'service_last_ack'
|
||||
'service_last_ack',
|
||||
'service_last_comment'
|
||||
));
|
||||
|
||||
$form
|
||||
|
@ -200,18 +202,23 @@ class Monitoring_ServicesController extends Controller
|
|||
->handleRequest();
|
||||
$this->view->removeAckForm = $removeAckForm;
|
||||
}
|
||||
/*
|
||||
if (! empty($objectsInDowntime)) {
|
||||
$removeDowntimeForm = new DeleteDowntimeCommandForm();
|
||||
$removeDowntimeForm->setObjects($objectsInDowntime)
|
||||
$removeDowntimeForm
|
||||
->setObjects($objectsInDowntime)
|
||||
->handleRequest();
|
||||
$this->view->removeDowntimeForm = $removeDowntimeForm;
|
||||
}
|
||||
*/
|
||||
$this->setAutorefreshInterval(15);
|
||||
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
|
||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
|
||||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath(
|
||||
'monitoring/services/process-check-result'
|
||||
);
|
||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/services/add-comment');
|
||||
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/services/delete-comment');
|
||||
$this->view->hostStates = (object)$hostStates;
|
||||
$this->view->serviceStates = (object)$serviceStates;
|
||||
$this->view->objects = $this->serviceList;
|
||||
|
@ -250,6 +257,33 @@ class Monitoring_ServicesController extends Controller
|
|||
->setSparklineClass('sparkline-multi');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a service comment
|
||||
*/
|
||||
public function addCommentAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/add');
|
||||
|
||||
$form = new AddCommentCommandForm();
|
||||
$form->setTitle($this->translate('Add Service Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a comment
|
||||
*/
|
||||
public function deleteCommentAction()
|
||||
{
|
||||
$this->assertPermission('monitoring/command/comment/delete');
|
||||
|
||||
$form = new DeleteCommentCommandForm();
|
||||
$form->setTitle($this->translate('Delete Service Comments'));
|
||||
$this->handleCommandForm($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acknowledge service problems
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,11 @@ use Icinga\Web\Url;
|
|||
|
||||
</div>
|
||||
<div class="content">
|
||||
<h3>
|
||||
<?= $this->icon('reschedule') ?>
|
||||
<?= $this->translate('Commands') ?>
|
||||
</h3>
|
||||
|
||||
<?php if (($serviceCount = count($objects)) === 0): ?>
|
||||
<?= $this->translate('No services matching the filter'); ?>
|
||||
<?php else: ?>
|
||||
|
@ -41,6 +46,12 @@ use Icinga\Web\Url;
|
|||
null,
|
||||
array('icon' => 'reply')
|
||||
); ?></div>
|
||||
<div><?= $this->qlink(
|
||||
$this->translate('Add a comment'),
|
||||
$addCommentLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></div>
|
||||
</p>
|
||||
|
||||
<?php if (($unhandledCount = count($unhandledObjects)) > 0): ?>
|
||||
|
@ -127,10 +138,6 @@ use Icinga\Web\Url;
|
|||
array('icon' => 'plug')
|
||||
);?>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?= $removeDowntimeForm ?> Delete All
|
||||
</div>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
|
||||
|
@ -145,44 +152,60 @@ use Icinga\Web\Url;
|
|||
$commentCount
|
||||
), $commentCount);
|
||||
?>
|
||||
<p>
|
||||
<table>
|
||||
<?php foreach ($objects as $service): ?>
|
||||
<?php $service->fetchComments(); ?>
|
||||
<?php foreach ($service->comments as $comment): ?>
|
||||
<tr>
|
||||
<td style="vertical-align: top;" data-base-target="_self">
|
||||
<?php
|
||||
$delCommentForm = new DeleteCommentCommandForm();
|
||||
$delCommentForm->populate(
|
||||
array('comment_id' => $comment->id, 'redirect' => html_entity_decode($this->url))
|
||||
);
|
||||
$delCommentForm->setAction(
|
||||
$this->url(
|
||||
'monitoring/service/delete-comment',
|
||||
array('host' => $service->getHost()->getName(), 'service' => $service->getName())
|
||||
)
|
||||
);
|
||||
echo $delCommentForm;
|
||||
?>
|
||||
(<?= ucfirst($comment->type) ?>):
|
||||
</td>
|
||||
<td style="padding-left: .5em;">
|
||||
<?= nl2br($comment->comment) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<?= $this->qlink(
|
||||
$this->translate('List all'),
|
||||
$commentsLink,
|
||||
null,
|
||||
array('icon' => 'comment')
|
||||
); ?></p>
|
||||
); ?>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<?php foreach ($objects as $service): ?>
|
||||
<?php $service->fetchComments(); ?>
|
||||
<!--
|
||||
TODO: implement backend functionality.
|
||||
|
||||
<div><?= $this->qlink(
|
||||
$this->translate('Remove all'),
|
||||
$deleteCommentLink,
|
||||
null,
|
||||
array('icon' => 'trash')
|
||||
); ?></div>
|
||||
</p>
|
||||
-->
|
||||
|
||||
<?php foreach ($service->comments as $comment): ?>
|
||||
<tr >
|
||||
<td style="vertical-align: top;" data-base-target="_self">
|
||||
<?php
|
||||
$delCommentForm = new DeleteCommentCommandForm();
|
||||
$delCommentForm->populate(
|
||||
array('comment_id' => $comment->id, 'redirect' => html_entity_decode($this->url))
|
||||
);
|
||||
$delCommentForm->setAction(
|
||||
$this->url(
|
||||
'monitoring/service/delete-comment',
|
||||
array('host' => $service->getHost()->getName(), 'service' => $service->getName())
|
||||
)
|
||||
);
|
||||
echo $delCommentForm;
|
||||
?>
|
||||
(<?= ucfirst($comment->type) ?>):
|
||||
</td>
|
||||
<td style="padding-left: .5em;">
|
||||
<?= nl2br($comment->comment) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<?php endif ?>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue