Add imports support for Zone

This commit is contained in:
Alexander Fuhr 2015-06-29 10:46:32 +02:00
parent cdb66b648a
commit 61812d6115
6 changed files with 84 additions and 0 deletions

View File

@ -37,5 +37,10 @@ class IcingaZoneForm extends DirectorObjectForm
'label' => $this->translate('Parent Zone'),
'description' => $this->translate('Chose an (optional) parent zone')
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited zone template names')
));
}
}

View File

@ -16,6 +16,8 @@ class IcingaZone extends IcingaObject
'is_global' => 'n',
);
protected $supportsImports = true;
protected function renderParent_zone_id()
{
return $this->renderZoneProperty($this->parent_zone_id, 'parent_zone');

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_zone_inheritance (
zone_id INT(10) UNSIGNED NOT NULL,
parent_zone_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (zone_id, parent_zone_id),
UNIQUE KEY unique_order (zone_id, weight),
CONSTRAINT icinga_zone_inheritance_zone
FOREIGN KEY zone (zone_id)
REFERENCES icinga_zone (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_zone_inheritance_parent_zone
FOREIGN KEY zone (parent_zone_id)
REFERENCES icinga_zone (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -136,6 +136,24 @@ CREATE TABLE icinga_zone (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_zone_inheritance (
zone_id INT(10) UNSIGNED NOT NULL,
parent_zone_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (zone_id, parent_zone_id),
UNIQUE KEY unique_order (zone_id, weight),
CONSTRAINT icinga_zone_inheritance_zone
FOREIGN KEY zone (zone_id)
REFERENCES icinga_zone (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_zone_inheritance_parent_zone
FOREIGN KEY zone (parent_zone_id)
REFERENCES icinga_zone (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_timeperiod (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(255) NOT NULL,

View File

@ -0,0 +1,20 @@
CREATE TABLE icinga_zone_inheritance (
zone_id integer NOT NULL,
parent_zone_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (zone_id, parent_zone_id),
CONSTRAINT icinga_zone_inheritance_zone
FOREIGN KEY (zone_id)
REFERENCES icinga_zone (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_zone_inheritance_parent_zone
FOREIGN KEY (parent_zone_id)
REFERENCES icinga_zone (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX zone_inheritance_unique_order ON icinga_zone_inheritance (zone_id, weight);
CREATE INDEX zone_inheritance_zone ON icinga_zone_inheritance (zone_id);
CREATE INDEX zone_inheritance_zone_parent ON icinga_zone_inheritance (parent_zone_id);

View File

@ -177,6 +177,28 @@ CREATE TABLE icinga_zone (
CREATE INDEX zone_parent ON icinga_zone (parent_zone_id);
CREATE TABLE icinga_zone_inheritance (
zone_id integer NOT NULL,
parent_zone_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (zone_id, parent_zone_id),
CONSTRAINT icinga_zone_inheritance_zone
FOREIGN KEY (zone_id)
REFERENCES icinga_zone (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_zone_inheritance_parent_zone
FOREIGN KEY (parent_zone_id)
REFERENCES icinga_zone (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX zone_inheritance_unique_order ON icinga_zone_inheritance (zone_id, weight);
CREATE INDEX zone_inheritance_zone ON icinga_zone_inheritance (zone_id);
CREATE INDEX zone_inheritance_zone_parent ON icinga_zone_inheritance (parent_zone_id);
CREATE TABLE icinga_timeperiod (
id serial,
object_name character varying(255) NOT NULL,