diff --git a/cmk/gui/wato/pages/notifications/quick_setup.py b/cmk/gui/wato/pages/notifications/quick_setup.py index 4ad377fa50e..e65eee3e2e1 100644 --- a/cmk/gui/wato/pages/notifications/quick_setup.py +++ b/cmk/gui/wato/pages/notifications/quick_setup.py @@ -110,7 +110,7 @@ TimeMagnitude, TimeSpan, ) -from cmk.rulesets.v1.form_specs.validators import EmailAddress, ValidationError +from cmk.rulesets.v1.form_specs.validators import EmailAddress, LengthInRange, ValidationError NEXT_BUTTON_ARIA_LABEL = _("Go to the next stage") PREV_BUTTON_ARIA_LABEL = _("Go to the previous stage") @@ -1150,6 +1150,14 @@ def _components() -> Sequence[Widget]: ), single_choice_type=SingleChoice, elements=_contact_group_choice(), + custom_validate=[ + LengthInRange( + min_value=1, + error_msg=Message( + "Please add at least one contact group" + ), + ) + ], ), ), ), @@ -1160,8 +1168,16 @@ def _components() -> Sequence[Widget]: parameter_form=ListOfStrings( layout=ListOfStringsLayout.vertical, string_spec=String( - custom_validate=[EmailAddress()] + custom_validate=[EmailAddress()], ), + custom_validate=[ + LengthInRange( + min_value=1, + error_msg=Message( + "Please add at least one email address" + ), + ), + ], ), ), ), @@ -1184,6 +1200,14 @@ def _components() -> Sequence[Widget]: ) for ident, title in _get_sorted_users() ], + custom_validate=[ + LengthInRange( + min_value=1, + error_msg=Message( + "Please add at least one user" + ), + ), + ], ), ), ), @@ -1223,6 +1247,14 @@ def _components() -> Sequence[Widget]: ), single_choice_type=SingleChoice, elements=_contact_group_choice(), + custom_validate=[ + LengthInRange( + min_value=1, + error_msg=Message( + "Please add at least one contact group" + ), + ), + ], ), ), ), @@ -1247,6 +1279,14 @@ def _components() -> Sequence[Widget]: ], ), add_element_label=Label("Add condition"), + custom_validate=[ + LengthInRange( + min_value=1, + error_msg=Message( + "Please add at least one macro" + ), + ), + ], ), ), ),