Support new column is_sticky_acknowledgement

This commit is contained in:
Sukhwinder Dhillon 2025-06-03 11:58:19 +02:00
parent af6931823f
commit 9283135144
5 changed files with 34 additions and 8 deletions

View file

@ -171,10 +171,15 @@ class IcingaRedis
$data['in_downtime'] = $data['in_downtime'] ? 'y' : 'n';
}
if (isset($data['is_acknowledged']) && is_int($data['is_acknowledged'])) {
if (isset($data['is_acknowledged']) && is_bool($data['is_acknowledged'])) {
$data['is_acknowledged'] = $data['is_acknowledged'] ? 'y' : 'n';
}
if (isset($data['is_sticky_acknowledgement']) && is_bool($data['is_sticky_acknowledgement'])) {
$data['is_sticky_acknowledgement'] = $data['is_sticky_acknowledgement'] ? 'y' : 'n';
}
yield $ids[$i] => array_intersect_key(array_merge($keyMap, $data), $keyMap);
}
}

View file

@ -392,9 +392,17 @@ class UrlMigrator
'host_acknowledged' => [
'host.state.is_acknowledged' => self::NO_YES
],
'host_acknowledgement_type' => [
'host.state.is_acknowledged' => array_merge(self::NO_YES, ['sticky'])
],
'host_acknowledgement_type' => function ($filter) {
$value = $filter->getValue();
if ($value == '2') {
return Filter::equal('host.state.is_sticky_acknowledgement', 'y');
}
return isset(self::NO_YES[$value])
? Filter::equal('host.state.is_acknowledged', self::NO_YES[$value])
: false;
},
'host_action_url' => [
'host.action_url.action_url' => self::USE_EXPR
],
@ -701,9 +709,17 @@ class UrlMigrator
'service_acknowledged' => [
'service.state.is_acknowledged' => self::NO_YES
],
'service_acknowledgement_type' => [
'service.state.is_acknowledged' => array_merge(self::NO_YES, ['sticky'])
],
'service_acknowledgement_type' => function ($filter) {
$value = $filter->getValue();
if ($value == '2') {
return Filter::equal('service.state.is_sticky_acknowledgement', 'y');
}
return isset(self::NO_YES[$value])
? Filter::equal('service.state.is_acknowledged', self::NO_YES[$value])
: false;
},
'service_action_url' => [
'service.action_url.action_url' => self::USE_EXPR
],

View file

@ -60,6 +60,7 @@ class HostState extends State
if (Backend::supportsDependencies()) {
$columns['affects_children'] = t('Host Affects Children');
$columns['is_sticky_acknowledgement'] = t('Acknowledgement Is Sticky');
}
return $columns;

View file

@ -62,6 +62,7 @@ class ServiceState extends State
if (Backend::supportsDependencies()) {
$columns['affects_children'] = t('Service Affects Children');
$columns['is_sticky_acknowledgement'] = t('Acknowledgement Is Sticky');
}
return $columns;

View file

@ -36,7 +36,8 @@ use ipl\Web\Widget\Icon;
* @property bool $is_reachable Whether the node is reachable
* @property bool $is_flapping Whether the state is flapping
* @property bool $is_overdue Whether the check is overdue
* @property bool|string $is_acknowledged Whether the state is acknowledged (bool), can also be `sticky` (string)
* @property bool $is_acknowledged Whether the state is acknowledged
* @property bool $is_sticky_acknowledgement Whether the acknowledgement is sticky
* @property ?string $acknowledgement_comment_id The id of acknowledgement comment
* @property ?string $last_comment_id The id of last comment
* @property bool $in_downtime Whether the node is in downtime
@ -105,6 +106,7 @@ abstract class State extends Model
if (Backend::supportsDependencies()) {
$columns[] = 'affects_children';
$columns[] = 'is_sticky_acknowledgement';
}
return $columns;
@ -119,6 +121,7 @@ abstract class State extends Model
'is_flapping',
'is_overdue',
'is_acknowledged',
'is_sticky_acknowledgement',
'in_downtime',
'affects_children'
]));