icingaweb2/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml

98 lines
3.9 KiB
PHTML

<?php
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
if (in_array((int) $object->state, array(0, 99))) {
// Ignore this markup if the object is in a non-problem state or pending
return;
}
if ($object->acknowledged): ?>
<?php
$acknowledgement = $object->acknowledgement;
/** @var \Icinga\Module\Monitoring\Object\Acknowledgement $acknowledgement */
?>
<tr>
<th><?= $this->translate('Acknowledged') ?></th>
<td data-base-target="_self">
<ul class="inline-comments">
<li class="comment-item">
<h3>
<?= sprintf(
$this->translate('%s acknowledged %s'),
'<span class="author">' . $this->escape($acknowledgement->getAuthor()) . '</span>',
$this->timeAgo($acknowledgement->getEntryTime())
) ?>
<?php
if ($acknowledgement->getSticky()) {
echo $this->icon('pin', sprintf(
$this->translate(
'Acknowledgement remains until the %1$s recovers even if the %1$s changes state'
),
$object->getType(true)
));
}
if (isset($removeAckForm)) {
// Form is unset if the current user lacks the respective permission
// Form is unset if the current user lacks the respective permission
echo $removeAckForm;
}
?>
</h3>
<p>
<span class="sr-only">(<?= $this->translate('Comment') ?>): </span>
<?= nl2br($this->createTicketLinks($acknowledgement->getComment()), false) ?>
</p>
<?php if ($acknowledgement->expires()): ?>
<p class="info">
<?= sprintf(
$this->translate('Expires %s'),
$this->timeUntil($acknowledgement->getExpirationTime())
) ?>
</p>
<?php endif ?>
</li>
</ul>
</td>
</tr>
<?php else: ?>
<tr>
<th><?= $this->translate('Not acknowledged') ?></th>
<td>
<?php if ($this->hasPermission('monitoring/command/acknowledge-problem')) {
if ($object->getType() === $object::TYPE_HOST) {
$ackLink = $this->href(
'monitoring/host/acknowledge-problem',
array('host' => $object->getName()),
null,
array('class' => 'action-link')
);
} else {
$ackLink = $this->href(
'monitoring/service/acknowledge-problem',
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
null,
array('class' => 'action-link')
);
}
?>
<?= $this->qlink(
$this->translate('Acknowledge'),
$ackLink,
null,
array(
'class' => 'action-link',
'data-base-target' => '_self',
'icon' => 'ok',
'title' => $this->translate(
'Acknowledge this problem, suppress all future notifications for it and tag it as being handled'
)
)
); ?>
<?php } else {
echo '&#45;';
} // endif ?>
</td>
</tr>
<?php endif ?>