mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaScheduledDowntimeForm: assignment elements
This commit is contained in:
parent
2b8d2b4569
commit
6f790dd118
@ -49,6 +49,50 @@ class IcingaScheduledDowntimeForm extends DirectorObjectForm
|
|||||||
'required' => ! $this->isTemplate(),
|
'required' => ! $this->isTemplate(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$this->addAssignmentElements();
|
||||||
$this->setButtons();
|
$this->setButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
* @throws \Zend_Form_Exception
|
||||||
|
*/
|
||||||
|
protected function addAssignmentElements()
|
||||||
|
{
|
||||||
|
if ($this->isTemplate()) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addElement('select', 'apply_to', [
|
||||||
|
'label' => $this->translate('Apply to'),
|
||||||
|
'description' => $this->translate(
|
||||||
|
'Whether this dependency should affect hosts or services'
|
||||||
|
),
|
||||||
|
'required' => true,
|
||||||
|
'class' => 'autosubmit',
|
||||||
|
'multiOptions' => $this->optionalEnum([
|
||||||
|
'host' => $this->translate('Hosts'),
|
||||||
|
'service' => $this->translate('Services'),
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
|
||||||
|
$applyTo = $this->getSentOrObjectValue('apply_to');
|
||||||
|
|
||||||
|
if (! $applyTo) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$suggestionContext = ucfirst($applyTo) . 'FilterColumns';
|
||||||
|
$this->addAssignFilter([
|
||||||
|
'suggestionContext' => $suggestionContext,
|
||||||
|
'required' => true,
|
||||||
|
'description' => $this->translate(
|
||||||
|
'This allows you to configure an assignment filter. Please feel'
|
||||||
|
. ' free to combine as many nested operators as you want'
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ class IcingaScheduledDowntime extends IcingaObject
|
|||||||
'comment' => null,
|
'comment' => null,
|
||||||
'fixed' => null,
|
'fixed' => null,
|
||||||
'duration' => null,
|
'duration' => null,
|
||||||
|
'apply_to' => null,
|
||||||
'assign_filter' => null,
|
'assign_filter' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user