Sane Reports by Demisto
Reports library that will keep you sane and not pulling your hair out
PhantomJS
$ npm install sane-reports
$ cd sane-reports
$ phantomjs reportsServer.js templates/test.json dist/test.pdf
Chromium/Chrome
$ npm install sane-reports
$ npm run make
$ ./reportsServer templates/test.json dist/test.pdf # for linux users.
$ ./reportsServer-macos templates/test.json dist/test.pdf # for macOS users.
Report will be generated in: dist/test.pdf
$ git clone git@github.com:demisto/sane-reports.git
$ cd sane-reports
$ npm install
$ npm start
Now open browser at: http://localhost:8082
$ git clone git@github.com:demisto/sane-reports.git
$ cd sane-reports
$ npm install
$ npm run production
$ npm run generate-report
This will generate a PDF report in the dist
folder. The name of the report will start with report-
.
You can create PDF report with the following command as well:
phantomjs reportServer.js <report_template_file> [<output_file> <dist_folder> <orientation> <resourceTimeout> <type> <headerLeftImage> <headerRightImage> <customReportType> <pageSize>]
./reportsServer <report_template_file> [<output_file> <dist_folder> <orientation> <resourceTimeout> <type> <headerLeftImage> <headerRightImage> <customReportType> <pageSize> <chromiumPath>]
- report_template_file: The template of the report (JSON format)
- output_file: The name of the generated report (leave empty for default name)
- dist_folder: should be
dist
- orientation: The orientation of the report: portrait/landscape (default portrait)
- resourceTimeout: Timeout for generating the report (default is 4000ms)
- type: The report type: pdf or csv (default is pdf)
- headerLeftImage: The image to show at the left side of the report header of each page (base64 or url)
- headerRightImage: The image to show at the right side of the report header of each page (base64 or url)
- customReportType: Custom report type if needed. currently not used.
- pageSize: The report page size to generate. Possible: A4, A3, A5, letter (default A4).
- chromiumPath: a custom chromium or chrome path. The service searches for installed chromium or chrome by order. Default usage by priority: Chromium -> Google Chrome Stable -> Google Chrome -> the default path '/usr/bin/chromium-browser'.
phantomjs reportsServer.js templates/test.json dist/test.pdf dist portrait 4000 pdf
./reportsServer templates/test.json dist/test.pdf dist portrait 4000 pdf
phantomjs reportsServer.js templates/testCSV.json dist/test.csv dist portrait 4000 csv
./reportsServer templates/testCSV.json dist/test.csv dist portrait 4000 csv
Reports templates (JSON) examples can be found in the templates folder.
Example reports outputs can be found in the examples folder.
You can edit existing report templates or create your own template. Report templates are created in JSON format and includes sections. Sections are ordered according to their row and column positions.
Section types: Header, Divider, Date, Image, JSON, Markdown, Table, Text, Bar Chart, Line Chart, Pie Chart
Each section can have its own style (camled case css style: font-size -> fontSize).
demisto/sane-reports is licensed under the Apache License 2.0