IcingaTimePeriod: fix config errors at deploy time
This commit is contained in:
parent
ce7b6031ff
commit
c7cba66c83
|
@ -38,10 +38,20 @@ class IcingaTimePeriodForm extends DirectorObjectForm
|
|||
'description' => $this->translate('the display name')
|
||||
));
|
||||
|
||||
$this->addElement('text', 'update_method', array(
|
||||
'label' => $this->translate('Update Method'),
|
||||
'description' => $this->translate('the update method'),
|
||||
));
|
||||
if ($this->isTemplate()) {
|
||||
$this->addElement('text', 'update_method', array(
|
||||
'label' => $this->translate('Update Method'),
|
||||
'description' => $this->translate('the update method'),
|
||||
'value' => 'LegacyTimePeriod',
|
||||
));
|
||||
|
||||
} else {
|
||||
// TODO: I'd like to skip this for objects inheriting from a template
|
||||
// with a defined update_method. However, unfortunately it's too
|
||||
// early for $this->object()->getResolvedProperty('update_method').
|
||||
// Should be fixed.
|
||||
$this->addHidden('update_method', 'LegacyTimePeriod');
|
||||
}
|
||||
|
||||
$this->addImportsElement();
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
|
||||
class IcingaTimePeriod extends IcingaObject
|
||||
{
|
||||
protected $table = 'icinga_timeperiod';
|
||||
|
@ -19,4 +21,18 @@ class IcingaTimePeriod extends IcingaObject
|
|||
protected $supportsImports = true;
|
||||
|
||||
protected $supportsRanges = true;
|
||||
|
||||
/**
|
||||
* Render update property
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderUpdate_method()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return c::renderKeyValue('update', $this->update_method);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue