Don't offer disable notifications w/ expire time if backend is Icinga 2

resolves #11529
This commit is contained in:
Eric Lippmann 2016-04-11 10:51:37 +02:00
parent b783b0c44c
commit 05f752ecd8
1 changed files with 19 additions and 16 deletions

View File

@ -58,6 +58,10 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
*/ */
public function createElements(array $formData = array()) public function createElements(array $formData = array())
{ {
$notificationDescription = null;
$isIcinga2 = $this->getBackend()->isIcinga2($this->status->program_version);
if (! $isIcinga2) {
if ((bool) $this->status->notifications_enabled) { if ((bool) $this->status->notifications_enabled) {
if ($this->hasPermission('monitoring/command/feature/instance')) { if ($this->hasPermission('monitoring/command/feature/instance')) {
$notificationDescription = sprintf( $notificationDescription = sprintf(
@ -74,8 +78,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
$this->translate('Notifications will be re-enabled in <strong>%s</strong>'), $this->translate('Notifications will be re-enabled in <strong>%s</strong>'),
$this->getView()->timeUntil($this->status->disable_notif_expire_time) $this->getView()->timeUntil($this->status->disable_notif_expire_time)
); );
} else { }
$notificationDescription = null;
} }
$toggleDisabled = $this->hasPermission('monitoring/command/feature/instance') ? null : ''; $toggleDisabled = $this->hasPermission('monitoring/command/feature/instance') ? null : '';
@ -138,7 +141,7 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
) )
); );
if (! $this->getBackend()->isIcinga2($this->status->program_version)) { if (! $isIcinga2) {
$this->addElement( $this->addElement(
'checkbox', 'checkbox',
ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING, ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING,