Skip to content

Commit

Permalink
Notifications: Fix mandatory documentation URL
Browse files Browse the repository at this point in the history
Change-Id: I829d125ba1ec03b17b2f238d4e7acd24898166d4
  • Loading branch information
makanakoeln committed Jan 10, 2025
1 parent ae7f53f commit 7ad4b04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmk/gui/wato/pages/notifications/quick_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,9 +1514,7 @@ def _components() -> Sequence[Widget]:
parameter_form=String(
title=Title("Documentation URL"),
field_size=FieldSize.LARGE,
custom_validate=[
Url(protocols=[UrlProtocol.HTTP, UrlProtocol.HTTPS]),
],
custom_validate=[_validate_optional_url],
),
),
},
Expand All @@ -1543,6 +1541,14 @@ def _components() -> Sequence[Widget]:
)


def _validate_optional_url(value: str) -> None:
if not value:
return

url_validator_instance = Url(protocols=[UrlProtocol.HTTP, UrlProtocol.HTTPS])
url_validator_instance(value)


def save_and_test_action(
all_stages_form_data: ParsedFormData, mode: QuickSetupActionMode, object_id: str | None
) -> str:
Expand Down

0 comments on commit 7ad4b04

Please sign in to comment.