mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
Add zones to Hostgroups and Servicegroups
Correspondingly update DB schema and add migrations
This commit is contained in:
parent
4032d49553
commit
1e9a40e82e
@ -18,9 +18,25 @@ class IcingaHostGroupForm extends DirectorObjectForm
|
||||
|
||||
$this->addGroupDisplayNameElement()
|
||||
->addAssignmentElements()
|
||||
->addZoneElements()
|
||||
->setButtons();
|
||||
}
|
||||
|
||||
protected function addZoneElements()
|
||||
{
|
||||
$this->addZoneElement(true);
|
||||
$this->addDisplayGroup(['zone_id'], 'clustering', [
|
||||
'decorators' => [
|
||||
'FormElements',
|
||||
['HtmlTag', ['tag' => 'dl']],
|
||||
'Fieldset',
|
||||
],
|
||||
'order' => 80,
|
||||
'legend' => $this->translate('Zone settings'),
|
||||
]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function addAssignmentElements()
|
||||
{
|
||||
$this->addAssignFilter([
|
||||
|
@ -18,9 +18,25 @@ class IcingaServiceGroupForm extends DirectorObjectForm
|
||||
|
||||
$this->addGroupDisplayNameElement()
|
||||
->addAssignmentElements()
|
||||
->addZoneElements()
|
||||
->setButtons();
|
||||
}
|
||||
|
||||
protected function addZoneElements()
|
||||
{
|
||||
$this->addZoneElement(true);
|
||||
$this->addDisplayGroup(['zone_id'], 'clustering', [
|
||||
'decorators' => [
|
||||
'FormElements',
|
||||
['HtmlTag', ['tag' => 'dl']],
|
||||
'Fieldset',
|
||||
],
|
||||
'order' => 80,
|
||||
'legend' => $this->translate('Zone settings'),
|
||||
]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function addAssignmentElements()
|
||||
{
|
||||
$this->addAssignFilter([
|
||||
|
@ -6,6 +6,21 @@ class IcingaHostGroup extends IcingaObjectGroup
|
||||
{
|
||||
protected $table = 'icinga_hostgroup';
|
||||
|
||||
protected $defaultProperties = [
|
||||
'id' => null,
|
||||
'uuid' => null,
|
||||
'object_name' => null,
|
||||
'object_type' => null,
|
||||
'disabled' => 'n',
|
||||
'display_name' => null,
|
||||
'assign_filter' => null,
|
||||
'zone_id' => null,
|
||||
];
|
||||
|
||||
protected $relations = [
|
||||
'zone' => 'IcingaZone',
|
||||
];
|
||||
|
||||
/** @var HostGroupMembershipResolver */
|
||||
protected $hostgroupMembershipResolver;
|
||||
|
||||
|
@ -6,6 +6,21 @@ class IcingaServiceGroup extends IcingaObjectGroup
|
||||
{
|
||||
protected $table = 'icinga_servicegroup';
|
||||
|
||||
protected $defaultProperties = [
|
||||
'id' => null,
|
||||
'uuid' => null,
|
||||
'object_name' => null,
|
||||
'object_type' => null,
|
||||
'disabled' => 'n',
|
||||
'display_name' => null,
|
||||
'assign_filter' => null,
|
||||
'zone_id' => null,
|
||||
];
|
||||
|
||||
protected $relations = [
|
||||
'zone' => 'IcingaZone',
|
||||
];
|
||||
|
||||
/** @var ServiceGroupMembershipResolver */
|
||||
protected $servicegroupMembershipResolver;
|
||||
|
||||
|
19
schema/mysql-migrations/upgrade_188.sql
Normal file
19
schema/mysql-migrations/upgrade_188.sql
Normal file
@ -0,0 +1,19 @@
|
||||
ALTER TABLE icinga_hostgroup
|
||||
ADD COLUMN zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD CONSTRAINT icinga_hostgroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_servicegroup
|
||||
ADD COLUMN zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD CONSTRAINT icinga_servicegroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (188, NOW());
|
@ -919,10 +919,16 @@ CREATE TABLE icinga_hostgroup (
|
||||
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||
display_name VARCHAR(255) DEFAULT NULL,
|
||||
assign_filter TEXT DEFAULT NULL,
|
||||
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX uuid (uuid),
|
||||
UNIQUE INDEX object_name (object_name),
|
||||
KEY search_idx (display_name)
|
||||
KEY search_idx (display_name),
|
||||
CONSTRAINT icinga_hostgroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- TODO: probably useless
|
||||
@ -952,10 +958,16 @@ CREATE TABLE icinga_servicegroup (
|
||||
disabled ENUM('y', 'n') NOT NULL DEFAULT 'n',
|
||||
display_name VARCHAR(255) DEFAULT NULL,
|
||||
assign_filter TEXT DEFAULT NULL,
|
||||
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX uuid (uuid),
|
||||
UNIQUE INDEX object_name (object_name),
|
||||
KEY search_idx (display_name)
|
||||
KEY search_idx (display_name),
|
||||
CONSTRAINT icinga_servicegroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE icinga_servicegroup_inheritance (
|
||||
@ -2446,4 +2458,4 @@ CREATE TABLE branched_icinga_dependency (
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (187, NOW());
|
||||
VALUES (188, NOW());
|
||||
|
19
schema/pgsql-migrations/upgrade_189.sql
Normal file
19
schema/pgsql-migrations/upgrade_189.sql
Normal file
@ -0,0 +1,19 @@
|
||||
ALTER TABLE icinga_hostgroup
|
||||
ADD COLUMN zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD CONSTRAINT icinga_hostgroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE icinga_servicegroup
|
||||
ADD COLUMN zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
ADD CONSTRAINT icinga_servicegroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (189, NOW());
|
@ -1115,7 +1115,13 @@ CREATE TABLE icinga_hostgroup (
|
||||
disabled enum_boolean NOT NULL DEFAULT 'n',
|
||||
display_name character varying(255) DEFAULT NULL,
|
||||
assign_filter text DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_hostgroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX hostgroup_object_name ON icinga_hostgroup (object_name);
|
||||
@ -1153,7 +1159,13 @@ CREATE TABLE icinga_servicegroup (
|
||||
disabled enum_boolean NOT NULL DEFAULT 'n',
|
||||
display_name character varying(255) DEFAULT NULL,
|
||||
assign_filter text DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_servicegroup_zone
|
||||
FOREIGN KEY zone (zone_id)
|
||||
REFERENCES icinga_zone (id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX servicegroup_object_name ON icinga_servicegroup (object_name);
|
||||
@ -2781,4 +2793,4 @@ CREATE INDEX branched_dependency_search_object_name ON branched_icinga_dependenc
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (187, NOW());
|
||||
VALUES (189, NOW());
|
||||
|
Loading…
x
Reference in New Issue
Block a user