IcingaZone: add support for global zones
This commit is contained in:
parent
4094794743
commit
b26172e0e9
|
@ -23,6 +23,16 @@ class IcingaZoneForm extends DirectorObjectForm
|
|||
'description' => $this->translate('Name for the Icinga zone (templat) you are going to create')
|
||||
));
|
||||
|
||||
$this->addElement('select', 'is_global', array(
|
||||
'label' => 'Global zone',
|
||||
'description' => 'Whether this zone should be available everywhere',
|
||||
'multiOptions' => array(
|
||||
'n' => $this->translate('No'),
|
||||
'y' => $this->translate('Yes'),
|
||||
),
|
||||
'required' => true,
|
||||
));
|
||||
|
||||
$this->addElement('select', 'parent_zone_id', array(
|
||||
'label' => $this->translate('Parent Zone'),
|
||||
'description' => $this->translate('Chose an (optional) parent zone')
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
|
||||
class IcingaZone extends IcingaObject
|
||||
{
|
||||
protected $table = 'icinga_zone';
|
||||
|
@ -11,10 +13,21 @@ class IcingaZone extends IcingaObject
|
|||
'object_name' => null,
|
||||
'object_type' => null,
|
||||
'parent_zone_id' => null,
|
||||
'is_global' => 'n',
|
||||
);
|
||||
|
||||
protected function renderParent_zone_id()
|
||||
{
|
||||
return $this->renderZoneProperty($this->parent_zone_id, 'parent_zone');
|
||||
}
|
||||
|
||||
protected function renderIs_global()
|
||||
{
|
||||
// Global is a reserved word in SQL, column name was prefixed
|
||||
if ($this->is_global === 'y') {
|
||||
return c::renderKeyValue('global', c::renderBoolean($this->is_global));
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE icinga_zone ADD is_global ENUM('y', 'n') NOT NULL DEFAULT 'n' AFTER object_type;
|
|
@ -126,6 +126,7 @@ CREATE TABLE icinga_zone (
|
|||
parent_zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
object_name VARCHAR(255) NOT NULL,
|
||||
object_type ENUM('object', 'template') NOT NULL,
|
||||
is_global ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX object_name (object_name),
|
||||
CONSTRAINT icinga_zone_parent_zone
|
||||
|
|
Loading…
Reference in New Issue