diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php index 003f3f0aa..d1f43972a 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php @@ -34,24 +34,22 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm ) ); - if (! $this->getBackend()->isIcinga2()) { - $this->addElement( - 'select', - 'child_hosts', - array( - 'description' => $this->translate( - 'Define what should be done with the child hosts of the hosts.' - ), - 'label' => $this->translate('Child Hosts'), - 'multiOptions' => array( - 0 => $this->translate('Do nothing with child hosts'), - 1 => $this->translate('Schedule triggered downtime for all child hosts'), - 2 => $this->translate('Schedule non-triggered downtime for all child hosts') - ), - 'value' => 0 - ) - ); - } + $this->addElement( + 'select', + 'child_hosts', + array( + 'description' => $this->translate( + 'Define what should be done with the child hosts of the hosts.' + ), + 'label' => $this->translate('Child Hosts'), + 'multiOptions' => array( + 0 => $this->translate('Do nothing with child hosts'), + 1 => $this->translate('Schedule triggered downtime for all child hosts'), + 2 => $this->translate('Schedule non-triggered downtime for all child hosts') + ), + 'value' => 0 + ) + ); return $this; } diff --git a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php index cb346bca5..7f6b2956f 100644 --- a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php +++ b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaApiCommandRenderer.php @@ -10,6 +10,7 @@ use Icinga\Module\Monitoring\Command\Object\AddCommentCommand; use Icinga\Module\Monitoring\Command\Object\DeleteCommentCommand; use Icinga\Module\Monitoring\Command\Object\DeleteDowntimeCommand; use Icinga\Module\Monitoring\Command\Object\ProcessCheckResultCommand; +use Icinga\Module\Monitoring\Command\Object\PropagateHostDowntimeCommand; use Icinga\Module\Monitoring\Command\Object\RemoveAcknowledgementCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceDowntimeCommand; @@ -148,6 +149,12 @@ class IcingaApiCommandRenderer implements IcingaCommandRendererInterface 'fixed' => $command->getFixed(), 'trigger_name' => $command->getTriggerId() ); + if ($command->getObject()->getType() === $command::TYPE_HOST + && $command instanceof PropagateHostDowntimeCommand + ) { + /** @var \Icinga\Module\Monitoring\Command\Object\PropagateHostDowntimeCommand $command */ + $data['child_options'] = $command->getTriggered() ? 1 : 2; + } $this->applyFilter($data, $command->getObject()); return IcingaApiCommand::create($endpoint, $data); }