Merge branch 'bugfix/downtimes-with-non-problem-state-time-caption-9266'

fixes #9266
This commit is contained in:
Alexander Fuhr 2015-08-10 12:46:57 +02:00
commit b54a643c97
5 changed files with 28 additions and 4 deletions

View File

@ -35,9 +35,15 @@ if (! $this->compact): ?>
?>
<tr class="state <?= $stateName; ?><?= $downtime->is_in_effect ? ' handled' : ''; ?>">
<td class="state">
<?php if ($downtime->start <= time() && ! $downtime->is_in_effect): ?>
<strong><?= $this->translate('Ends'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, $this->compact) ?>
<?php else: ?>
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
<?php endif; ?>
</td>
<td>
<?php if ($isService): ?>

View File

@ -1,9 +1,15 @@
<table class="action">
<tr class="state <?= $stateName; ?><?= $downtime->is_in_effect ? ' handled' : ''; ?>">
<td class="state">
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
<?php if ($downtime->start <= time() && ! $downtime->is_in_effect): ?>
<strong><?= $this->translate('Ends'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, $this->compact) ?>
<?php else: ?>
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
<?php endif; ?>
</td>
<td>
<small>

View File

@ -6,9 +6,15 @@
} ?>
<tr class="state <?= $downtime->stateText ?>">
<td class="state">
<?php if ($downtime->start <= time() && ! $downtime->is_in_effect): ?>
<strong><?= $this->translate('Ends'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end, $this->compact) ?>
<?php else: ?>
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
<br>
<?= $this->timeUntil($downtime->is_in_effect ? $downtime->end : $downtime->start, $this->compact) ?>
<?php endif; ?>
</td>
<td class="name oneline">
<?php if ($downtime->isService): ?>

View File

@ -53,7 +53,12 @@ if (empty($object->comments) && ! $addLink) {
$this->timeUntil($downtime->end)
);
} else {
if ((bool) $downtime->is_fixed) {
if ($downtime->start <= time()) {
$state = sprintf(
$this->translate('ends %s', 'Last format parameter represents the end time'),
$this->timeUntil($downtime->is_flexible ? $downtime->scheduled_end : $downtime->end)
);
} elseif ((bool) $downtime->is_fixed) {
$state = sprintf(
$this->translate('scheduled %s', 'Last format parameter represents the time scheduled'),
$this->timeUntil($downtime->start)

View File

@ -279,6 +279,7 @@ abstract class MonitoredObject implements Filterable
'author_name' => 'downtime_author_name',
'start' => 'downtime_start',
'scheduled_start' => 'downtime_scheduled_start',
'scheduled_end' => 'downtime_scheduled_end',
'end' => 'downtime_end',
'duration' => 'downtime_duration',
'is_flexible' => 'downtime_is_flexible',