ScheduledDowntimes: Hosts with Services, optional
schema, form, rendering fixes #1831
This commit is contained in:
parent
70618169f1
commit
904ec7c435
|
@ -93,6 +93,16 @@ class IcingaScheduledDowntimeForm extends DirectorObjectForm
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($applyTo === 'host') {
|
||||||
|
$this->addBoolean('with_services', [
|
||||||
|
'label' => $this->translate('With Services'),
|
||||||
|
'description' => $this->translate(
|
||||||
|
'Whether Downtimes should also explicitly be scheduled for'
|
||||||
|
. ' all Services belonging to affected Hosts'
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$suggestionContext = ucfirst($applyTo) . 'FilterColumns';
|
$suggestionContext = ucfirst($applyTo) . 'FilterColumns';
|
||||||
$this->addAssignFilter([
|
$this->addAssignFilter([
|
||||||
'suggestionContext' => $suggestionContext,
|
'suggestionContext' => $suggestionContext,
|
||||||
|
|
|
@ -21,6 +21,7 @@ class IcingaScheduledDowntime extends IcingaObject
|
||||||
'duration' => null,
|
'duration' => null,
|
||||||
'apply_to' => null,
|
'apply_to' => null,
|
||||||
'assign_filter' => null,
|
'assign_filter' => null,
|
||||||
|
'with_services' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $supportsImports = true;
|
protected $supportsImports = true;
|
||||||
|
@ -46,6 +47,7 @@ class IcingaScheduledDowntime extends IcingaObject
|
||||||
'apply_to',
|
'apply_to',
|
||||||
'object_name',
|
'object_name',
|
||||||
'object_type',
|
'object_type',
|
||||||
|
'with_services',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,8 +103,30 @@ class IcingaScheduledDowntime extends IcingaObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function renderSuffix()
|
||||||
|
{
|
||||||
|
if ($this->get('with_services') === 'y' && $this->get('apply_to') === 'host') {
|
||||||
|
return parent::renderSuffix() . $this->renderCloneForServices();
|
||||||
|
} else {
|
||||||
|
return parent::renderSuffix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function prefersGlobalZone()
|
protected function prefersGlobalZone()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function renderCloneForServices()
|
||||||
|
{
|
||||||
|
$services = clone($this);
|
||||||
|
$services
|
||||||
|
->set('with_services', 'n')
|
||||||
|
->set('apply_to', 'service');
|
||||||
|
|
||||||
|
return $services->toConfigString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE icinga_scheduled_downtime
|
||||||
|
ADD COLUMN with_services ENUM('y', 'n') NULL DEFAULT NULL;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (162, NOW());
|
|
@ -1798,6 +1798,7 @@ CREATE TABLE icinga_scheduled_downtime (
|
||||||
comment TEXT DEFAULT NULL,
|
comment TEXT DEFAULT NULL,
|
||||||
fixed ENUM('y', 'n') DEFAULT NULL,
|
fixed ENUM('y', 'n') DEFAULT NULL,
|
||||||
duration INT(10) UNSIGNED DEFAULT NULL,
|
duration INT(10) UNSIGNED DEFAULT NULL,
|
||||||
|
with_services ENUM('y', 'n') NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE INDEX object_name (object_name),
|
UNIQUE INDEX object_name (object_name),
|
||||||
CONSTRAINT icinga_scheduled_downtime_zone
|
CONSTRAINT icinga_scheduled_downtime_zone
|
||||||
|
@ -1843,4 +1844,4 @@ CREATE TABLE icinga_scheduled_downtime_range (
|
||||||
|
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
(schema_version, migration_time)
|
(schema_version, migration_time)
|
||||||
VALUES (161, NOW());
|
VALUES (162, NOW());
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE TABLE icinga_scheduled_downtime
|
||||||
|
ADD COLUMN with_services enum_boolean NULL DEFAULT NULL;
|
||||||
|
|
||||||
|
INSERT INTO director_schema_migration
|
||||||
|
(schema_version, migration_time)
|
||||||
|
VALUES (162, NOW());
|
|
@ -2098,6 +2098,7 @@ CREATE TABLE icinga_scheduled_downtime (
|
||||||
comment text DEFAULT NULL,
|
comment text DEFAULT NULL,
|
||||||
fixed enum_boolean DEFAULT NULL,
|
fixed enum_boolean DEFAULT NULL,
|
||||||
duration int DEFAULT NULL,
|
duration int DEFAULT NULL,
|
||||||
|
with_services enum_boolean NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
CONSTRAINT icinga_scheduled_downtime_zone
|
CONSTRAINT icinga_scheduled_downtime_zone
|
||||||
FOREIGN KEY (zone_id)
|
FOREIGN KEY (zone_id)
|
||||||
|
@ -2155,4 +2156,4 @@ COMMENT ON COLUMN icinga_scheduled_downtime_range.merge_behaviour IS 'set -> = {
|
||||||
|
|
||||||
INSERT INTO director_schema_migration
|
INSERT INTO director_schema_migration
|
||||||
(schema_version, migration_time)
|
(schema_version, migration_time)
|
||||||
VALUES (161, NOW());
|
VALUES (162, NOW());
|
||||||
|
|
Loading…
Reference in New Issue