Module: check_mk
Branch: master
Commit: 5ba5383ecd7fb899060a81fb307bd86db93df9be
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5ba5383ecd7fb8…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Nov 22 12:48:29 2013 +0100
table headers are now omitted if all fields are empty and no table action is set
---
.werks/235 | 8 ++++++++
ChangeLog | 1 +
web/htdocs/table.py | 51 +++++++++++++++++++++++++++------------------------
3 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/.werks/235 b/.werks/235
new file mode 100644
index 0000000..547cd21
--- /dev/null
+++ b/.werks/235
@@ -0,0 +1,8 @@
+Title: table headers are now omitted if all fields are empty and no table action is set
+Level: 1
+Component: wato
+Version: 1.2.3i7
+Date: 1385120851
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index f82cd94..e1dd50f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@
WATO:
* 0053 New rule for configuring the display_name of a service...
* 0216 Supporting float values as SNMP timeout value now...
+ * 0235 table headers are now omitted if all fields are empty and no table action is
set
* 0048 FIX: Fixed locking issue on host diagnose page
* 0033 FIX: Fixed problem when saving settings in WATOs host diagnostic page...
* 0205 FIX: Allowing star chars in variable names to fix role/permission editing...
diff --git a/web/htdocs/table.py b/web/htdocs/table.py
index 94dada3..e6aadae 100644
--- a/web/htdocs/table.py
+++ b/web/htdocs/table.py
@@ -172,30 +172,33 @@ def end():
html.write(" %s" % table["css"])
html.write('">\n')
- html.write(" <tr>")
- first_col = True
- for header, help in table["headers"]:
- if help:
- header = '<span title="%s">%s</span>' %
(html.attrencode(help), header)
- html.write(" <th>")
-
- # Add the table action link
- if first_col:
- if actions_enabled:
- if actions_visible:
- state = '0'
- help = _('Hide table actions')
- img = 'table_actions_on'
- else:
- state = '1'
- help = _('Display table actions')
- img = 'table_actions_off'
- html.icon_button(html.makeuri([('_%s_actions' % table_id,
state)]),
- help, img, cssclass = 'toggle_actions')
- first_col = False
-
- html.write("%s</th>\n" % header)
- html.write(" </tr>\n")
+
+ use_headers = [ header for header in table["headers"] if header[0] !=
"" ]
+ if use_headers or actions_enabled:
+ html.write(" <tr>")
+ first_col = True
+ for header, help in table["headers"]:
+ if help:
+ header = '<span title="%s">%s</span>' %
(html.attrencode(help), header)
+ html.write(" <th>")
+
+ # Add the table action link
+ if first_col:
+ if actions_enabled:
+ if actions_visible:
+ state = '0'
+ help = _('Hide table actions')
+ img = 'table_actions_on'
+ else:
+ state = '1'
+ help = _('Display table actions')
+ img = 'table_actions_off'
+ html.icon_button(html.makeuri([('_%s_actions' % table_id,
state)]),
+ help, img, cssclass = 'toggle_actions')
+ first_col = False
+
+ html.write("%s</th>\n" % header)
+ html.write(" </tr>\n")
if actions_enabled and actions_visible:
html.write('<tr class="data even0 actions"><td
colspan=%d>' % num_cols)