Skip to content

Handle rule filter serialization#469

Open
BastianLedererIcinga wants to merge 4 commits into
mainfrom
rule-filter-handling
Open

Handle rule filter serialization#469
BastianLedererIcinga wants to merge 4 commits into
mainfrom
rule-filter-handling

Conversation

@BastianLedererIcinga
Copy link
Copy Markdown
Contributor

@BastianLedererIcinga BastianLedererIcinga commented Apr 28, 2026

resolve #466

Introduce RuleSerializer to create Json from a configured filter.

Introduce Icinga\Module\Notifications\Hook\V2 which no longer requires serializeRuleFilter() and getRuleFilterTargets() as they are now obsolete.

Adjust EventRuleController to skip target selection use the new RuleSerializer.

require Icinga/ipl-web#376

@cla-bot cla-bot Bot added the cla/signed CLA is signed by all contributors of a PR label Apr 28, 2026
@BastianLedererIcinga BastianLedererIcinga force-pushed the rule-filter-handling branch 2 times, most recently from e3da66a to b8a38fc Compare April 28, 2026 08:02
@BastianLedererIcinga BastianLedererIcinga force-pushed the rule-filter-handling branch 7 times, most recently from 222ee6b to d5fe2f5 Compare May 6, 2026 09:29
`RuleSerializer` serializes rules as json
`RuleParser` can read them and create an ipl `Filter\Ŗule` from it
Introduce a new version of the `SourceHook` interface for v 1.0
Use the functions of the new `SourceHook` interface,
the `RuleParser` and `RuleSerializer` to set up the filter editor
of an event rule-
@nilmerg nilmerg self-requested a review May 11, 2026 13:36
Comment on lines +89 to +92
$condition instanceof Filter\Unlike => '!~',
$condition instanceof Filter\Unequal => '!=',
$condition instanceof Filter\Like => '~',
$condition instanceof Filter\Equal => '=',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that Icinga Notifications will interpret the like/unlike expressions as regex internally. My suggestion there is to remove the distinction between like/equal and unlike/unequal, as this was only the case in Web because our query string representation needed a way to express this to avoid the need to distinguish such based on whether an asterisk (*) is contained in the value or not. Now that we don't rely on this anymore here, let's just pre-process the value of a like/unlike as regex and serialize it as regex instead of value and use the non-like operator counterpart instead.

Pre-process in this case means, foo* will be prepared as ^foo.*$.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle rule filter rendering and serialization on our own again

2 participants