Skip to content

Commit

Permalink
17465 FIX Respect show more options in sidebar element dashlets
Browse files Browse the repository at this point in the history
SUP-21668

Change-Id: I717c12ebb1935f155301c23ca1c81941344916df
  • Loading branch information
makanakoeln committed Jan 7, 2025
1 parent 3002e59 commit c1850c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .werks/17465.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 7 additions & 1 deletion cmk/gui/sidebar/_snapin_dashlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit c1850c3

Please sign in to comment.