icingaweb2/modules/monitoring/application/views/scripts/services/show.phtml

210 lines
6.4 KiB
PHTML

<?php
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
?>
<div class="controls">
<?php if (! $this->compact): ?>
<?= $tabs; ?>
<?php endif ?>
<?= $this->render('partials/service/objects-tinysummary.phtml') ?>
<?= $this->render('partials/service/objects-header.phtml'); ?>
</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: ?>
<?= sprintf(t('Issue commands on all %d selected services:'), count($objects)) ?>
<p>
<div>
<?= $checkNowForm; ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Reschedule the next check'),
$rescheduleAllLink,
null,
array('icon' => 'reschedule')
); ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Schedule a downtime'),
$downtimeAllLink,
null,
array('icon' => 'plug')
); ?>
</div>
<div>
<?= $this->qlink(
$this->translate('Submit a passive check result'),
$processCheckResultAllLink,
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): ?>
<div>
<h3>
<?= $this->icon('attention-alt') ?>
<?= $this->translatePlural(
'Unhandled Problem',
'Unhandled Problems',
$unhandledCount
) ?>
</h3>
<p><?= sprintf(t('There are %s unhandled problems. ' .
'Issue commands to the problematic services.'),
'<span class="badge badge-critical">' . $unhandledCount . '</span>') ?>
<div>
<?= $this->qlink(
sprintf(
$this->translatePlural(
'Schedule a downtime for %u unhandled service problem',
'Schedule a downtime for %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$downtimeUnhandledLink,
null,
array('icon' => 'plug')
); ?>
</div>
<div><?= $this->qlink(
sprintf(
$this->translatePlural(
'Acknowledge %u unhandled service problem',
'Acknowledge %u unhandled service problems',
$unhandledCount
),
$unhandledCount
),
$acknowledgeUnhandledLink,
null,
array('icon' => 'ok')
); ?></div>
</p>
</div>
<?php endif ?>
<?php if (($acknowledgedCount = count($acknowledgedObjects)) > 0): ?>
<h3><?= $this->icon('ok', $this->translate('Acknowledgements')) ?> <?= $this->translate('Acknowledgements') ?></h3>
<p>
<?= sprintf(
$this->translatePlural(
'%u Acknowledged Service Problem.',
'%u Acknowledged Service Problems.',
$acknowledgedCount
),
$acknowledgedCount
); ?> <?= $removeAckForm ?>
</p>
<?php endif ?>
<?php if (($inDowntimeCount = count($objectsInDowntime)) > 0 /*&& $auth->hasPermission('monitoring/command/comment/delete')*/): ?>
<h3> <?= $this->icon('plug', $this->translate('Downtimes')) ?> <?= $this->translate('Downtimes') ?> </h3>
<p> <?= sprintf($this->translatePlural(
'%u service currently in downtime.',
'%u services currently in downtime.',
$inDowntimeCount
), $inDowntimeCount) ?>
<?= $this->qlink(
$this->translate('List all'),
$inDowntimeLink,
null
);?>
</p>
<?php endif ?>
<?php $commentCount = count($objects->getComments()) ?>
<?php if ($commentCount > 0): ?>
<h3> <?= $this->icon('comment') ?> <?= t('Comments') ?> </h3>
<p><?= sprintf(
$this->translatePlural(
'There is %d comment.',
'There are %d comments.',
$commentCount
), $commentCount);
?>
<?= $this->qlink(
$this->translate('List all'),
$commentsLink,
null
); ?>
<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('Remove all'),
$deleteCommentLink,
null,
array('icon' => 'trash')
); ?></div>
</p>
-->
<?php endif ?>
<?php endif ?>
</div>