Add functionality to sort reports in ascending or descending order generated using Reporting Engine
1. Proposed title of this feature request
- [RFE] Add functionality to sort reports in ascending or descending order generated using Reporting Engine in Red Hat Satellite 6
2. Who is the customer behind the request?
3. What are the nature and description of the request?
- Reporting Engine was introduced from Red Hat Satellite 6.5
- While generating reports in Red Hat Satellite 6 using Reporting Engine
- (Satellite Web UI --> Monitor --> Report Template)
- There is no option to generate a report in ascending or descending order
- And the report will be generated according to registration date and time.
4. Why does the customer need this? (List the business requirements here)
- As the report is getting generated according to registration Date and Time
- This is a general request to have option to generate report in ascending or descending order
5. How would the customer like to achieve this? (List the functional requirements here)
6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.
- We can test it by generating a report using Reporting Engine (Satellite Web UI --> Monitor --> Report Template)
7. Is there already an existing RFE upstream or in Red Hat Bugzilla?:
8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?
- No. There is no timeline but it is a basic requirement.
9. Is the sales team involved in this request and do they have any additional input?
10. List any affected packages or components.
11. Would the customer be able to assist in testing this functionality if implemented?
- We can test it by generating report using Reporting Engine (Satellite Web UI --> Monitor --> Report Template)
Fixes #29578 - add sorting feature to reports
Reports usually generate a tabular data using the report_render
macro. There is no way to sort such output. This patch adds a new
parameter to report_render macro allowing to specify one or more
columns for sorting.
<%= report_render order: 'Name' -%>
<%= report_render order: [ 'Name', 'Age' ] -%>
Also it may be useful to reverse the order of the report. For this
purpose a second parameter was added
<%= report_render order: [ 'Name' ], :reverse_order: true -%>
Note that both can be used independently.
For unknown column, rendering error is presented calling out the values
that were not recognized. We support all headers registered using the
report_headers macro as well as names used when calling report_row
macro, as illustrated in the following example
<%- report_headers 'Name'
> report_row Name: 'Ares', Age: 123 -%>
<%= report_render order: 'Age' %>
The performance impact was checked. Ordering roughly doubles the raw
rendering time, meaning the time the report_render method takes. The
order reversing is nearly instant.
On report with 10_000 rows, it added 0.05s which in such
big reports is marginal thing. Usually the report spend minutes on
parsing ActiveRecord data.