Module: check_mk
Branch: master
Commit: 98367ba686a058c740b4d393e0c75d62680044d9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=98367ba686a058…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 23 15:43:56 2016 +0200
3892 FIX CSV export of views: Joined columns have now a title
The title cells of joined columns (service columns in host views) had no title in
CSV exports of views. Now, the titles have been added and are computed as follows:
[painter_name].[service_description_of_join_service]
For example:
perfometer.CPU load
---
.werks/3892 | 16 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/views.py | 9 +++++++++
web/plugins/views/webservice.py | 6 +++---
4 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/.werks/3892 b/.werks/3892
new file mode 100644
index 0000000..9e35ffb
--- /dev/null
+++ b/.werks/3892
@@ -0,0 +1,16 @@
+Title: CSV export of views: Joined columns have now a title
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i1
+Date: 1474638125
+Class: fix
+
+The title cells of joined columns (service columns in host views) had no title in
+CSV exports of views. Now, the titles have been added and are computed as follows:
+
+[painter_name].[service_description_of_join_service]
+
+For example:
+
+perfometer.CPU load
diff --git a/ChangeLog b/ChangeLog
index e1ca282..c9c0568 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -520,6 +520,7 @@
* 3871 FIX: stale services view: excluded services in downtime per default
* 3874 FIX: fixed graphs displaying wrong labels
* 3885 FIX: Fixed sorting of version in werk list (1.2.8p10 and 1.2.8p11 were not
listed on top)
+ * 3892 FIX: CSV export of views: Joined columns have now a title...
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 7c5c601..08c4797 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -704,6 +704,10 @@ class Cell(object):
return self._painter_name
+ def export_title(self):
+ return self._painter_name
+
+
def painter_options(self):
return self.painter().get("options", [])
@@ -982,6 +986,11 @@ class JoinCell(Cell):
return self._join_service_descr
+ def export_title(self):
+ return "%s.%s" % (self._painter_name, self.join_service())
+
+
+
class EmptyCell(Cell):
def __init__(self, view):
diff --git a/web/plugins/views/webservice.py b/web/plugins/views/webservice.py
index 5fa0f9d..32cbaa8 100644
--- a/web/plugins/views/webservice.py
+++ b/web/plugins/views/webservice.py
@@ -41,7 +41,7 @@ multisite_layouts["python-raw"] = {
def render_python(rows, view, group_cells, cells, num_columns, show_checkboxes):
html.write("[\n")
- html.write(repr([cell.painter_name() for cell in cells]))
+ html.write(repr([cell.export_title() for cell in cells]))
html.write(",\n")
for row in rows:
html.write("[")
@@ -71,7 +71,7 @@ def render_json(rows, view, group_cells, cells, num_columns,
show_checkboxes, ex
header_row = []
for cell in cells:
- header_row.append(html.strip_tags(cell.painter_name()))
+ header_row.append(html.strip_tags(cell.export_title()))
painted_rows.append(header_row)
for row in rows:
@@ -135,7 +135,7 @@ def render_csv(rows, view, group_cells, cells, num_columns,
show_checkboxes, exp
first = False
else:
html.write(csv_separator)
- content = cell.painter_name()
+ content = cell.export_title()
content = type(content) in [ int, float ] and str(content) or content
stripped = html.strip_tags(content).replace('\n',
'').replace('"', '""')
html.write('"%s"' % stripped.encode("utf-8"))