Project

General

Profile

Feature #25099

Report templates need macros for easy report definition

Added by Martin Bacovsky 3 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
Reporting
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

There is no easy way how to define and manage template producing valid CSV output.

Tasks that needs to be easier:
- visually match header and values
- reorder columns
- comment out column
- copy & paste column def from other reports
- generate properly quoted and valid CSV


Related issues

Related to Foreman - Feature #10521: As a user i like to have an advanced reporting system with fully customizable reportsClosed

Associated revisions

Revision 63fbccbf (diff)
Added by Martin Bacovsky 2 months ago

Fixes #25099 - Add macros for easier report definition

Add rows to a report with
<%- report_row(
'Column header 1': 'Value 1',
'Column header 2': `Value 2`,
) -%>
and render the report with
<%= report_render -%>

Each row of the report needs to have the same columns.
report_render produces properly quoted valid CSV.
Values are converted to a String using to_s.
Enumerable values are comma separated and serialized.

Experimental render to YAML is included (report_render(format: :yaml)
Enumerable values are kept structured in this format.

History

#1 Updated by The Foreman Bot 3 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6100 added

#2 Updated by Martin Bacovsky 3 months ago

  • Related to Feature #10521: As a user i like to have an advanced reporting system with fully customizable reports added

#3 Updated by Marek Hulán 2 months ago

  • Fixed in Releases 1.20.0 added

#4 Updated by Martin Bacovsky 2 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF