Module: check_mk
Branch: master
Commit: 0695c6ef26e72b3d626a740b8979285fa22f760d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0695c6ef26e72b…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jan 13 18:23:53 2012 +0100
Bug add
---
.bugs/596 | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/.bugs/596 b/.bugs/596
new file mode 100644
index 0000000..a1898f3
--- /dev/null
+++ b/.bugs/596
@@ -0,0 +1,8 @@
+Title: Wato verweist für die Hostag Konfiguration noch in die multisite.mk
+Component: wato
+State: open
+Date: 2012-01-13 18:21:44
+Targetversion: 1.2.0
+Class: nastiness
+
+Anstelle eines Links in die Multisite Einstellungen zu Host Tags, wird via Text auf die multisite.mk verwiesen um hostags anzulegen
Module: check_mk
Branch: master
Commit: 52fd532f076e23b8f294159b73c960df2bedaa0d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=52fd532f076e23…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jan 13 17:58:52 2012 +0100
Wato: Added Filesize ValueSpec
---
web/htdocs/valuespec.py | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 2f4863c..02bd5b5 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -46,6 +46,7 @@ class ValueSpec:
# is prepended to the HTML variable names and is needed
# in order to make the variable unique in case that another
# Value of the same type is being used as well.
+ # The function may assume that the type of the value is valid.
def render_input(self, varprefix, value):
pass
@@ -72,6 +73,7 @@ class ValueSpec:
# Creates a text-representation of the value that can be
# used in tables and other contextes. It is to be read
# by the user and need not to be parsable.
+ # The function may assume that the type of the value is valid.
def value_to_text(self, value):
return repr(value)
@@ -225,6 +227,36 @@ class Integer(ValueSpec):
if self._maxvalue != None and value > self._maxvalue:
raise MKUserError(varprefix, _("%s is too high. The maximum allowed value is %s." % (
value, self._maxvalue)))
+# Filesize in Byte,Kbyte,Mbyte,Gigatbyte, Terrabyte
+class Filesize(Integer):
+ def __init__(self, **kwargs):
+ Integer.__init__(self, **kwargs)
+ self._names = [ 'Byte', 'KByte', 'MByte', 'GByte', 'TByte', ]
+
+
+ def get_exponent(self, value):
+ for exp, unit_name in list(enumerate(self._names))[::-1]:
+ if value == 0:
+ return 0,0
+ if value % (1024 ** exp) == 0:
+ return exp, value / (1024 ** exp)
+
+ def render_input(self, varprefix, value):
+ exp, count = self.get_exponent(value)
+ html.number_input(varprefix + '_size', count, size = self._size)
+ html.write(" ")
+ html.select(varprefix + '_unit', enumerate(self._names), exp)
+
+ def from_html_vars(self, varprefix):
+ try:
+ return int(html.var(varprefix + '_size')) * (1024 ** int(html.var(varprefix + '_unit')))
+ except:
+ raise MKUserError(varprefix + '_size', _("Please enter a valid integer number"))
+
+ def value_to_text(self, value):
+ exp, count = self.get_exponent(value)
+ return "%s %s" % (count, self._names[exp])
+
# Editor for a line of text
class TextAscii(ValueSpec):
Module: check_mk
Branch: master
Commit: 659f498caaa0339db68ffe126a88f9276abf15b4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=659f498caaa033…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 13 12:55:05 2012 +0100
Also showing dependent tags when related field is using the default value
---
web/htdocs/wato.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e062abb..d022547 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3884,6 +3884,9 @@ def configure_attributes(hosts, for_what, parent, myself=None, without_attribute
if not container: # We are the root folder - we inherit the default values
inherited_from = _("Default value")
inherited_value = attr.default_value()
+ # Also add the default values to the inherited values dict
+ if topic == _("Host tags"):
+ inherited_tags["attr_%s" % attrname] = inherited_value
# Legend and Help
html.write('<tr id="attr_%s"><td class=legend>' % attrname)