mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
Add support for 'Dependency Redundancy Groups'
This commit is contained in:
parent
de8fe109e2
commit
01c6c0cff8
@ -356,6 +356,18 @@ class SuggestController extends ActionController
|
||||
return $this->fetchTemplateNames('icinga_dependency');
|
||||
}
|
||||
|
||||
protected function suggestDependencyRedundancyGroups()
|
||||
{
|
||||
$db = $this->db()->getDbAdapter();
|
||||
$query = $db->select()
|
||||
->distinct()
|
||||
->from('icinga_dependency', 'redundancy_group')
|
||||
->where('redundancy_group IS NOT NULL')
|
||||
->order('redundancy_group');
|
||||
|
||||
return $db->fetchCol($query);
|
||||
}
|
||||
|
||||
protected function highlight($val, $search)
|
||||
{
|
||||
$search = ($search);
|
||||
|
@ -303,6 +303,20 @@ class IcingaDependencyForm extends DirectorObjectForm
|
||||
}
|
||||
}
|
||||
|
||||
$redundancyGroup = $dependency->get('redundancy_group');
|
||||
$this->addElement('text', 'redundancy_group', [
|
||||
'label' => $this->translate('Redundancy Group'),
|
||||
'description' => $this->translate(
|
||||
'The dependency redundancy group. A name for a group of which'
|
||||
. ' at least one single dependency must be fulfilled for the'
|
||||
. ' whole dependency to be fulfilled.'
|
||||
),
|
||||
'class' => "director-suggest",
|
||||
'data-suggestion-context' => 'dependencyredundancygroups',
|
||||
'required' => false,
|
||||
'value' => $redundancyGroup
|
||||
]);
|
||||
|
||||
$elements = ['parent_host', 'child_host', 'parent_service', 'child_service'];
|
||||
$this->addDisplayGroup($elements, 'related_objects', [
|
||||
'decorators' => [
|
||||
|
@ -29,6 +29,7 @@ class IcingaDependency extends IcingaObject implements ExportInterface
|
||||
'ignore_soft_states' => null,
|
||||
'period_id' => null,
|
||||
'zone_id' => null,
|
||||
'redundancy_group' => null,
|
||||
'assign_filter' => null,
|
||||
'parent_service_by_name' => null,
|
||||
];
|
||||
|
@ -553,6 +553,7 @@ abstract class DirectorObjectForm extends DirectorForm
|
||||
'email',
|
||||
'pager',
|
||||
'enable_notifications',
|
||||
'redundancy_group', //Dependencies
|
||||
'disable_checks', //Dependencies
|
||||
'disable_notifications',
|
||||
'ignore_soft_states',
|
||||
|
6
schema/mysql-migrations/upgrade_189.sql
Normal file
6
schema/mysql-migrations/upgrade_189.sql
Normal file
@ -0,0 +1,6 @@
|
||||
ALTER TABLE icinga_dependency ADD COLUMN redundancy_group VARCHAR(255) DEFAULT NULL AFTER parent_service_by_name;
|
||||
ALTER TABLE branched_icinga_dependency ADD COLUMN redundancy_group VARCHAR(255) DEFAULT NULL AFTER parent_service_by_name;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (189, NOW());
|
@ -1774,6 +1774,7 @@ CREATE TABLE icinga_dependency (
|
||||
zone_id INT(10) UNSIGNED DEFAULT NULL,
|
||||
assign_filter TEXT DEFAULT NULL,
|
||||
parent_service_by_name VARCHAR(255) DEFAULT NULL,
|
||||
redundancy_group VARCHAR(255) DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX uuid (uuid),
|
||||
CONSTRAINT icinga_dependency_parent_host
|
||||
@ -2431,6 +2432,7 @@ CREATE TABLE branched_icinga_dependency (
|
||||
zone VARCHAR(255) DEFAULT NULL,
|
||||
assign_filter TEXT DEFAULT NULL,
|
||||
parent_service_by_name VARCHAR(255) DEFAULT NULL,
|
||||
redundancy_group VARCHAR(255) DEFAULT NULL,
|
||||
|
||||
imports TEXT DEFAULT NULL,
|
||||
set_null TEXT DEFAULT NULL,
|
||||
@ -2446,4 +2448,4 @@ CREATE TABLE branched_icinga_dependency (
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (187, NOW());
|
||||
VALUES (189, NOW());
|
||||
|
@ -1,6 +0,0 @@
|
||||
DROP INDEX IF EXISTS import_row_modifier_prio;
|
||||
DROP INDEX IF EXISTS service_branch_object_name;
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (188, NOW());
|
6
schema/pgsql-migrations/upgrade_189.sql
Normal file
6
schema/pgsql-migrations/upgrade_189.sql
Normal file
@ -0,0 +1,6 @@
|
||||
ALTER TABLE icinga_dependency ADD COLUMN redundancy_group character varying(255);
|
||||
ALTER TABLE branched_icinga_dependency ADD COLUMN redundancy_group character varying(255);
|
||||
|
||||
INSERT INTO director_schema_migration
|
||||
(schema_version, migration_time)
|
||||
VALUES (189, NOW());
|
@ -2059,6 +2059,7 @@ CREATE TABLE icinga_dependency (
|
||||
zone_id integer DEFAULT NULL,
|
||||
assign_filter text DEFAULT NULL,
|
||||
parent_service_by_name character varying(255),
|
||||
redundancy_group character varying(255),
|
||||
PRIMARY KEY (id),
|
||||
CONSTRAINT icinga_dependency_parent_host
|
||||
FOREIGN KEY (parent_host_id)
|
||||
@ -2764,6 +2765,7 @@ CREATE TABLE branched_icinga_dependency (
|
||||
zone_id integer DEFAULT NULL,
|
||||
assign_filter text DEFAULT NULL,
|
||||
parent_service_by_name character varying(255),
|
||||
redundancy_group character varying(255),
|
||||
|
||||
imports TEXT DEFAULT NULL,
|
||||
set_null TEXT DEFAULT NULL,
|
||||
@ -2781,4 +2783,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