Skip to content

Commit

Permalink
Quick setup AWS: fix error messages showing 'Title(...)'
Browse files Browse the repository at this point in the history
CMK-19572

Change-Id: I53cec36f3d413f11fe5be7177e4f2646468c331f
  • Loading branch information
oKenneth committed Oct 16, 2024
1 parent ef34cf1 commit ce2d10d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmk/gui/quick_setup/v0_unstable/predefined/_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from cmk.gui.fields.definitions import HOST_NAME_REGEXP
from cmk.gui.form_specs.private.dictionary_extended import DictionaryExtended
from cmk.gui.form_specs.vue.shared_type_defs import DictionaryLayout
from cmk.gui.i18n import translate_to_current_language
from cmk.gui.quick_setup.v0_unstable.definitions import (
QSHostName,
QSHostPath,
Expand Down Expand Up @@ -37,7 +38,8 @@ def unique_id_formspec_wrapper(
custom_validate=(
validators.LengthInRange(
min_value=1,
error_msg=Message("%s cannot be empty") % str(title),
error_msg=Message("%s cannot be empty")
% title.localize(translate_to_current_language),
),
),
prefill=DefaultValue(
Expand All @@ -59,18 +61,19 @@ def _host_name_dict_element(
title: Title = Title("Host name"),
prefill_template: str = "qs_host",
) -> DictElement:
title_str: str = title.localize(translate_to_current_language)
return DictElement(
parameter_form=String(
title=title,
field_size=FieldSize.MEDIUM,
custom_validate=(
validators.LengthInRange(
min_value=1,
error_msg=Message("%s cannot be empty") % str(title),
error_msg=Message("%s cannot be empty") % title_str,
),
validators.MatchRegex(
regex=HOST_NAME_REGEXP,
error_msg=Message("Invalid characters in %s") % str(title),
error_msg=Message("Invalid characters in %s") % title_str,
),
),
prefill=DefaultValue(
Expand Down

0 comments on commit ce2d10d

Please sign in to comment.