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,24 +58,27 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
*/
public function createElements(array $formData = array())
{
if ((bool) $this->status->notifications_enabled) {
if ($this->hasPermission('monitoring/command/feature/instance')) {
$notificationDescription = null;
$isIcinga2 = $this->getBackend()->isIcinga2($this->status->program_version);
if (! $isIcinga2) {
if ((bool) $this->status->notifications_enabled) {
if ($this->hasPermission('monitoring/command/feature/instance')) {
$notificationDescription = sprintf(
'<a aria-label="%1$s" class="action-link" title="%1$s" href="%2$s" data-base-target="_next">%3$s</a>',
$this->translate('Disable notifications for a specific time on a program-wide basis'),
$this->getView()->href('monitoring/health/disable-notifications'),
$this->translate('Disable temporarily')
);
} else {
$notificationDescription = null;
}
} elseif ($this->status->disable_notif_expire_time) {
$notificationDescription = sprintf(
'<a aria-label="%1$s" class="action-link" title="%1$s" href="%2$s" data-base-target="_next">%3$s</a>',
$this->translate('Disable notifications for a specific time on a program-wide basis'),
$this->getView()->href('monitoring/health/disable-notifications'),
$this->translate('Disable temporarily')
$this->translate('Notifications will be re-enabled in <strong>%s</strong>'),
$this->getView()->timeUntil($this->status->disable_notif_expire_time)
);
} else {
$notificationDescription = null;
}
} elseif ($this->status->disable_notif_expire_time) {
$notificationDescription = sprintf(
$this->translate('Notifications will be re-enabled in <strong>%s</strong>'),
$this->getView()->timeUntil($this->status->disable_notif_expire_time)
);
} else {
$notificationDescription = 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(
'checkbox',
ToggleInstanceFeatureCommand::FEATURE_HOST_OBSESSING,