Refactor acknowledgements, finally get rid of status component
This commit is contained in:
parent
a87925bbf6
commit
e6fc6375b5
|
@ -984,6 +984,7 @@ class Monitoring_CommandController extends ActionController
|
|||
|
||||
if ($form->IsSubmittedAndValid() === true) {
|
||||
$this->target->sendCommand($form->createCommand(), $this->view->objects);
|
||||
Notification::success('Acknowledgement removal request has been requested');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
|
||||
if (in_array((int) $object->state, array(0, 99))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cf = $this->getHelper('CommandForm');
|
||||
|
||||
$data = array('host' => $object->host_name);
|
||||
if ($object->service_description) {
|
||||
$data['service'] = $object->service_description;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<?php
|
||||
|
||||
if ($object instanceof Host && $object->host_acknowledged
|
||||
|| $object instanceof Service && $object->service_acknowledged): ?>
|
||||
<th>Issue acknowledged</th>
|
||||
<td><?= $cf->labelSubmitForm(
|
||||
'Remove Acknowledgement',
|
||||
'Remove problem acknowledgement',
|
||||
'link-like',
|
||||
'removeacknowledgement',
|
||||
$data
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<th>Not acknowledged</th>
|
||||
<td>
|
||||
<a href="<?= $this->href(
|
||||
'monitoring/command/acknowledgeproblem',
|
||||
$data
|
||||
) ?>"><?= $this->icon('acknowledgement_petrol.png') ?> Acknowledge now</a>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
$type = $object->type === 2 ? 'service' : 'host';
|
||||
|
||||
/** @var Zend_View_Helper_CommandForm $cf */
|
||||
$cf = $this->getHelper('CommandForm');
|
||||
|
||||
if ($type === 'host') {
|
||||
$objectStateName = strtolower($this->util()->getHostStateName($this->object->host_state));
|
||||
$objectState = (int) $object->host_state;
|
||||
} else {
|
||||
$objectStateName = strtolower($this->util()->getServiceStateName($this->object->service_state));
|
||||
$objectState = (int) $object->service_state;
|
||||
}
|
||||
?>
|
||||
<div>
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="panel-row">
|
||||
|
||||
<?php if ($objectState > 0): ?>
|
||||
<?php if ($this->object->host_acknowledged || $this->object->service_acknowledged): ?>
|
||||
<?= $cf->labelSubmitForm(
|
||||
'Remove Ack',
|
||||
'Remove problem acknowledgement',
|
||||
'btn-cta btn-half-left',
|
||||
'removeacknowledgement',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description
|
||||
)
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<a rel="tooltip" title="Acknowledge Problems" href="<?=
|
||||
$this->href(
|
||||
'monitoring/command/acknowledgeproblem',
|
||||
array(
|
||||
'host' => $this->object->host_name,
|
||||
'service' => $this->object->service_description
|
||||
)
|
||||
);
|
||||
?>" class="button btn-cta btn-half-left">
|
||||
Acknowledge
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -4,10 +4,10 @@
|
|||
</div>
|
||||
<div class="content" data-base-target="col1">
|
||||
<?= $this->render('show/components/output.phtml') ?>
|
||||
<?= $this->render('show/components/status.phtml') ?>
|
||||
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<?= $this->render('show/components/acknowledgement.phtml') ?>
|
||||
<?= $this->render('show/components/comments.phtml') ?>
|
||||
<?= $this->render('show/components/notifications.phtml') ?>
|
||||
<?= $this->render('show/components/downtime.phtml') ?>
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
<h1>This service's current state</h1>
|
||||
</div>
|
||||
<div class="content" data-base-target="col1">
|
||||
<?= $this->render('show/components/status.phtml') ?>
|
||||
<?= $this->render('show/components/output.phtml') ?>
|
||||
|
||||
<table class="avp">
|
||||
<tbody>
|
||||
<?= $this->render('show/components/acknowledgement.phtml') ?>
|
||||
<?= $this->render('show/components/comments.phtml') ?>
|
||||
<?= $this->render('show/components/notifications.phtml') ?>
|
||||
<?= $this->render('show/components/downtime.phtml') ?>
|
||||
|
|
Loading…
Reference in New Issue