mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Display additional downtime info in multiselection detail view
refs #8902
This commit is contained in:
parent
a87e1f91d9
commit
07c5e67304
@ -23,8 +23,6 @@ class Monitoring_DowntimesController extends Controller
|
|||||||
{
|
{
|
||||||
protected $downtimes;
|
protected $downtimes;
|
||||||
|
|
||||||
protected $isService;
|
|
||||||
|
|
||||||
protected $filter;
|
protected $filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,6 +70,20 @@ class Monitoring_DowntimesController extends Controller
|
|||||||
'url' =>'monitoring/downtimes/show'
|
'url' =>'monitoring/downtimes/show'
|
||||||
)
|
)
|
||||||
)->activate('downtimes')->extend(new DashboardAction());
|
)->activate('downtimes')->extend(new DashboardAction());
|
||||||
|
|
||||||
|
foreach ($this->downtimes as $downtime) {
|
||||||
|
if (isset($downtime->service_description)) {
|
||||||
|
$downtime->isService = true;
|
||||||
|
} else {
|
||||||
|
$downtime->isService = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($downtime->isService) {
|
||||||
|
$downtime->stateText = Service::getStateText($downtime->service_state);
|
||||||
|
} else {
|
||||||
|
$downtime->stateText = Host::getStateText($downtime->host_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showAction()
|
public function showAction()
|
||||||
@ -80,9 +92,6 @@ class Monitoring_DowntimesController extends Controller
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->view->downtimes = $this->downtimes;
|
$this->view->downtimes = $this->downtimes;
|
||||||
$this->view->isService = $this->isService;
|
|
||||||
|
|
||||||
// $this->view->delDowntimeForm = $this->createDelDowntimeForm();
|
|
||||||
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes')
|
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes')
|
||||||
->setQueryString($this->filter->toQueryString());
|
->setQueryString($this->filter->toQueryString());
|
||||||
$this->view->removeAllLink = Url::fromPath('monitoring/downtimes/removeAll')
|
$this->view->removeAllLink = Url::fromPath('monitoring/downtimes/removeAll')
|
||||||
@ -90,11 +99,6 @@ class Monitoring_DowntimesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function removeAllAction()
|
public function removeAllAction()
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createDelDowntimeForm()
|
|
||||||
{
|
{
|
||||||
$delDowntimeForm = new DeleteDowntimeCommandForm();
|
$delDowntimeForm = new DeleteDowntimeCommandForm();
|
||||||
$delDowntimeForm->setObjects($this->downtimes);
|
$delDowntimeForm->setObjects($this->downtimes);
|
||||||
|
@ -8,34 +8,129 @@
|
|||||||
<?php if (! $this->compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<h1 data-base-target="_next">
|
|
||||||
<?= sprintf('%d Downtimes', count($downtimes)) ?>
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content">
|
<h1>
|
||||||
<p>
|
<?= sprintf($this->translate('%d Downtimes'), count($downtimes)) ?>
|
||||||
<?= $this->translate('You have selected') ?>
|
<?= count($downtimes) > 5 ?
|
||||||
<?= $this->qlink(
|
sprintf($this->translate('(%d not shown)'), count ($downtimes) - 5)
|
||||||
sprintf($this->translate('%d downtimes'), count($downtimes)),
|
: '';
|
||||||
$listAllLink,
|
?>
|
||||||
null,
|
</h1>
|
||||||
array('title' => $this->translate('List all selected downtimes.'))
|
<p>
|
||||||
) ?>
|
<table class="action">
|
||||||
<div>
|
<tbody>
|
||||||
<?= $this->qlink(
|
<?php $i = 0; foreach ($downtimes as $downtime):
|
||||||
sprintf(
|
if (++ $i > 5) {
|
||||||
$this->translate('Remove all %d downtimes.'),
|
continue;
|
||||||
count($downtimes)
|
} ?>
|
||||||
),
|
<tr class="state <?= $downtime->stateText ?>">
|
||||||
$removeAllLink,
|
<td class="state">
|
||||||
null,
|
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
|
||||||
array(
|
<br>
|
||||||
'icon' => 'trash',
|
<?=
|
||||||
'title' => $this->translate('Remove all selected downtimes.')
|
$this->dateTimeRenderer(
|
||||||
)
|
($downtime->is_in_effect ? $downtime->end : $downtime->start),
|
||||||
) ?>
|
true
|
||||||
</div>
|
)->render(
|
||||||
</p>
|
$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') ?>
|
||||||
|
<b><?= $downtime->service ?> on <?= $downtime->host_name ?>.</b>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= $this->icon('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>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<h3><?= $this->icon('reschedule') ?> <?= $this->translate('Commands') ?> </h3>
|
||||||
|
<p>
|
||||||
|
<?= sprintf(
|
||||||
|
$this->translate('Issue commands to all %s selected downtimes.'),
|
||||||
|
'<b>' . count($downtimes) . '</b>'
|
||||||
|
)
|
||||||
|
?>
|
||||||
|
<div>
|
||||||
|
<?= $this->qlink(
|
||||||
|
sprintf(
|
||||||
|
$this->translate('Remove all %d scheduled downtimes'),
|
||||||
|
count($downtimes)
|
||||||
|
),
|
||||||
|
$removeAllLink,
|
||||||
|
null,
|
||||||
|
array(
|
||||||
|
'icon' => 'trash',
|
||||||
|
'title' => $this->translate('Remove all selected downtimes.')
|
||||||
|
)
|
||||||
|
) ?>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user