commit
054653415e
|
@ -1,2 +1,2 @@
|
|||
[icinga]
|
||||
path=/usr/local/icinga/var/rw/icinga.cmd
|
||||
path = "/usr/local/icinga-mysql/var/rw/icinga.cmd"
|
||||
|
|
|
@ -402,7 +402,7 @@ class Form extends Zend_Form
|
|||
foreach ($triggerElements as $elementName) {
|
||||
$element = $this->getElement($elementName);
|
||||
if ($element !== null) {
|
||||
$element->setAttrib('onchange', 'this.form.submit()');
|
||||
$element->setAttrib('onchange', '$(this.form).submit();');
|
||||
$element->setAttrib('data-icinga-form-autosubmit', true);
|
||||
} else {
|
||||
throw new ProgrammingError(
|
||||
|
|
|
@ -94,6 +94,40 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
|
|||
return $form;
|
||||
}
|
||||
|
||||
public function toggleSubmitForm($label, $checkValue, $enabledCommand, $disabledCommand, array $arguments = array())
|
||||
{
|
||||
if ($checkValue === '1') {
|
||||
$commandName = $disabledCommand;
|
||||
} else {
|
||||
$commandName = $enabledCommand;
|
||||
}
|
||||
|
||||
$form = $this->simpleForm($commandName, $arguments);
|
||||
$form->setAttrib('class', 'pull-right');
|
||||
|
||||
$uniqueName = uniqid('check');
|
||||
|
||||
$checkBox = new Zend_Form_Element_Checkbox($uniqueName);
|
||||
|
||||
if ($checkValue === '1') {
|
||||
$checkBox->setChecked(true);
|
||||
}
|
||||
|
||||
$form->addElement($checkBox);
|
||||
$form->enableAutoSubmit(array($uniqueName));
|
||||
|
||||
$checkBox->setDecorators(array('ViewHelper'));
|
||||
$checkBox->setAttrib('class', '');
|
||||
$checkBox->setAttrib('id', $uniqueName);
|
||||
|
||||
$submit_identifier = new Zend_Form_Element_Hidden('btn_submit');
|
||||
$submit_identifier->setValue('1');
|
||||
$form->addElement($submit_identifier);
|
||||
$form->getElement('btn_submit')->setDecorators(array('ViewHelper'));
|
||||
|
||||
return '<label class="label-horizontal" for="' . $uniqueName . '">' . $label . '</label>' . $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges css class names together
|
||||
*
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
$rv = $this->runtimevariables;
|
||||
$ps = $this->programstatus;
|
||||
|
||||
$cp = $this->checkPerformance()->create($this->checkperformance);
|
||||
/** @var Zend_View_Helper_CommandForm $ch */
|
||||
$ch = $this->getHelper('CommandForm');
|
||||
?>
|
||||
<h1>Process Information</h1>
|
||||
|
||||
|
@ -180,6 +181,195 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<h6>Global commands goes here</h6>
|
||||
<h4>Commands</h4>
|
||||
|
||||
<?=
|
||||
$ch->labelSubmitForm(
|
||||
'Shutdown monitoring process',
|
||||
'Shutdown the monitoring process',
|
||||
'btn-cta',
|
||||
'shutdownprocess'
|
||||
);
|
||||
?>
|
||||
|
||||
<br />
|
||||
|
||||
<?=
|
||||
$ch->labelSubmitForm(
|
||||
'Restart monitoring process',
|
||||
'Restart the monitoring process',
|
||||
'btn-cta',
|
||||
'restartprocess'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php if ($ps->notifications_enabled === '1'): ?>
|
||||
|
||||
<br />
|
||||
|
||||
<a
|
||||
href="<?= $this->href('monitoring/command/disablenotificationswithexpire'); ?>"
|
||||
class="button btn-cta btn-full-width">
|
||||
Dislable notification with expire
|
||||
</a>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<br />
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Notifications enabled',
|
||||
$ps->notifications_enabled,
|
||||
'enablenotifications',
|
||||
'disablenotifications',
|
||||
array(
|
||||
'global' => '1'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Execute active service checks',
|
||||
$ps->active_service_checks_enabled,
|
||||
'enableactivechecks',
|
||||
'disableactivechecks',
|
||||
array(
|
||||
'global' => 'service'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Accept passive service checks',
|
||||
$ps->passive_service_checks_enabled,
|
||||
'startacceptingpassivechecks',
|
||||
'stopacceptingpassivechecks',
|
||||
array(
|
||||
'global' => 'service'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Execute active host checks',
|
||||
$ps->active_host_checks_enabled,
|
||||
'enableactivechecks',
|
||||
'disableactivechecks',
|
||||
array(
|
||||
'global' => 'host'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Accept passive host checks',
|
||||
$ps->passive_host_checks_enabled,
|
||||
'startacceptingpassivechecks',
|
||||
'stopacceptingpassivechecks',
|
||||
array(
|
||||
'global' => 'host'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Eventhandlers enabled',
|
||||
$ps->event_handlers_enabled,
|
||||
'enableeventhandler',
|
||||
'disableeventhandler',
|
||||
array(
|
||||
'global' => '1'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Obsessing over host checks',
|
||||
$ps->obsess_over_hosts,
|
||||
'startobsessing',
|
||||
'stopobsessing',
|
||||
array(
|
||||
'global' => 'host'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Obsessing over service checks',
|
||||
$ps->obsess_over_services,
|
||||
'startobsessing',
|
||||
'stopobsessing',
|
||||
array(
|
||||
'global' => 'service'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Flap detection enabled',
|
||||
$ps->flap_detection_enabled,
|
||||
'enableflapdetection',
|
||||
'disableflapdetection',
|
||||
array(
|
||||
'global' => '1'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=
|
||||
$ch->toggleSubmitForm(
|
||||
'Process performance data',
|
||||
$ps->process_performance_data,
|
||||
'enableperformancedata',
|
||||
'disableperformancedata',
|
||||
array(
|
||||
'global' => '1'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
|
@ -84,6 +84,11 @@ p {
|
|||
Common elements
|
||||
========================================================================= */
|
||||
|
||||
.label-horizontal {
|
||||
display: inline;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.inline-image {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
|
@ -126,6 +131,7 @@ a {
|
|||
|
||||
a.button {
|
||||
height: 30px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
a.btn-small {
|
||||
|
|
|
@ -52,13 +52,13 @@ define(['components/app/container', 'jquery'], function(Container, $) {
|
|||
* @param {Event} e
|
||||
*/
|
||||
var submitHandler = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var form = $(this);
|
||||
var url = form.attr('action');
|
||||
var submit = form.find('button[type="submit"]', 'input[type="submit"]');
|
||||
var data = form.serialize();
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
// Submit name is missing for valid submission
|
||||
if (data) {
|
||||
data += '&';
|
||||
|
|
Loading…
Reference in New Issue