divinity666 / ruby-grafana-reporter

Reporting Service for Grafana
MIT License
66 stars 5 forks source link

ERB Processor result is impossible to download #51

Open andrejshapal opened 3 weeks ago

andrejshapal commented 3 weeks ago

Describe the issue When ERB processor is used, the result file is getting saved as a plain text, but view function (downloading) is adding zip extension to the file which does not make sense.

= Demo report

Created by `+ruby-grafana-reporter+` version 0.7.0

== Examples

=== DemoReportBuilder

<%
dashboard = 'd7eb20c0-a18e-4585-a46c-9c5c8f909e40'
instance = 'default'
# load the panel object from grafana instance
panel = @report.grafana(instance).dashboard(dashboard).panel(1)
# build a complete attributes hash, including the variables set for this report call
# e.g. including command line parameters etc.
attrs = @attributes.merge({ 'result_type' => 'panel_table', 'query' => 'A' })
query = QueryValueQuery.new(panel, variables: attrs)
%>

This is a test table for panel <%= panel.id %>:

<%= query.execute %>

For detailed API documentation you may start with:
  1) the AbstractReport (https://rubydoc.info/gems/ruby-grafana-reporter/GrafanaReporter/AbstractReport), or
  2) subclasses of the AbstractQuery (https://rubydoc.info/gems/ruby-grafana-reporter/GrafanaReporter/AbstractQuery)
# This configuration has been built with the configuration wizard.

grafana:
  default:
    host: https://play.grafana.org

grafana-reporter:
# Specifies how often the reporter shall check for newer versions [number of days].
# You may set check-for-updates to 0 to disable
  check-for-updates: 0
  report-class: GrafanaReporter::ERB::Report
  templates-folder: /home/andrejs/repo/grafana-reporter/tests/templates
  reports-folder: /home/andrejs/repo/grafana-reporter/tests/reports
  report-retention: 24
  webservice-port: 8815
# you may want to configure the following webhook callbacks to get informed on certain events
#  callbacks:
#    all:
#      - <<your_callback_url>>
#      - ...
#    on_before_create:
#      - <<your_callback_url>>
#      - ...
#    on_after_cancel:
#      - <<your_callback_url>>
#      - ...
#    on_after_finish:
#      - <<your_callback_url>>
#      - ...

default-document-attributes:
  imagesdir: ./images
# feel free to add here additional asciidoctor document attributes which are applied to all your templates

http://localhost:8815/render?var-template=demo_report&from=now-1y&to=now

Environment (please complete the following information):