Module: check_mk
Branch: master
Commit: 62d960b897bb209ec9f1826365430c4dbad0b95a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=62d960b897bb20…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon May 5 18:13:33 2014 +0200
Improved transaction handling to speedup the Web-GUI
On some systems the number of transaction ids could get very high,
thus slowing down the web interface. This has been improved by re-using
the same transaction id on a page multiple times.
---
.werks/914 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 12 +++++++++---
web/htdocs/sidebar.py | 2 +-
web/htdocs/wato.py | 2 +-
5 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/.werks/914 b/.werks/914
new file mode 100644
index 0000000..09d613d
--- /dev/null
+++ b/.werks/914
@@ -0,0 +1,10 @@
+Title: Improved transaction handling to speedup the Web-GUI
+Level: 1
+Component: multisite
+Version: 1.2.5i3
+Date: 1399306196
+Class: feature
+
+On some systems the number of transaction ids could get very high,
+thus slowing down the web interface. This has been improved by re-using
+the same transaction id on a page multiple times.
diff --git a/ChangeLog b/ChangeLog
index c6ac540..6aa3c1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,7 @@
* 0779 Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled
by filter)
* 0887 Add new column painter "Host Notifications Enabled"...
* 0963 New snapin with virtual host trees...
+ * 0914 Improved transaction handling to speedup the Web-GUI...
* 0905 FIX: Multisite context buttons: links in context buttons are no longer called
twice...
* 0906 FIX: Improved transaction handling in Web GUI...
* 0909 FIX: Table checkboxes: Fixed bug where selected checkboxes got ignored...
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 2cac2e1..b569b51 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -76,6 +76,7 @@ class html:
self.caches = {}
self.new_transids = []
self.ignore_transids = False
+ self.current_transid = None
RETURN = 13
SHIFT = 16
@@ -178,7 +179,7 @@ class html:
enctype, onsubmit))
self.hidden_field("filled_in", name)
if add_transid:
- self.hidden_field("_transid", str(self.fresh_transid()))
+ self.hidden_field("_transid", str(self.get_transid()))
self.hidden_fields(self.global_vars)
self.form_name = name
@@ -250,7 +251,7 @@ class html:
return filename
def makeactionuri(self, addvars):
- return self.makeuri(addvars + [("_transid", self.fresh_transid())])
+ return self.makeuri(addvars + [("_transid", self.get_transid())])
def makeuri_contextless(self, vars, filename=None):
if not filename:
@@ -279,7 +280,7 @@ class html:
def buttonlink(self, href, text, add_transid=False, obj_id='',
style='', title='', disabled=''):
if add_transid:
- href += "&_transid=%s" % self.fresh_transid()
+ href += "&_transid=%s" % self.get_transid()
if not obj_id:
obj_id = self.some_id()
obj_id = ' id=%s' % obj_id
@@ -963,6 +964,11 @@ class html:
self.new_transids.append(transid)
return transid
+ def get_transid(self):
+ if not self.current_transid:
+ self.current_transid = self.fresh_transid()
+ return self.current_transid
+
# Marks a transaction ID as used. This is done by saving
# it in a user specific settings file "transids.mk". At this
# time we remove all entries from that list that are older
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 13e9100..31c0869 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -450,7 +450,7 @@ def page_add_snapin():
snapin = sidebar_snapins[name]
title = snapin["title"]
description = snapin.get("description", "")
- transid = html.fresh_transid()
+ transid = html.get_transid()
url = 'sidebar_add_snapin.py?name=%s&_transid=%s&pos=top' %
(name, transid)
html.write('<div class=snapinadder '
'onmouseover="this.style.cursor=\'pointer\';"
'
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d153ecc..d6cdd40 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -16650,7 +16650,7 @@ def make_link_to(vars, folder):
return html.makeuri_contextless(vars)
def make_action_link(vars):
- return make_link(vars + [("_transid", html.fresh_transid())])
+ return make_link(vars + [("_transid", html.get_transid())])
# Show confirmation dialog, send HTML-header if dialog is shown.