Improve order and content of downtime properties
Add rows for missing properties, reorder and group related properties. refs #8902
This commit is contained in:
parent
7b6641dc84
commit
ff47b892e9
|
@ -19,13 +19,15 @@ class Monitoring_DowntimeController extends Controller
|
||||||
{
|
{
|
||||||
protected $downtime;
|
protected $downtime;
|
||||||
|
|
||||||
|
protected $isService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add tabs
|
* Add tabs
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$downtimeId = $this->params->get('downtime_id');
|
$downtimeId = $this->params->get('downtime_id');
|
||||||
|
|
||||||
$this->downtime = $this->backend->select()->from('downtime', array(
|
$this->downtime = $this->backend->select()->from('downtime', array(
|
||||||
'id' => 'downtime_internal_id',
|
'id' => 'downtime_internal_id',
|
||||||
'objecttype' => 'downtime_objecttype',
|
'objecttype' => 'downtime_objecttype',
|
||||||
|
@ -50,6 +52,12 @@ class Monitoring_DowntimeController extends Controller
|
||||||
'service_display_name'
|
'service_display_name'
|
||||||
))->where('downtime_internal_id', $downtimeId)->getQuery()->fetchRow();
|
))->where('downtime_internal_id', $downtimeId)->getQuery()->fetchRow();
|
||||||
|
|
||||||
|
if (isset($this->downtime->service_description)) {
|
||||||
|
$this->isService = true;
|
||||||
|
} else {
|
||||||
|
$this->isService = false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->getTabs()
|
$this->getTabs()
|
||||||
->add(
|
->add(
|
||||||
'downtime',
|
'downtime',
|
||||||
|
@ -67,8 +75,8 @@ class Monitoring_DowntimeController extends Controller
|
||||||
public function showAction()
|
public function showAction()
|
||||||
{
|
{
|
||||||
$this->view->downtime = $this->downtime;
|
$this->view->downtime = $this->downtime;
|
||||||
$this->view->delDowntimeForm = new DeleteDowntimeCommandForm();
|
$this->view->isService = $this->isService;
|
||||||
$this->view->delDowntimeForm->setObjects($this->downtime);
|
$this->view->delDowntimeForm = $this->createDelDowntimeForm();
|
||||||
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
|
$this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
|
||||||
$this->view->showHostLink = Url::fromPath('monitoring/host/show')
|
$this->view->showHostLink = Url::fromPath('monitoring/host/show')
|
||||||
->setParam('host', $this->downtime->host);
|
->setParam('host', $this->downtime->host);
|
||||||
|
@ -76,4 +84,30 @@ class Monitoring_DowntimeController extends Controller
|
||||||
->setParam('host', $this->downtime->host)
|
->setParam('host', $this->downtime->host)
|
||||||
->setParam('service', $this->downtime->service_description);
|
->setParam('service', $this->downtime->service_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createDelDowntimeForm()
|
||||||
|
{
|
||||||
|
$delDowntimeForm = new DeleteDowntimeCommandForm();
|
||||||
|
$delDowntimeForm->setObjects($this->downtime);
|
||||||
|
$delDowntimeForm->populate(
|
||||||
|
array(
|
||||||
|
'downtime_id' => $this->downtime->id,
|
||||||
|
'redirect' => Url::fromPath('monitoring/list/downtimes')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (! $this->isService) {
|
||||||
|
$delDowntimeForm->setAction(
|
||||||
|
$this->view->url('monitoring/host/delete-downtime',
|
||||||
|
array('host' => $this->downtime->host_name))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$delDowntimeForm->setAction(
|
||||||
|
$this->view->url('monitoring/service/delete-downtime', array(
|
||||||
|
'host' => $this->downtime->host_name,
|
||||||
|
'service' => $this->downtime->service_description
|
||||||
|
))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $delDowntimeForm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,9 @@
|
||||||
<?php
|
|
||||||
use Icinga\Module\Monitoring\Object\Service;
|
|
||||||
use Icinga\Module\Monitoring\Object\Host;
|
|
||||||
|
|
||||||
if (isset($downtime->service_description)) {
|
|
||||||
$isService = true;
|
|
||||||
$stateName = Service::getStateText($downtime->service_state);
|
|
||||||
} else {
|
|
||||||
$isService = false;
|
|
||||||
$stateName = Host::getStateText($downtime->host_state);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?php if (! $this->compact): ?>
|
<?php if (! $this->compact): ?>
|
||||||
<?= $this->tabs; ?>
|
<?= $this->tabs; ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<h1>
|
<h1 data-base-target="_next">
|
||||||
<?php if ($isService): ?>
|
<?php if ($this->isService): ?>
|
||||||
<?php
|
<?php
|
||||||
$link = $this->link()->service(
|
$link = $this->link()->service(
|
||||||
$downtime->service_description,
|
$downtime->service_description,
|
||||||
|
@ -34,7 +21,7 @@ if (isset($downtime->service_description)) {
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?= sprintf(
|
<?= sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'Downtime for %s',
|
'Downtime on %s',
|
||||||
'Downtime for host or service.'
|
'Downtime for host or service.'
|
||||||
),
|
),
|
||||||
$link
|
$link
|
||||||
|
@ -43,12 +30,12 @@ if (isset($downtime->service_description)) {
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content" data-base-target="_next">
|
<div class="content">
|
||||||
<small>
|
<small>
|
||||||
<?php if ($downtime->is_flexible): ?>
|
<?php if ($downtime->is_flexible): ?>
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
<?= sprintf(
|
<?= sprintf(
|
||||||
$isService
|
$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 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.'),
|
: $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('d.m.y', $downtime->start),
|
||||||
|
@ -59,7 +46,7 @@ if (isset($downtime->service_description)) {
|
||||||
); ?>
|
); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= sprintf(
|
<?= sprintf(
|
||||||
$isService
|
$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 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.'),
|
: $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_start),
|
||||||
|
@ -70,7 +57,7 @@ if (isset($downtime->service_description)) {
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php if ($downtime->is_in_effect): ?>
|
<?php if ($downtime->is_in_effect): ?>
|
||||||
<?= sprintf(
|
<?= sprintf(
|
||||||
$isService
|
$this->isService
|
||||||
? $this->translate('This fixed service downtime was started on %s at %s and expires on %s at %s.')
|
? $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.'),
|
: $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('d.m.y', $downtime->start),
|
||||||
|
@ -80,7 +67,7 @@ if (isset($downtime->service_description)) {
|
||||||
); ?>
|
); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= sprintf(
|
<?= sprintf(
|
||||||
$isService
|
$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 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.'),
|
: $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('d.m.y', $downtime->scheduled_start),
|
||||||
|
@ -132,43 +119,12 @@ if (isset($downtime->service_description)) {
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php if ($this->downtime->is_flexible && $this->downtime->is_in_effect): ?>
|
|
||||||
<tr>
|
|
||||||
<th><?= $this->translate('Start') ?></th>
|
|
||||||
<td><?= date('d.m.y H:i', $downtime->start); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th><?= $this->translate('End') ?></th>
|
|
||||||
<td><?= date('d.m.y H:i', $downtime->end); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
<tr>
|
|
||||||
<th><?= $this->translate('Duration') ?></th>
|
|
||||||
<td><?= $this->format()->duration($this->escape($this->downtime->duration)); ?></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
|
<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
|
||||||
<tr class="newsection">
|
<tr class="newsection">
|
||||||
<th><?= $this->translate('Commands') ?></th>
|
<th><?= $this->translate('Commands') ?></th>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?= $delDowntimeForm;?>
|
||||||
$delDowntimeForm->populate(array('downtime_id' => $downtime->id, 'redirect' => $this->listAllLink));
|
|
||||||
if (! $isService) {
|
|
||||||
$delDowntimeForm->setAction(
|
|
||||||
$this->url('monitoring/host/delete-downtime',
|
|
||||||
array('host' => $downtime->host_name))
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$delDowntimeForm->setAction(
|
|
||||||
$this->url('monitoring/service/delete-downtime', array(
|
|
||||||
'host' => $downtime->host_name,
|
|
||||||
'service' => $downtime->service_description
|
|
||||||
))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
echo $delDowntimeForm;
|
|
||||||
?>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
Loading…
Reference in New Issue