From c1850c3f6487a315ec85fedc3a085165ad77fb06 Mon Sep 17 00:00:00 2001 From: Ronny Bruska Date: Tue, 7 Jan 2025 08:28:24 +0100 Subject: [PATCH] 17465 FIX Respect show more options in sidebar element dashlets SUP-21668 Change-Id: I717c12ebb1935f155301c23ca1c81941344916df --- .werks/17465.md | 22 ++++++++++++++++++++++ cmk/gui/sidebar/_snapin_dashlet.py | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .werks/17465.md diff --git a/.werks/17465.md b/.werks/17465.md new file mode 100644 index 00000000000..3bfeb76ba30 --- /dev/null +++ b/.werks/17465.md @@ -0,0 +1,22 @@ +[//]: # (werk v2) +# Respect show more options in sidebar element dashlets + +key | value +---------- | --- +compatible | yes +version | 2.3.0p24 +date | 2025-01-07T07:27:41+00:00 +level | 1 +class | fix +component | multisite +edition | cre + +Dashlets of type "Sidebar element" did not respect the current show more +options of the user. +If you e.g. added a "Overview" element and the sidebar snapin was changed to +"Show more", the dashlet content still showed only the default content. + +This has been fixed. + +Note: The dashlet still has to refresh to take the current settings of a +sidebar element into account. \ No newline at end of file diff --git a/cmk/gui/sidebar/_snapin_dashlet.py b/cmk/gui/sidebar/_snapin_dashlet.py index 86775228b73..65ae88beb25 100644 --- a/cmk/gui/sidebar/_snapin_dashlet.py +++ b/cmk/gui/sidebar/_snapin_dashlet.py @@ -7,6 +7,7 @@ from cmk.gui.exceptions import MKUserError from cmk.gui.htmllib.html import html from cmk.gui.i18n import _ +from cmk.gui.logged_in import user from cmk.gui.utils.theme import theme from cmk.gui.valuespec import DropdownChoice @@ -70,13 +71,18 @@ def update(self): if not snapin: raise MKUserError(None, _("The configured element does not exist.")) snapin_instance = snapin() + snapin_name = dashlet["snapin"] html.browser_reload = self.refresh_interval() html.html_head(_("Sidebar element")) html.open_body(class_="side", data_theme=theme.get()) html.open_div(id_="check_mk_sidebar") html.open_div(id_="side_content") - html.open_div(id_="snapin_container_%s" % dashlet["snapin"], class_="snapin") + show_more = user.get_show_more_setting(f"sidebar_snapin_{snapin_name}") + html.open_div( + id_=f"snapin_container_{snapin_name}", + class_=["snapin", ("more" if show_more else "less")], + ) html.open_div(id_="snapin_%s" % dashlet["snapin"], class_="content") styles = snapin_instance.styles() if styles: