def output_availability_csv(what, av_data, avoptions): def cells_from_row(object_titles, cell_titles, row_object, row_cells): 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) av_output_set_content_disposition(_("Check_MK-Availability")) availability_tables = availability.compute_availability_groups( what, av_data, avoptions) table.begin("av_items", output_format="csv") for group_title, availability_table in availability_tables: av_table = availability.layout_availability_table( what, group_title, availability_table, avoptions) pad = 0 for row in av_table["rows"]: table.row() cells_from_row(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"], [(_("Summary"), "")] + [("", "")] * pad, av_table["summary"]) table.end()
def output_availability_csv(what, av_data, avoptions): def cells_from_row(object_titles, cell_titles, row_object, row_cells): 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) av_output_set_content_disposition(_("Check_MK-Availability")) availability_tables = availability.compute_availability_groups(what, av_data, avoptions) table.begin("av_items", output_format="csv") for group_title, availability_table in availability_tables: av_table = availability.layout_availability_table(what, group_title, availability_table, avoptions) pad = 0 for row in av_table["rows"]: table.row() cells_from_row(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"], [(_("Summary"), "")] + [("", "")] * pad, av_table["summary"], ) table.end()
def do_render_availability(what, av_rawdata, av_data, av_mode, av_object, avoptions): if av_mode == "timeline": render_availability_timelines(what, av_data, avoptions) else: availability_tables = availability.compute_availability_groups(what, av_data, avoptions) render_availability_tables(availability_tables, what, avoptions) annotations = availability.load_annotations() render_annotations(annotations, av_rawdata, what, avoptions, omit_service = av_object != None)
def output_availability_csv(what, av_data, avoptions): av_output_csv_mimetype(_("Check_MK-Availability")) availability_tables = availability.compute_availability_groups(what, av_data, avoptions) table.begin("av_items", output_format = "csv") for group_title, availability_table in availability_tables: av_table = availability.layout_availability_table(what, group_title, availability_table, avoptions) for row in av_table["rows"]: table.row() for title, (name, url) in zip(av_table["object_titles"], row["object"]): table.cell(title, name) for (title, help), (text, css) in zip(av_table["cell_titles"], row["cells"]): table.cell(title, text) table.end()