mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 17:24:18 +02:00
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')
|
'description' => $this->translate('the display name')
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('text', 'update_method', array(
|
if ($this->isTemplate()) {
|
||||||
'label' => $this->translate('Update Method'),
|
$this->addElement('text', 'update_method', array(
|
||||||
'description' => $this->translate('the update method'),
|
'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();
|
$this->addImportsElement();
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
|
|
||||||
class IcingaTimePeriod extends IcingaObject
|
class IcingaTimePeriod extends IcingaObject
|
||||||
{
|
{
|
||||||
protected $table = 'icinga_timeperiod';
|
protected $table = 'icinga_timeperiod';
|
||||||
@ -19,4 +21,18 @@ class IcingaTimePeriod extends IcingaObject
|
|||||||
protected $supportsImports = true;
|
protected $supportsImports = true;
|
||||||
|
|
||||||
protected $supportsRanges = 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…
x
Reference in New Issue
Block a user