Provide downtime header in remove and remove-all commands
Add new show script for downtimes and move downtime headers into partials to deduplicate code. refs #8902
This commit is contained in:
parent
6ddb004230
commit
be566746a9
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="controls">
|
||||||
|
|
||||||
|
<?php if (! $this->compact): ?>
|
||||||
|
<?= $this->tabs; ?>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?= $this->render('partials/downtime/downtime-header.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="content object-command">
|
||||||
|
<?= $delDowntimeForm; ?>
|
||||||
|
</div>
|
|
@ -3,75 +3,8 @@
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<table class="action">
|
<?= $this->render('partials/downtime/downtime-header.phtml'); ?>
|
||||||
<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->dateTimeRenderer(
|
|
||||||
($downtime->is_in_effect ? $downtime->end : $downtime->start),
|
|
||||||
true
|
|
||||||
)->render(
|
|
||||||
$this->translate('on %s', 'datetime'),
|
|
||||||
$this->translate('at %s', 'time'),
|
|
||||||
$this->translate('in %s', 'timespan')
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<small>
|
|
||||||
<?php if ($downtime->is_flexible): ?>
|
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
|
|
||||||
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->start),
|
|
||||||
date('H:i', $downtime->start),
|
|
||||||
$this->format()->duration($downtime->duration),
|
|
||||||
date('d.m.y', $downtime->end),
|
|
||||||
date('H:i', $downtime->end)
|
|
||||||
); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
|
|
||||||
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
|
|
||||||
date('d.m.y H:i', $downtime->scheduled_start),
|
|
||||||
date('d.m.y H:i', $downtime->scheduled_end),
|
|
||||||
$this->format()->duration($downtime->duration)
|
|
||||||
); ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
|
||||||
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->start),
|
|
||||||
date('H:i', $downtime->start),
|
|
||||||
date('d.m.y', $downtime->end),
|
|
||||||
date('H:i', $downtime->end)
|
|
||||||
); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
|
|
||||||
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->scheduled_start),
|
|
||||||
date('H:i', $downtime->scheduled_start),
|
|
||||||
date('d.m.y', $downtime->scheduled_end),
|
|
||||||
date('H:i', $downtime->scheduled_end)
|
|
||||||
); ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php endif ?>
|
|
||||||
</small>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h3><?= $this->translate('Downtime detail information') ?></h3>
|
<h3><?= $this->translate('Downtime detail information') ?></h3>
|
||||||
<table class="avp">
|
<table class="avp">
|
||||||
|
@ -177,7 +110,7 @@
|
||||||
<tr class="newsection">
|
<tr class="newsection">
|
||||||
<th><?= $this->translate('Commands') ?></th>
|
<th><?= $this->translate('Commands') ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?= $delDowntimeForm;?>
|
<?= $delDowntimeForm ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<div class="controls">
|
||||||
|
|
||||||
|
<?php if (! $this->compact): ?>
|
||||||
|
<?= $this->tabs; ?>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?= $this->render('partials/downtime/downtimes-header.phtml'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content object-command">
|
||||||
|
<?= $delDowntimeForm ?>
|
||||||
|
</div>
|
|
@ -3,98 +3,8 @@
|
||||||
<?php if (! $this->compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<p>
|
|
||||||
<table class="action">
|
<?= $this->render('partials/downtime/downtimes-header.phtml'); ?>
|
||||||
<tbody>
|
|
||||||
<?php $i = 0; foreach ($downtimes as $downtime):
|
|
||||||
if (++ $i > 5) {
|
|
||||||
continue;
|
|
||||||
} ?>
|
|
||||||
<tr class="state <?= $downtime->stateText ?>">
|
|
||||||
<td class="state">
|
|
||||||
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
|
|
||||||
<br>
|
|
||||||
<?=
|
|
||||||
$this->dateTimeRenderer(
|
|
||||||
($downtime->is_in_effect ? $downtime->end : $downtime->start),
|
|
||||||
true
|
|
||||||
)->render(
|
|
||||||
$this->translate('on %s', 'datetime'),
|
|
||||||
$this->translate('at %s', 'time'),
|
|
||||||
$this->translate('in %s', 'timespan')
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td class="name oneline">
|
|
||||||
<?php if ($downtime->isService): ?>
|
|
||||||
<?= $this->icon('service', $this->translate('Service')) ?>
|
|
||||||
<b><?= $downtime->service ?> on <?= $downtime->host_name ?>.</b>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= $this->icon('host', $this->translate('Host')) ?>
|
|
||||||
<b><?= $downtime->host_name ?>.</b>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($downtime->is_flexible): ?>
|
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
|
|
||||||
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->start),
|
|
||||||
date('H:i', $downtime->start),
|
|
||||||
$this->format()->duration($downtime->duration),
|
|
||||||
date('d.m.y', $downtime->end),
|
|
||||||
date('H:i', $downtime->end)
|
|
||||||
); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
|
|
||||||
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
|
|
||||||
date('d.m.y H:i', $downtime->scheduled_start),
|
|
||||||
date('d.m.y H:i', $downtime->scheduled_end),
|
|
||||||
$this->format()->duration($downtime->duration)
|
|
||||||
); ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
|
||||||
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->start),
|
|
||||||
date('H:i', $downtime->start),
|
|
||||||
date('d.m.y', $downtime->end),
|
|
||||||
date('H:i', $downtime->end)
|
|
||||||
); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?= sprintf(
|
|
||||||
$this->isService
|
|
||||||
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
|
|
||||||
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
|
||||||
date('d.m.y', $downtime->scheduled_start),
|
|
||||||
date('H:i', $downtime->scheduled_start),
|
|
||||||
date('d.m.y', $downtime->scheduled_end),
|
|
||||||
date('H:i', $downtime->scheduled_end)
|
|
||||||
); ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php endif ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p>
|
|
||||||
<?= $this->qlink(
|
|
||||||
sprintf($this->translate('List all %d downtimes …'), count($downtimes)),
|
|
||||||
$listAllLink,
|
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'title' => $this->translate('List all'),
|
|
||||||
'data-base-target' => "_next"
|
|
||||||
)
|
|
||||||
) ?>
|
|
||||||
</p>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -119,5 +29,5 @@
|
||||||
)
|
)
|
||||||
) ?>
|
) ?>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<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->dateTimeRenderer(
|
||||||
|
($downtime->is_in_effect ? $downtime->end : $downtime->start),
|
||||||
|
true
|
||||||
|
)->render(
|
||||||
|
$this->translate('on %s', 'datetime'),
|
||||||
|
$this->translate('at %s', 'time'),
|
||||||
|
$this->translate('in %s', 'timespan')
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<small>
|
||||||
|
<?php if ($downtime->is_flexible): ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
|
||||||
|
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
$this->format()->duration($downtime->duration),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
|
||||||
|
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_end),
|
||||||
|
$this->format()->duration($downtime->duration)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
||||||
|
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
|
||||||
|
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->scheduled_start),
|
||||||
|
date('H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y', $downtime->scheduled_end),
|
||||||
|
date('H:i', $downtime->scheduled_end)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endif ?>
|
||||||
|
</small>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
|
@ -0,0 +1,92 @@
|
||||||
|
<table class="action">
|
||||||
|
<tbody>
|
||||||
|
<?php $i = 0; foreach ($downtimes as $downtime):
|
||||||
|
if (++ $i > 5) {
|
||||||
|
continue;
|
||||||
|
} ?>
|
||||||
|
<tr class="state <?= $downtime->stateText ?>">
|
||||||
|
<td class="state">
|
||||||
|
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
|
||||||
|
<br>
|
||||||
|
<?=
|
||||||
|
$this->dateTimeRenderer(
|
||||||
|
($downtime->is_in_effect ? $downtime->end : $downtime->start),
|
||||||
|
true
|
||||||
|
)->render(
|
||||||
|
$this->translate('on %s', 'datetime'),
|
||||||
|
$this->translate('at %s', 'time'),
|
||||||
|
$this->translate('in %s', 'timespan')
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td class="name oneline">
|
||||||
|
<?php if ($downtime->isService): ?>
|
||||||
|
<?= $this->icon('service', $this->translate('Service')) ?>
|
||||||
|
<b><?= $downtime->service ?> on <?= $downtime->host_name ?>.</b>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $this->icon('host', $this->translate('Host')) ?>
|
||||||
|
<b><?= $downtime->host_name ?>.</b>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($downtime->is_flexible): ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This flexible service downtime was started on %s at %s and lasts for %s until %s at %s.')
|
||||||
|
: $this->translate('This flexible host downtime was started on %s at %s and lasts for %s until %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
$this->format()->duration($downtime->duration),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This flexible service downtime has been scheduled to start between %s - %s and to last for %s.')
|
||||||
|
: $this->translate('This flexible host downtime has been scheduled to start between %s - %s and to last for %s.'),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y H:i', $downtime->scheduled_end),
|
||||||
|
$this->format()->duration($downtime->duration)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
||||||
|
: $this->translate('This fixed host downtime was started on %s at %s and expires on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->start),
|
||||||
|
date('H:i', $downtime->start),
|
||||||
|
date('d.m.y', $downtime->end),
|
||||||
|
date('H:i', $downtime->end)
|
||||||
|
); ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->isService
|
||||||
|
? $this->translate('This fixed service downtime has been scheduled to start on %s at %s and to end on %s at %s.')
|
||||||
|
: $this->translate('This fixed host downtime has been scheduled to start on %s at %s and to end on %s at %s.'),
|
||||||
|
date('d.m.y', $downtime->scheduled_start),
|
||||||
|
date('H:i', $downtime->scheduled_start),
|
||||||
|
date('d.m.y', $downtime->scheduled_end),
|
||||||
|
date('H:i', $downtime->scheduled_end)
|
||||||
|
); ?>
|
||||||
|
<?php endif ?>
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= $this->qlink(
|
||||||
|
sprintf($this->translate('List all %d downtimes …'), count($downtimes)),
|
||||||
|
$listAllLink,
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'title' => $this->translate('List all'),
|
||||||
|
'data-base-target' => "_next"
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
</p>
|
Loading…
Reference in New Issue