Module: check_mk
Branch: master
Commit: 5a8b571445796326b51d26eb1b5daa549f7be435
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5a8b5714457963…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 5 10:27:35 2018 +0100
5879 FIX Dashboard: View dashlets were not applying row limits
The row limits of the views were not applied in the dashlets. This could result
in long load times caused by very large views. The view dashlets are now limited
exactly like when viewing the dedicated views.
Change-Id: Id709775a4cee604516414046401f2be2f98ce7b7
---
.werks/5879 | 13 +++++++++++++
web/htdocs/views.css | 6 ++++++
web/htdocs/views.py | 12 ++++++++----
web/plugins/dashboard/dashlets.py | 2 +-
4 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/.werks/5879 b/.werks/5879
new file mode 100644
index 0000000..3e84beb
--- /dev/null
+++ b/.werks/5879
@@ -0,0 +1,13 @@
+Title: Dashboard: View dashlets were not applying row limits
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i4
+Date: 1520241957
+
+The row limits of the views were not applied in the dashlets. This could result
+in long load times caused by very large views. The view dashlets are now limited
+exactly like when viewing the dedicated views.
diff --git a/web/htdocs/views.css b/web/htdocs/views.css
index 3c89fc7..fb0672f 100644
--- a/web/htdocs/views.css
+++ b/web/htdocs/views.css
@@ -32,6 +32,12 @@ body.main.dashlet {
padding: 0px;
}
+body.main.dashlet div.warning {
+ margin: 0;
+ border-radius: 0;
+ box-shadow: 0;
+}
+
/*-------------------------------------------------------------------------.
| _____ _ ___ ___ _ _ |
| |_ _|_ _| |__ ___ ( _ ) / _ \ _ __ | |_(_) ___ _ __ ___ |
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7c04406..ecadb13 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1965,12 +1965,16 @@ def check_limit(rows, limit):
count = len(rows)
if limit != None and count >= limit + 1:
text = _("Your query produced more than %d results. ") % limit
+
if html.var("limit", "soft") == "soft" and
config.user.may("general.ignore_soft_limit"):
- text += '<a href="%s">%s</a>' % \
- (html.makeuri([("limit", "hard")]),
_('Repeat query and allow more results.'))
+ text += html.render_a(_('Repeat query and allow more results.'),
+ target="_self",
+ href=html.makeuri([("limit",
"hard")]))
elif html.var("limit") == "hard" and
config.user.may("general.ignore_hard_limit"):
- text += '<a href="%s">%s</a>' % \
- (html.makeuri([("limit", "none")]),
_('Repeat query without limit.'))
+ text += html.render_a(_('Repeat query without limit.'),
+ target="_self",
+ href=html.makeuri([("limit",
"none")]))
+
text += " " + _("<b>Note:</b> the shown results are
incomplete and do not reflect the sort order.")
html.show_warning(text)
del rows[limit:]
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index cdc007a..3a23c7a 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -675,7 +675,7 @@ def dashlet_view(nr, dashlet):
is_reload = html.has_var("_reload")
- display_options = "SIXL"
+ display_options = "SIXLW"
if not is_reload:
display_options += "HR"