mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Merge branch 'bugfix/disable-downtimes-for-child-hosts-w-icinga2-10774'
refs #10744
This commit is contained in:
commit
7bafab2c68
@ -153,6 +153,7 @@ class HostController extends MonitoredObjectController
|
|||||||
$this->assertPermission('monitoring/command/downtime/schedule');
|
$this->assertPermission('monitoring/command/downtime/schedule');
|
||||||
|
|
||||||
$form = new ScheduleHostDowntimeCommandForm();
|
$form = new ScheduleHostDowntimeCommandForm();
|
||||||
|
$form->setBackend($this->backend);
|
||||||
$form->setTitle($this->translate('Schedule Host Downtime'));
|
$form->setTitle($this->translate('Schedule Host Downtime'));
|
||||||
$this->handleCommandForm($form);
|
$this->handleCommandForm($form);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
|||||||
public function createElements(array $formData = array())
|
public function createElements(array $formData = array())
|
||||||
{
|
{
|
||||||
parent::createElements($formData);
|
parent::createElements($formData);
|
||||||
$this->addElements(array(
|
|
||||||
array(
|
$this->addElement(
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'all_services',
|
'all_services',
|
||||||
array(
|
array(
|
||||||
@ -31,8 +31,10 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
|||||||
'label' => $this->translate('All Services'),
|
'label' => $this->translate('All Services'),
|
||||||
'value' => false
|
'value' => false
|
||||||
)
|
)
|
||||||
),
|
);
|
||||||
array(
|
|
||||||
|
if (substr($this->getBackend()->getProgramVersion(), 0, 2) !== 'v2') {
|
||||||
|
$this->addElement(
|
||||||
'select',
|
'select',
|
||||||
'child_hosts',
|
'child_hosts',
|
||||||
array(
|
array(
|
||||||
@ -47,8 +49,9 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
|||||||
),
|
),
|
||||||
'value' => 0
|
'value' => 0
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
));
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +63,11 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
|
|||||||
{
|
{
|
||||||
foreach ($this->objects as $object) {
|
foreach ($this->objects as $object) {
|
||||||
/** @var \Icinga\Module\Monitoring\Object\Host $object */
|
/** @var \Icinga\Module\Monitoring\Object\Host $object */
|
||||||
$childHosts = (int) $this->getElement('child_hosts')->getValue();
|
if (($childHostsEl = $this->getElement('child_hosts')) !== null) {
|
||||||
|
$childHosts = (int) $childHostsEl->getValue();
|
||||||
|
} else {
|
||||||
|
$childHosts = 0;
|
||||||
|
}
|
||||||
$allServices = $this->getElement('all_services')->isChecked();
|
$allServices = $this->getElement('all_services')->isChecked();
|
||||||
if ($childHosts === 0) {
|
if ($childHosts === 0) {
|
||||||
$hostDowntime = new ScheduleHostDowntimeCommand();
|
$hostDowntime = new ScheduleHostDowntimeCommand();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user