Module: check_mk
Branch: master
Commit: 41770b334e356a95e090923d39c901696dae23dd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41770b334e356a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Feb 9 12:11:47 2018 +0100
Revert "Fixed handling of another numeration format"
This reverts commit 48a20ff4676976e5f2166b2aac3df7d54b81f94b.
---
cmk/structured_data.py | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/cmk/structured_data.py b/cmk/structured_data.py
index 52caf71..af36fa2 100644
--- a/cmk/structured_data.py
+++ b/cmk/structured_data.py
@@ -194,15 +194,10 @@ class StructuredDataTree(object):
# In the second case we have to deal with nested numerations
# We take a look at children which may be real numerations
# or sub trees.
- # May also be a flat list, thus we convert to expected
- # numeration format: [{KEY: VAL,..},..]
- entries_type = self._get_entries_type(v)
- if isinstance(entries_type, Numeration):
+ if self._is_numeration(v):
sub_raw_tree.setdefault(k, v)
- elif isinstance(entries_type, Container):
- sub_raw_tree.setdefault(k, dict(enumerate(v)))
else:
- sub_raw_tree.setdefault(k, [{"name": e} for e in v])
+ sub_raw_tree.setdefault(k, dict(enumerate(v)))
else:
# Here we collect all other values meaning simple
# attributes of this node.
@@ -210,15 +205,12 @@ class StructuredDataTree(object):
return sub_raw_tree, leaf_data
- def _get_entries_type(self, entries):
- #TODO test
+ def _is_numeration(self, entries):
for entry in entries:
- if not isinstance(entry, dict):
- return
for k, v in entry.iteritems():
if isinstance(v, list):
- return Container()
- return Numeration()
+ return False
+ return True
# ---delegators-----------------------------------------------------------
Module: check_mk
Branch: master
Commit: 002ae64e8271c6a281193b5801010a798fa7bde7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=002ae64e8271c6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 9 11:59:19 2018 +0100
Fixed issue in class hierarchy
Change-Id: Idc21526f8bc59ce8d8872f6267f0dc505285abf5
---
web/htdocs/pagetypes.py | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index 32f77a9..fd0b7a0 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -178,6 +178,10 @@ class Base(object):
return False
+ def _can_be_linked(self):
+ return True
+
+
def render_title(self):
return _u(self.title())
@@ -396,23 +400,6 @@ class PageRenderer(Base):
return self.title()
- def _can_be_linked(self):
- """Whether or not the thing can be linked to"""
- if self.is_hidden():
- return False # don't link to hidden things
-
- if self.is_mine():
- return True
-
- # Is this the visual which would be shown to the user in case the user
- # requests a visual with the current name?
- page = self.find_page(self.name())
- if page.owner() != self.owner():
- return False
-
- return self.is_public()
-
-
#.
# .--Overridable---------------------------------------------------------.
@@ -494,6 +481,23 @@ class Overridable(Base):
return self.is_mine() and config.user.may("general.edit_" + self.type_name())
+ def _can_be_linked(self):
+ """Whether or not the thing can be linked to"""
+ if self.is_hidden():
+ return False # don't link to hidden things
+
+ if self.is_mine():
+ return True
+
+ # Is this the visual which would be shown to the user in case the user
+ # requests a visual with the current name?
+ page = self.find_page(self.name())
+ if page.owner() != self.owner():
+ return False
+
+ return self.is_public()
+
+
@classmethod
def _delete_permission(cls):
return "general.edit_" + cls.type_name()
Module: check_mk
Branch: master
Commit: 7c5ca8eacda26a122f6c507f0e8bfe2f7fd73b59
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7c5ca8eacda26a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 8 14:05:17 2018 +0100
5723 FIX Fixed broken sorting of services
The sorting was a case insentivitve text sorting at least since
1.4.0p7. This has now been fixed to work like as case insensitive
sort with the addition that texts and numbers are separated from
eachother before sorting.
Change-Id: I252cf3f98b6493b2050ed179ff980caf266035da
---
.werks/5723 | 14 ++++++++++++++
web/htdocs/views.py | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.werks/5723 b/.werks/5723
new file mode 100644
index 0000000..54d0135
--- /dev/null
+++ b/.werks/5723
@@ -0,0 +1,14 @@
+Title: Fixed broken sorting of services
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i3
+Date: 1518095011
+
+The sorting was a case insentivitve text sorting at least since
+1.4.0p7. This has now been fixed to work like as case insensitive
+sort with the addition that texts and numbers are separated from
+eachother before sorting.
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index ad80c3c..34a5e81 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -3001,9 +3001,9 @@ def cmp_simple_string(column, r1, r2):
return cmp_insensitive_string(v1, v2)
def cmp_num_split(column, r1, r2):
- c1 = r1[column]
- c2 = r2[column]
- return cmp_string_list(column, r1, r2)
+ c1 = num_split(r1[column].lower())
+ c2 = num_split(r2[column].lower())
+ return cmp(c1, c2)
def cmp_string_list(column, r1, r2):
v1 = ''.join(r1.get(column, []))
Module: check_mk
Branch: master
Commit: 3bbc5f9c9ffe10afdee4c48925cbd4608c3124f1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3bbc5f9c9ffe10…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 8 17:32:10 2018 +0100
5725 FIX Fixed changing view filter default values not being effective right after editing
When editing the default values of filters in views (or dashboards) and saving the view,
the default filter variables were not effective in all cases in the view rendered after
edit. When closing and opening the view again the filter options were set as configured.
Change-Id: I809e39931360207a61d2961383273e5a978332a8
---
.werks/5725 | 12 ++++++++++++
web/htdocs/html_mod_python.py | 2 ++
web/htdocs/htmllib.py | 7 +++++++
web/htdocs/views.py | 15 +++++++++------
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/.werks/5725 b/.werks/5725
new file mode 100644
index 0000000..87424e9
--- /dev/null
+++ b/.werks/5725
@@ -0,0 +1,12 @@
+Title: Fixed changing view filter default values not being effective right after editing
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.4.0p25
+Date: 1518119511
+Class: fix
+
+When editing the default values of filters in views (or dashboards) and saving the view,
+the default filter variables were not effective in all cases in the view rendered after
+edit. When closing and opening the view again the filter options were set as configured.
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index 16d16f4..5baae11 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -64,6 +64,8 @@ class html_mod_python(htmllib.html):
self.read_get_vars()
self.read_cookies()
+ self._requested_url = self.makeuri_contextless(self.vars.items())
+
# Disable caching for all our pages as they are mostly dynamically generated,
# user related and are required to be up-to-date on every refresh
self.set_http_header("Cache-Control", "no-cache")
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index db11e1a..30f74da 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -1415,6 +1415,7 @@ class html(HTMLGenerator, RequestHandler):
self.browser_redirect = ''
self.link_target = None
self.keybindings_enabled = True
+ self._requested_url = None
self.myfile = None
# Browser options
@@ -1758,6 +1759,12 @@ class html(HTMLGenerator, RequestHandler):
# URL building
#
+ def requested_url(self):
+ """Returns the URL requested by the user.
+ This is not the bare original URL used by the user. Some HTTP variables may
+ have been filtered by Check_MK while parsing the incoming request."""
+ return self._requested_url
+
# [('varname1', value1), ('varname2', value2) ]
def makeuri(self, addvars, remove_prefix=None, filename=None, delvars=None):
new_vars = [ nv[0] for nv in addvars ]
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 34a5e81..27fe04c 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2169,12 +2169,15 @@ def show_context_links(thisview, datasource, show_filters,
# Customize/Edit view button
if display_options.enabled(display_options.E) and config.user.may("general.edit_views"):
- backurl = html.urlencode(html.makeuri([]))
- if thisview["owner"] == config.user.id:
- url = "edit_view.py?load_name=%s&back=%s" % (thisview["name"], backurl)
- else:
- url = "edit_view.py?load_user=%s&load_name=%s&back=%s" % \
- (thisview["owner"], thisview["name"], backurl)
+ url_vars = [
+ ("back", html.requested_url()),
+ ("load_name", thisview["name"]),
+ ]
+
+ if thisview["owner"] != config.user.id:
+ url_vars.append(("load_user", thisview["owner"]))
+
+ url = html.makeuri_contextless(url_vars, filename="edit_view.py")
html.context_button(_("Edit View"), url, "edit", id="edit", bestof=config.context_buttons_to_show)
if display_options.enabled(display_options.E):
Module: check_mk
Branch: master
Commit: 748738b9687edc73b2fd825372499719104dbb72
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=748738b9687edc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 8 18:02:54 2018 +0100
adapted visual linking logic to pagetypes
Change-Id: Ia81264e76e28afce3542ecee191e88132fe25404
---
web/htdocs/pagetypes.py | 20 +++++++++++++++++++-
web/htdocs/visuals.py | 6 +-----
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index b706c53..32f77a9 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -390,12 +390,30 @@ class PageRenderer(Base):
def render_title(self):
- if not self.is_hidden():
+ if self._can_be_linked():
return html.render_a(self.title(), href=self.page_url())
else:
return self.title()
+ def _can_be_linked(self):
+ """Whether or not the thing can be linked to"""
+ if self.is_hidden():
+ return False # don't link to hidden things
+
+ if self.is_mine():
+ return True
+
+ # Is this the visual which would be shown to the user in case the user
+ # requests a visual with the current name?
+ page = self.find_page(self.name())
+ if page.owner() != self.owner():
+ return False
+
+ return self.is_public()
+
+
+
#.
# .--Overridable---------------------------------------------------------.
# | ___ _ _ _ _ |
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index 9d9730f..31a6485 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -25,11 +25,7 @@
# Boston, MA 02110-1301 USA.
import os, copy, sys
-
-try:
- import simplejson as json
-except ImportError:
- import json
+import json
from lib import *
from valuespec import *