Module: check_mk
Branch: master
Commit: 83b14e0f8d095958b300caf5c32e36b06e469193
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=83b14e0f8d0959…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 5 09:33:18 2018 +0100
5720 Standard tables now tell their number of rows in page title area
When a data table is rendered, e.g. like it is done in the configuration GUI on
a lot of pages, the tables write the number of shown rows to detail text of the
header area of the page.
Change-Id: I2cce0be4096c66b6bd1b07c44f07b3f20327a7c9
---
.werks/5720 | 12 ++++++++++++
web/htdocs/table.py | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/.werks/5720 b/.werks/5720
new file mode 100644
index 0000000..a75811b
--- /dev/null
+++ b/.werks/5720
@@ -0,0 +1,12 @@
+Title: Standard tables now tell their number of rows in page title area
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1517609742
+Class: feature
+
+When a data table is rendered, e.g. like it is done in the configuration GUI on
+a lot of pages, the tables write the number of shown rows to detail text of the
+header area of the page.
diff --git a/web/htdocs/table.py b/web/htdocs/table.py
index d687d61..0d9e75a 100644
--- a/web/htdocs/table.py
+++ b/web/htdocs/table.py
@@ -324,6 +324,7 @@ class Table(object):
def _write_table(self, rows, actions_enabled, actions_visible, search_term):
+ self._update_headinfo(len(rows))
table_id = self.id
num_cols = len(self.headers)
@@ -399,6 +400,11 @@ class Table(object):
html.close_table()
+ def _update_headinfo(self, num_rows):
+ headinfo = _("1 row") if num_rows == 1 else _("%d rows") %
num_rows
+ html.javascript("update_headinfo('%s');" % headinfo)
+
+
def _write_csv(self, csv_separator):
rows = self.rows