From 14fa63ca2e53f468e1f8d2a06f967c294c07e919 Mon Sep 17 00:00:00 2001 From: Jose Naranjo Date: Fri, 20 Dec 2024 12:51:04 +0100 Subject: [PATCH] Add saas status menu item Change-Id: Ibf9933dc6d66df825b1d53a4f0c47b93c68fa5ed --- cmk/gui/main_menu.py | 50 +++++++++++++++++++--------- tests/gui_e2e/test_menu_help.py | 7 ++++ tests/testlib/playwright/pom/page.py | 4 +++ 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/cmk/gui/main_menu.py b/cmk/gui/main_menu.py index e28c478ff67..5ec308d5c37 100644 --- a/cmk/gui/main_menu.py +++ b/cmk/gui/main_menu.py @@ -204,22 +204,7 @@ def _help_menu_topics() -> list[TopicMenuTopic]: name="about_checkmk", title=_("About Checkmk"), icon="about_checkmk", - items=[ - TopicMenuItem( - name="info", - title=_("Info"), - url="info.py", - sort_index=10, - icon="checkmk_logo_min", - ), - TopicMenuItem( - name="change_log", - title=_("Change log (Werks)"), - url="change_log.py", - sort_index=20, - icon="checkmk_logo_min", - ), - ], + items=get_about_checkmk_items(), ), ] @@ -247,3 +232,36 @@ def license_status() -> HTML | str: target="main", ) return HTMLWriter.render_br() + status_message + + +def get_about_checkmk_items() -> list[TopicMenuItem]: + items = [ + TopicMenuItem( + name="info", + title=_("Information"), + url="info.py", + sort_index=20, + icon="about_checkmk", + ), + TopicMenuItem( + name="change_log", + title=_("Change log (Werks)"), + url="change_log.py", + sort_index=30, + icon="checkmk_logo_min", + ), + ] + + if edition() == Edition.CSE: + items.insert( + 0, + TopicMenuItem( + name="saas_status_page", + title=_("Status page"), + url="https://status.checkmk.cloud", + target="_blank", + sort_index=10, + icon="status", + ), + ) + return items diff --git a/tests/gui_e2e/test_menu_help.py b/tests/gui_e2e/test_menu_help.py index 7d03bd92cee..c49c4d90d9f 100644 --- a/tests/gui_e2e/test_menu_help.py +++ b/tests/gui_e2e/test_menu_help.py @@ -4,6 +4,7 @@ # conditions defined in the file COPYING, which is part of this source code package. from tests.testlib.playwright.pom.login import LoginPage +from tests.testlib.pytest_helpers.marks import skip_if_not_saas_edition def test_help_beginners_guide(logged_in_page: LoginPage) -> None: @@ -69,3 +70,9 @@ def test_help_info(logged_in_page: LoginPage) -> None: def test_help_werks(logged_in_page: LoginPage) -> None: response = logged_in_page.go(logged_in_page.main_menu.help_werks.get_attribute("href")) assert response and response.ok + + +@skip_if_not_saas_edition +def test_saas_status_page(logged_in_page: LoginPage) -> None: + href = logged_in_page.main_menu.help_saas_status_page.get_attribute("href") + assert href is not None and "status.checkmk.com" in href diff --git a/tests/testlib/playwright/pom/page.py b/tests/testlib/playwright/pom/page.py index c5434ec8ab3..294a628782b 100644 --- a/tests/testlib/playwright/pom/page.py +++ b/tests/testlib/playwright/pom/page.py @@ -264,6 +264,10 @@ def help_rest_api_gui(self) -> Locator: def help_info(self) -> Locator: return self.help_menu("Info") + @property + def help_saas_status_page(self) -> Locator: + return self.help_menu("Status page") + @property def help_werks(self) -> Locator: return self.help_menu("Change log (Werks)")