Skip to content

Commit 5ec0324

Browse files
committed
Adjust notification test result text
CMK-21405 Change-Id: I537017e8f590bd45ce1e6bdfcc5720c1e3fff47f
1 parent b8810cd commit 5ec0324

File tree

1 file changed

+27
-8
lines changed
  • cmk/gui/wato/pages/notifications

1 file changed

+27
-8
lines changed

cmk/gui/wato/pages/notifications/modes.py

+27-8
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ def _vs_notification_scripts(self) -> DropdownChoice:
952952
)
953953

954954
def _show_resulting_notifications(self, result: NotifyAnalysisInfo) -> None:
955-
with table_element(table_id="plugins", title=_("Resulting notifications")) as table:
955+
with table_element(table_id="plugins", title=_("Predicted notifications")) as table:
956956
for contact, plugin, parameters, bulk in result[1]:
957957
table.row()
958958
if contact.startswith("mailto:"):
@@ -1650,7 +1650,7 @@ def _show_notification_test_overview(
16501650
html.close_div()
16511651

16521652
html.open_div(class_="message_container")
1653-
html.h2(_("Analysis results"))
1653+
html.h2(_("Test results"))
16541654
analyse_rules, analyse_resulting_notifications = analyse
16551655
match_count_all = len(tuple(entry for entry in analyse_rules if "match" in entry))
16561656
match_count_user = len(
@@ -1682,20 +1682,39 @@ def _show_notification_test_overview(
16821682
)
16831683
)
16841684
html.br()
1685-
resulting_notifications_count = len(analyse_resulting_notifications)
1685+
resulting_notifications_count = len(analyse_resulting_notifications[-1][0].split(","))
16861686
html.write_text_permissive(
1687-
("%d resulting %s")
1687+
("%d %s")
16881688
% (
16891689
resulting_notifications_count,
16901690
ungettext(
1691-
"notification",
1692-
"notifications",
1691+
"notification would have been sent based on your notification rules (see table: 'Predicted notifications')",
1692+
"notifications would have been sent based on your notification rules (see table: 'Predicted notifications')",
16931693
resulting_notifications_count,
16941694
),
16951695
)
16961696
)
1697-
if request.var("notify_plugin"):
1698-
html.write_text_permissive(_("Notifications have been sent. "))
1697+
if dispatch_method := request.var("dispatch"):
1698+
notifications_sent = [
1699+
rule for rule in analyse_resulting_notifications if rule[1] == dispatch_method
1700+
]
1701+
if notifications_sent:
1702+
notification_sent_count = len(notifications_sent[-1][0].split(","))
1703+
else:
1704+
notification_sent_count = 0
1705+
html.br()
1706+
html.write_text_permissive(
1707+
_("%d %s %s.")
1708+
% (
1709+
notification_sent_count,
1710+
self._vs_notification_scripts().value_to_html(dispatch_method),
1711+
ungettext(
1712+
"notification has been sent out",
1713+
"notifications have been sent out",
1714+
notification_sent_count,
1715+
),
1716+
)
1717+
)
16991718
html.br()
17001719
html.br()
17011720
html.write_text_permissive("View the following tables for more details.")

0 commit comments

Comments
 (0)