2015-06-18 14:57:58 +02:00
|
|
|
<?php
|
2015-08-03 15:03:31 +02:00
|
|
|
$addLink = false;
|
2015-06-18 14:57:58 +02:00
|
|
|
if ($this->hasPermission('monitoring/command/downtime/schedule')) {
|
|
|
|
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
|
|
|
if ($object->getType() === $object::TYPE_HOST) {
|
|
|
|
$addLink = $this->qlink(
|
|
|
|
$this->translate('Schedule downtime'),
|
|
|
|
'monitoring/host/schedule-downtime',
|
|
|
|
array('host' => $object->getName()),
|
|
|
|
array(
|
2015-09-24 18:00:03 +02:00
|
|
|
'class' => 'action-link',
|
2015-06-18 14:57:58 +02:00
|
|
|
'data-base-target' => '_self',
|
2015-09-24 18:00:03 +02:00
|
|
|
'icon' => 'plug',
|
2015-06-18 14:57:58 +02:00
|
|
|
'title' => $this->translate(
|
|
|
|
'Schedule a downtime to suppress all problem notifications within a specific period of time'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$addLink = $this->qlink(
|
|
|
|
$this->translate('Schedule downtime'),
|
|
|
|
'monitoring/service/schedule-downtime',
|
|
|
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName()),
|
|
|
|
array(
|
2015-09-24 18:00:03 +02:00
|
|
|
'class' => 'action-link',
|
2015-06-18 14:57:58 +02:00
|
|
|
'data-base-target' => '_self',
|
2015-09-24 18:00:03 +02:00
|
|
|
'icon' => 'plug',
|
2015-06-18 14:57:58 +02:00
|
|
|
'title' => $this->translate(
|
|
|
|
'Schedule a downtime to suppress all problem notifications within a specific period of time'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (empty($object->comments) && ! $addLink) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
?>
|
2014-09-12 16:52:45 +02:00
|
|
|
<tr>
|
2015-06-18 14:57:58 +02:00
|
|
|
<th><?php
|
|
|
|
echo $this->translate('Downtimes');
|
|
|
|
if (! empty($object->downtimes) && $addLink) {
|
2015-10-28 09:41:21 +01:00
|
|
|
echo '<br>' . $addLink;
|
2015-06-18 14:57:58 +02:00
|
|
|
}
|
|
|
|
?></th>
|
|
|
|
<td data-base-target="_self">
|
2015-08-03 15:03:31 +02:00
|
|
|
<?php if (empty($object->downtimes)):
|
|
|
|
echo $addLink;
|
|
|
|
else: ?>
|
2015-10-28 09:41:21 +01:00
|
|
|
<dl class="comment-list">
|
2015-08-03 15:03:31 +02:00
|
|
|
<?php foreach ($object->downtimes as $downtime):
|
|
|
|
if ((bool) $downtime->is_in_effect) {
|
|
|
|
$state = sprintf(
|
2015-08-03 15:05:45 +02:00
|
|
|
$this->translate('expires %s', 'Last format parameter represents the downtime expire time'),
|
|
|
|
$this->timeUntil($downtime->end)
|
2015-08-03 15:03:31 +02:00
|
|
|
);
|
|
|
|
} else {
|
2015-08-10 12:32:15 +02:00
|
|
|
if ($downtime->start <= time()) {
|
2015-08-10 10:58:21 +02:00
|
|
|
$state = sprintf(
|
|
|
|
$this->translate('ends %s', 'Last format parameter represents the end time'),
|
2015-08-10 12:15:26 +02:00
|
|
|
$this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end)
|
2015-08-10 10:58:21 +02:00
|
|
|
);
|
|
|
|
} elseif ((bool) $downtime->is_fixed) {
|
2015-08-03 15:03:31 +02:00
|
|
|
$state = sprintf(
|
|
|
|
$this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
|
|
|
|
$this->timeUntil($downtime->start)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$state = sprintf(
|
|
|
|
$this->translate('scheduled flexible %s', 'Last format parameter represents the time scheduled'),
|
|
|
|
$this->timeUntil($downtime->start)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2015-10-28 09:41:21 +01:00
|
|
|
?>
|
|
|
|
<dt class="comment-header">
|
|
|
|
<?= $this->escape($downtime->author_name) ?>
|
|
|
|
<span class="comment-meta">
|
|
|
|
<?= $this->translate('created') ?>
|
|
|
|
<?= $this->timeAgo($downtime->entry_time) ?>
|
|
|
|
<span aria-hidden="true">ǀ</span>
|
|
|
|
<?= $state ?>
|
|
|
|
<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
|
|
|
|
<span class="meta-icons">
|
|
|
|
<?php
|
|
|
|
$deleteButton = clone($delDowntimeForm);
|
|
|
|
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm $deleteButton */
|
2015-10-28 09:56:50 +01:00
|
|
|
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action');
|
2015-10-28 09:41:21 +01:00
|
|
|
$deleteButton->populate(
|
|
|
|
array(
|
|
|
|
'downtime_id' => $downtime->id,
|
|
|
|
'downtime_is_service' => $object->getType() === $object::TYPE_SERVICE
|
|
|
|
)
|
|
|
|
);
|
|
|
|
echo $deleteButton;
|
|
|
|
?>
|
|
|
|
</span>
|
|
|
|
<?php endif ?>
|
|
|
|
</span>
|
|
|
|
</dt>
|
|
|
|
<dd class="comment-text">
|
2015-11-03 10:40:03 +01:00
|
|
|
<p><?= nl2br($this->createTicketLinks($this->escape($downtime->comment)), false) ?></p>
|
2015-10-01 16:31:25 +02:00
|
|
|
</dd>
|
2015-08-03 15:03:31 +02:00
|
|
|
<?php endforeach ?>
|
2015-10-01 16:31:25 +02:00
|
|
|
</dl>
|
2015-08-03 15:03:31 +02:00
|
|
|
<?php endif ?>
|
2015-06-18 14:57:58 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|