Add real command button to detail panel

refs #4869
This commit is contained in:
Marius Hein 2013-10-15 16:23:46 +02:00
parent d0fe1be7f7
commit 6f51f40fc0
5 changed files with 68 additions and 18 deletions

View File

@ -88,7 +88,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
$cfg = $this->getConfiguration();
$preferences = $this->getUserPreferences();
$downtimes = Backend::getInstance($this->getRequest()->getParam('backend'))->select()
$downtimes = Backend::createBackend($this->getRequest()->getParam('backend'))->select()
->from(
'downtime',
array(

View File

@ -72,7 +72,6 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
public function labelSubmitForm($submitLabel, $submitTitle, $cls, $commandName, array $arguments = array())
{
$form = $this->simpleForm($commandName, $arguments);
$button = new Zend_Form_Element_Button(
array(
'name' => 'btn_submit',

View File

@ -1,3 +1,7 @@
<?php
/** @var Zend_View_Helper_CommandForm $cf */
$cf = $this->getHelper('CommandForm');
?>
<div>
<div class="panel-heading">
<div class="panel-hostname">
@ -41,11 +45,18 @@
<tr>
<td>
<div class="pull-right">
<form>
<button type="submit" value="1" class="button btn-small btn-common" title="Remove comment">
<i class="icinga-icon-remove"></i>
</button>
</form>
<?php
$deleteData = $data;
$deleteData['commentid'] = $comment->comment_internal_id;
echo $cf->iconSubmitForm(
'icinga-icon-remove',
'Remove comment',
'btn-small',
'removecomment',
$deleteData
);
?>
</div>
<?= $this->escape($comment->comment_author); ?>, <?= $comment->comment_type; ?>
(<?= $this->format()->timeSince($comment->comment_timestamp); ?>)

View File

@ -2,6 +2,9 @@
$object = $this->object;
$type = (isset($object->service_description) === true) ? '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;
@ -72,14 +75,44 @@
<div class="panel-row">
<p><?= $this->pluginOutput($object->output); ?></p>
<form>
<?php if ($objectState > 0): ?>
<button type="submit" class="button btn-cta btn-half-left">Acknowledge</button>
<?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 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; ?>
<button type="submit" class="button btn-cta <?= ($objectState > 0) ? 'btn-half-right' : 'btn-wide'; ?>">Recheck</button>
</form>
<?php endif; ?>
<?= $cf->labelSubmitForm(
'Recheck',
'Reschedule next check immediately',
'btn-cta ' . (($objectState > 0) ? 'btn-half-right' : 'btn-wide'),
'reschedulenextcheck',
array(
'host' => $this->object->host_name,
'service' => $this->object->service_description,
'checktime' => time(),
'forcecheck' => '1'
)
) ?>
</div>
<div class="panel-row">
@ -123,11 +156,17 @@
<?= $this->dateFormat()->formatDateTime($object->next_check); ?>
</div>
<div class="panel-button">
<form>
<button class="button btn-common btn-small">
<i class="icinga-icon-reschedule"></i>
</button>
</form>
<a href="<?=
$this->href(
'monitoring/command/reschedulenextcheck',
array(
'host' => $this->object->host_name,
'service' => $this->object->serivce_description
)
);
?>" class="button btn-common btn-small">
<i class="icinga-icon-reschedule"></i>
</a>
</div>
</div>

View File

@ -169,6 +169,7 @@ abstract class AbstractObject
'comment_author',
'comment_data',
'comment_type',
'comment_internal_id'
)
)->where('comment_objecttype_id', $this->type)
)->fetchAll();