IcingaHostGroup: Add apply statements
This commit is contained in:
parent
29231ef8c8
commit
a90595a004
|
@ -18,5 +18,18 @@ class IcingaHostGroupForm extends DirectorObjectForm
|
|||
|
||||
$this->addGroupDisplayNameElement()
|
||||
->setButtons();
|
||||
$this->addAssignmentElements();
|
||||
}
|
||||
|
||||
public function addAssignmentElements()
|
||||
{
|
||||
$sub = new AssignListSubForm();
|
||||
$sub->setObject($this->object());
|
||||
$sub->setup();
|
||||
$sub->setOrder(30);
|
||||
|
||||
$this->addSubForm($sub, 'assignlist');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,7 @@ namespace Icinga\Module\Director\Objects;
|
|||
class IcingaHostGroup extends IcingaObjectGroup
|
||||
{
|
||||
protected $table = 'icinga_hostgroup';
|
||||
|
||||
// TODO: move to IcingaObjectGroup when supported for ServiceGroup
|
||||
protected $supportsApplyRules = true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
class IcingaHostGroupAssignment extends IcingaObject
|
||||
{
|
||||
protected $table = 'icinga_hostgroup_assignment';
|
||||
|
||||
protected $keyName = 'id';
|
||||
|
||||
protected $defaultProperties = array(
|
||||
'id' => null,
|
||||
'service_id' => null,
|
||||
'filter_string' => null,
|
||||
);
|
||||
|
||||
protected $relations = array(
|
||||
'service' => 'IcingaHostGroup',
|
||||
);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
CREATE TABLE icinga_hostgroup_assignment (
|
||||
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
hostgroup_id INT(10) UNSIGNED NOT NULL,
|
||||
filter_string TEXT NOT NULL,
|
||||
assign_type ENUM('assign', 'ignore') NOT NULL DEFAULT 'assign',
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_hostgroup_assignment
|
||||
FOREIGN KEY hostgroup (hostgroup_id)
|
||||
REFERENCES icinga_hostgroup (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (109, NOW());
|
|
@ -700,6 +700,19 @@ CREATE TABLE icinga_hostgroup_inheritance (
|
|||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE icinga_hostgroup_assignment (
|
||||
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
hostgroup_id INT(10) UNSIGNED NOT NULL,
|
||||
filter_string TEXT NOT NULL,
|
||||
assign_type ENUM('assign', 'ignore') NOT NULL DEFAULT 'assign',
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_hostgroup_assignment
|
||||
FOREIGN KEY hostgroup (hostgroup_id)
|
||||
REFERENCES icinga_hostgroup (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE icinga_servicegroup (
|
||||
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
|
||||
object_name VARCHAR(255) DEFAULT NULL,
|
||||
|
@ -1313,4 +1326,4 @@ CREATE TABLE sync_run (
|
|||
|
||||
INSERT INTO director_schema_migration
|
||||
SET migration_time = NOW(),
|
||||
schema_version = 108;
|
||||
schema_version = 109;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
CREATE TABLE icinga_hostgroup_assignment (
|
||||
id bigserial,
|
||||
hostgroup_id integer NOT NULL,
|
||||
filter_string TEXT NOT NULL,
|
||||
assign_type enum_assign_type NOT NULL DEFAULT 'assign',
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_hostgroup_assignment
|
||||
FOREIGN KEY (hostgroup_id)
|
||||
REFERENCES icinga_hostgroup (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (109, NOW());
|
|
@ -877,6 +877,18 @@ CREATE UNIQUE INDEX hostgroup_inheritance_unique_order ON icinga_hostgroup_inher
|
|||
CREATE INDEX hostgroup_inheritance_hostgroup ON icinga_hostgroup_inheritance (hostgroup_id);
|
||||
CREATE INDEX hostgroup_inheritance_hostgroup_parent ON icinga_hostgroup_inheritance (parent_hostgroup_id);
|
||||
|
||||
CREATE TABLE icinga_hostgroup_assignment (
|
||||
id bigserial,
|
||||
hostgroup_id integer NOT NULL,
|
||||
filter_string TEXT NOT NULL,
|
||||
assign_type enum_assign_type NOT NULL DEFAULT 'assign',
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_hostgroup_assignment
|
||||
FOREIGN KEY (hostgroup_id)
|
||||
REFERENCES icinga_hostgroup (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
CREATE TABLE icinga_servicegroup (
|
||||
id serial,
|
||||
|
@ -1533,4 +1545,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
|
|||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (107, NOW());
|
||||
VALUES (109, NOW());
|
||||
|
|
Loading…
Reference in New Issue