mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
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')
|
'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(
|
$this->addElement('select', 'parent_zone_id', array(
|
||||||
'label' => $this->translate('Parent Zone'),
|
'label' => $this->translate('Parent Zone'),
|
||||||
'description' => $this->translate('Chose an (optional) parent zone')
|
'description' => $this->translate('Chose an (optional) parent zone')
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
|
|
||||||
class IcingaZone extends IcingaObject
|
class IcingaZone extends IcingaObject
|
||||||
{
|
{
|
||||||
protected $table = 'icinga_zone';
|
protected $table = 'icinga_zone';
|
||||||
@ -11,10 +13,21 @@ class IcingaZone extends IcingaObject
|
|||||||
'object_name' => null,
|
'object_name' => null,
|
||||||
'object_type' => null,
|
'object_type' => null,
|
||||||
'parent_zone_id' => null,
|
'parent_zone_id' => null,
|
||||||
|
'is_global' => 'n',
|
||||||
);
|
);
|
||||||
|
|
||||||
protected function renderParent_zone_id()
|
protected function renderParent_zone_id()
|
||||||
{
|
{
|
||||||
return $this->renderZoneProperty($this->parent_zone_id, 'parent_zone');
|
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 '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
schema/mysql-changes/upgrade_11.sql
Normal file
1
schema/mysql-changes/upgrade_11.sql
Normal file
@ -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,
|
parent_zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||||
object_name VARCHAR(255) NOT NULL,
|
object_name VARCHAR(255) NOT NULL,
|
||||||
object_type ENUM('object', 'template') NOT NULL,
|
object_type ENUM('object', 'template') NOT NULL,
|
||||||
|
is_global ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE INDEX object_name (object_name),
|
UNIQUE INDEX object_name (object_name),
|
||||||
CONSTRAINT icinga_zone_parent_zone
|
CONSTRAINT icinga_zone_parent_zone
|
||||||
|
Loading…
x
Reference in New Issue
Block a user