mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
parent
85cda6da9b
commit
cc9f5037f4
@ -41,6 +41,24 @@ class IcingaNotificationForm extends DirectorObjectForm
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'select',
|
||||||
|
'apply_to',
|
||||||
|
array(
|
||||||
|
'label' => $this->translate('Apply to'),
|
||||||
|
'description' => $this->translate(
|
||||||
|
'Whether this notification should affect hosts or services'
|
||||||
|
),
|
||||||
|
'required' => true,
|
||||||
|
'multiOptions' => $this->optionalEnum(
|
||||||
|
array(
|
||||||
|
'host' => $this->translate('Hosts'),
|
||||||
|
'service' => $this->translate('Services'),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$sub = new AssignListSubForm();
|
$sub = new AssignListSubForm();
|
||||||
$sub->setObject($this->getObject());
|
$sub->setObject($this->getObject());
|
||||||
$sub->setup();
|
$sub->setup();
|
||||||
|
@ -111,6 +111,43 @@ class IcingaNotification extends IcingaObject
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not render internal property apply_to
|
||||||
|
*
|
||||||
|
* Avoid complaints for method names with underscore:
|
||||||
|
* @codingStandardsIgnoreStart
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function renderApply_to()
|
||||||
|
{
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderObjectHeader()
|
||||||
|
{
|
||||||
|
if ($this->isApplyRule()) {
|
||||||
|
if (($to = $this->get('apply_to')) === null) {
|
||||||
|
throw new ConfigurationError(
|
||||||
|
'Applied notification "%s" has no valid object type',
|
||||||
|
$this->getObjectName()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
"%s %s to %s %s {\n",
|
||||||
|
$this->getObjectTypeName(),
|
||||||
|
$this->getType(),
|
||||||
|
ucfirst($to),
|
||||||
|
c::renderString($this->getObjectName())
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return parent::renderObjectHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function setKey($key)
|
protected function setKey($key)
|
||||||
{
|
{
|
||||||
if (is_int($key)) {
|
if (is_int($key)) {
|
||||||
|
@ -493,6 +493,7 @@ abstract class DirectorObjectForm extends QuickForm
|
|||||||
'groups',
|
'groups',
|
||||||
'users',
|
'users',
|
||||||
'user_groups',
|
'user_groups',
|
||||||
|
'apply_to',
|
||||||
'command_id', // Notification
|
'command_id', // Notification
|
||||||
'notification_interval',
|
'notification_interval',
|
||||||
'period_id',
|
'period_id',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user