Module: check_mk
Branch: master
Commit: efdfe0b6bf5aece24395896cf315532b073f51f3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=efdfe0b6bf5aec…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 8 10:25:27 2016 +0100
4136 Availability CSV export: Adding grouping title as first column in case of grouped
views
---
.werks/4136 | 9 +++++++++
ChangeLog | 1 +
web/plugins/views/availability.py | 18 +++++++++++++++---
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/.werks/4136 b/.werks/4136
new file mode 100644
index 0000000..ba0c8f1
--- /dev/null
+++ b/.werks/4136
@@ -0,0 +1,9 @@
+Title: Availability CSV export: Adding grouping title as first column in case of grouped
views
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.4.0i3
+Date: 1481189103
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ec66a46..ad6f571 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,7 @@
* 3997 New metric for mrpe/check_icmp...
* 4083 Web API: Always output full traceback in case of non Check_MK unhandled
exceptions
* 4135 View CSV export: Group cells are added in front of the regular cells for each
row...
+ * 4136 Availability CSV export: Adding grouping title as first column in case of
grouped views
* 3974 FIX: Sorting comments in hover menu of comments icon by time now
* 4040 FIX: Fix error in view about "No WATO folder ..." in case of host
imported via cmcdump...
* 4046 FIX: Repaired html rendering....
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 22b0d92..7aab6e5 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -831,9 +831,13 @@ def handle_edit_annotations():
# '----------------------------------------------------------------------'
def output_availability_csv(what, av_data, avoptions):
- def cells_from_row(object_titles, cell_titles, row_object, row_cells):
+ def cells_from_row(group_titles, group_cells, object_titles, cell_titles, row_object,
row_cells):
+ for column_title, group_title in zip(group_titles, group_cells):
+ table.cell(column_title, group_title)
+
for title, (name, url) in zip(object_titles, row_object):
table.cell(title, name)
+
for (title, help), (text, css) in zip(cell_titles, row_cells):
table.cell(title, text)
@@ -843,14 +847,22 @@ def output_availability_csv(what, av_data, avoptions):
for group_title, availability_table in availability_tables:
av_table = availability.layout_availability_table(what, group_title,
availability_table, avoptions)
pad = 0
+
+ if group_title:
+ group_titles, group_cells = [_("Group")], [group_title]
+ else:
+ group_titles, group_cells = [], []
+
for row in av_table["rows"]:
table.row()
- cells_from_row(av_table["object_titles"],
av_table["cell_titles"],
+ cells_from_row(group_titles, group_cells,
+ av_table["object_titles"],
av_table["cell_titles"],
row["object"], row["cells"])
# presumably all rows have the same width
pad = len(row["object"]) - 1
table.row()
- cells_from_row(av_table["object_titles"],
av_table["cell_titles"],
+ cells_from_row(group_titles, group_cells,
+ av_table["object_titles"],
av_table["cell_titles"],
[(_("Summary"), "")] + [("",
"")] * pad, av_table["summary"])
table.end()