Module: check_mk
Branch: master
Commit: b7f396d93525fc1932dcf58c99cd53ce5a23d85e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b7f396d93525fc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Dec 30 18:58:59 2011 +0100
Separator for Dropdown Choice
---
web/htdocs/forms.py | 2 +-
web/htdocs/valuespec.py | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/forms.py b/web/htdocs/forms.py
index 7ad903e..aab1955 100644
--- a/web/htdocs/forms.py
+++ b/web/htdocs/forms.py
@@ -28,7 +28,7 @@ from lib import *
def edit_dictionary(entries, value):
- new_value = {}
+ new_value = value.copy()
if html.check_transaction():
messages = []
for name, vs in entries:
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 2c5d11f..13e03c8 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -362,11 +362,15 @@ class Checkbox(ValueSpec):
if type(value) != bool:
raise MKUserError(varprefix, _("The value has type %s, but must be either True or False") % (type(value)))
-# A type-save dropdown choice
+# A type-save dropdown choice. Parameters:
+# help_separator: if you set this to a character, e.g. "-", then
+# value_to_text will omit texts from the character up to the end of
+# a choices name.
class DropdownChoice(ValueSpec):
def __init__(self, **kwargs):
ValueSpec.__init__(self, **kwargs)
self._choices = kwargs["choices"]
+ self._help_separator = kwargs.get("help_separator")
def canonical_value(self):
return self._choices[0][0]
@@ -384,7 +388,10 @@ class DropdownChoice(ValueSpec):
def value_to_text(self, value):
for val, title in self._choices:
if value == val:
- return title
+ if self._help_separator:
+ return title.split(self._help_separator, 1)[0].strip()
+ else:
+ return title
def from_html_vars(self, varprefix):
sel = html.var(varprefix)
Module: check_mk
Branch: master
Commit: a07fa42afe297a9f1e50750db4b525115cf9d33e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a07fa42afe297a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 29 09:29:45 2011 +0100
Updated bug entries #0131
---
.bugs/131 | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.bugs/131 b/.bugs/131
index 80999ee..cd10ed2 100644
--- a/.bugs/131
+++ b/.bugs/131
@@ -17,6 +17,14 @@ When monitoring switches the services are ordered as follows:
2
20
-It would be good to cleanup such interface names by adding a leading zero to the numbers to
-have a proper sorting of the elements. We can make it like in the brocade checks: As we
-know the total number of ports we can decide whether to use 2, 3 or 4 digits.
+It would be good to cleanup such interface names by adding a leading zero to
+the numbers to have a proper sorting of the elements. We can make it like
+in the brocade checks: As we know the total number of ports we can decide
+whether to use 2, 3 or 4 digits.
+
+Because there are switches with more than 100 ports we could first
+get the number of ports and then use even more zeroes if neccessary.
+Look at brocade_fcport for details.
+
+Also we could make this configurable in order not to break existing
+checks.