Module: check_mk
Branch: master
Commit: 0bbf689b05389509d5cc8860145d3c27ebcd9e67
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0bbf689b053895…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Oct 12 15:34:19 2016 +0200
3901 Logfile pattern analyser: pattern lists can now be searched
---
.werks/3901 | 9 +++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 2 +-
web/htdocs/wato.py | 42 ++++++++++++++++--------------------------
4 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/.werks/3901 b/.werks/3901
new file mode 100644
index 0000000..a8a9526
--- /dev/null
+++ b/.werks/3901
@@ -0,0 +1,9 @@
+Title: Logfile pattern analyser: pattern lists can now be searched
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476279236
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index be557b3..60a3fb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@
WATO:
* 3915 User access times: New icon when never logged in; New column "last
seen"
+ * 3901 Logfile pattern analyser: pattern lists can now be searched
* 3914 FIX: Roles: Aliases are now unique during cloning
* 3820 FIX: Network scan: no longer fails completely if hostname already exists in
configuration...
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 6781253..a1924a5 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -233,7 +233,7 @@ class HTMLGenerator(OutputFunnel):
# these tags can be called by their tag names, e.g. 'self.title(content)'
_shortcut_tags = set(['title', 'h1', 'h2', 'h3',
'th', 'tr', 'td', 'center',\
- 'div', 'p', 'span',
'canvas', 'strong', 'sub'])
+ 'div', 'p', 'span',
'canvas', 'strong', 'sub', 'tt'])
# these tags can be called by open_name(), close_name() and render_name(), e.g.
'self.open_html()'
_tag_names = set(['html', 'head', 'body', 'header',
'footer', 'a', 'b',\
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 588a611..5ad73ab 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -14631,13 +14631,7 @@ def mode_pattern_editor(phase):
html.begin_foldable_container("rule", str(rulenr), True,
HTML("<b>Rule #%d</b>" % (rulenr + 1)), indent
= False)
- html.write('<table style="width:100%" class="data
logwatch"><tr>')
- html.write('<th style="width:30px;">' +
_('Match') + '</th>')
- html.write('<th style="width:50px;">' +
_('State') + '</th>')
- html.write('<th style="width:300px;">' +
_('Pattern') + '</th>')
- html.write('<th>' + _('Comment') + '</th>')
- html.write('<th style="width:300px;">' + _('Matched
line') + '</th>')
- html.write('</tr>\n')
+ table.begin("pattern_editor_rule_%d" % rulenr, sortable=False)
# Each rule can hold no, one or several patterns. Loop them all here
odd = "odd"
@@ -14651,9 +14645,9 @@ def mode_pattern_editor(phase):
# Prepare highlighted search txt
match_start = matched.start()
match_end = matched.end()
- disp_match_txt = match_txt[:match_start] \
- + '<span class=match>' +
match_txt[match_start:match_end] + '</span>' \
- + match_txt[match_end:]
+ disp_match_txt = html.attrencode(match_txt[:match_start]) \
+ + '<span class=match>' +
html.attrencode(match_txt[match_start:match_end]) + '</span>' \
+ + html.attrencode(match_txt[match_end:])
if already_matched == False:
# First match
@@ -14671,23 +14665,20 @@ def mode_pattern_editor(phase):
match_img = 'nmatch'
match_title = _('This logfile pattern does not match the given
string.')
- html.write('<tr class="data %s0 %s">' % (odd,
reason_class))
- html.write('<td><img align=absmiddle title="%s" '
\
- 'class=icon src="images/icon_rule%s.png" />'
% \
- (match_title, match_img))
+ table.row(css=reason_class)
+ table.cell(_('Match'))
+ html.icon(match_title, "rule%s" % match_img)
cls = ''
if match_class == 'match first':
- cls = ' class="svcstate state%d"' %
logwatch.level_state(state)
- html.write('<td style="text-align:center"
%s>%s</td>' % (cls, logwatch.level_name(state)))
- html.write('<td><code>%s</code></td>' %
pattern)
- html.write('<td>%s</td>' % comment)
- html.write('<td>%s</td>' % disp_match_txt)
- html.write('</tr>\n')
-
- odd = odd == "odd" and "even" or "odd"
-
- html.write('<tr class="data %s0"><td colspan=5>' %
odd)
+ cls = 'svcstate state%d' % logwatch.level_state(state)
+ table.cell(_('State'), logwatch.level_name(state), css=cls)
+ table.cell(_('Pattern'), html.render_tt(html.attrencode(pattern)))
+ table.cell(_('Comment'), html.attrencode(comment))
+ table.cell(_('Matched line'), disp_match_txt)
+
+ table.row(fixed=True)
+ table.cell(colspan=5)
edit_url = folder_preserving_link([
("mode", "edit_rule"),
("varname", varname),
@@ -14696,9 +14687,8 @@ def mode_pattern_editor(phase):
("item", mk_repr(item)),
("rule_folder", folder.path())])
html.icon_button(edit_url, _("Edit this rule"), "edit")
- html.write('</td></tr>\n')
- html.write('</table>\n')
+ table.end()
html.end_foldable_container()