OpenSCAP / openscap-report

Tool for generating a report from results of oscap scan.
Other
17 stars 9 forks source link

Stop creating HTML content programatically #236

Open jan-cerny opened 2 weeks ago

jan-cerny commented 2 weeks ago

Is your feature request related to a problem? Please describe. Some parts of the HTML content are created by the JavaScript code. Namely, the tables and other HTML content in the "Show test details" section are created by instating elements and attributes by calling JavaScript functions.

Please see openscap_report/report_generators/html_templates/js/oval_graph_generation_script.js, for example https://github.com/OpenSCAP/openscap-report/blob/813a4400d861fc48b889fa7a29fdc6c942af376f/openscap_report/report_generators/html_templates/js/oval_graph_generation_script.js#L669 https://github.com/OpenSCAP/openscap-report/blob/813a4400d861fc48b889fa7a29fdc6c942af376f/openscap_report/report_generators/html_templates/js/oval_graph_generation_script.js#L820 https://github.com/OpenSCAP/openscap-report/blob/813a4400d861fc48b889fa7a29fdc6c942af376f/openscap_report/report_generators/html_templates/js/oval_graph_generation_script.js#L553

This approach is tedious, laborious, hard to orient in and difficult to maintain. Moreover, it mixes a definition of the presentation layout with data processing.

Describe the solution you'd like It would be great to employ Jinja 2 templates here or some other "templating" technology.

Describe alternatives you've considered I haven't considered any alternatives yet. But I'm open to any proposals or suggestions.

Additional context None

Honny1 commented 2 weeks ago

@jan-cerny Javascript generates the OVAL graph because web browsers have problems with HTML files with many HTML tags. The OVAL graph is generated on demand by the user using the show_rule_detail function. Unfortunately, details of the OVAL test and state are included in the OVAL graph.