[VVP] Improved readability of reports
[vvp/validation-scripts.git] / ice_validator / tests / report.html.jinja2
1 {## ============LICENSE_START=======================================================#}
2 {## org.onap.vvp/validation-scripts#}
3 {## ===================================================================#}
4 {## Copyright © 2019 AT&T Intellectual Property. All rights reserved.#}
5 {## ===================================================================#}
6 {###}
7 {## Unless otherwise specified, all software contained herein is licensed#}
8 {## under the Apache License, Version 2.0 (the "License");#}
9 {## you may not use this software except in compliance with the License.#}
10 {## You may obtain a copy of the License at#}
11 {###}
12 {##             http://www.apache.org/licenses/LICENSE-2.0#}
13 {###}
14 {## Unless required by applicable law or agreed to in writing, software#}
15 {## distributed under the License is distributed on an "AS IS" BASIS,#}
16 {## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.#}
17 {## See the License for the specific language governing permissions and#}
18 {## limitations under the License.#}
19 {###}
20 {###}
21 {###}
22 {## Unless otherwise specified, all documentation contained herein is licensed#}
23 {## under the Creative Commons License, Attribution 4.0 Intl. (the "License");#}
24 {## you may not use this documentation except in compliance with the License.#}
25 {## You may obtain a copy of the License at#}
26 {###}
27 {##             https://creativecommons.org/licenses/by/4.0/#}
28 {###}
29 {## Unless required by applicable law or agreed to in writing, documentation#}
30 {## distributed under the License is distributed on an "AS IS" BASIS,#}
31 {## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.#}
32 {## See the License for the specific language governing permissions and#}
33 {## limitations under the License.#}
34 {###}
35 {## ============LICENSE_END============================================#}
36 <!DOCTYPE html>
37 <html lang="en">
38 <head>
39     <meta charset="UTF-8">
40     <meta http-equiv="x-ua-compatible" content="ie=edge">
41     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
42     <title>HEAT Validation Report</title>
43     <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
44     <link rel="stylesheet" type="text/css"
45           href="https://cdn.datatables.net/v/zf/jszip-2.5.0/dt-1.10.18/b-1.5.2/b-flash-1.5.2/b-html5-1.5.2/b-print-1.5.2/fh-3.1.4/datatables.min.css"/>
46     <link rel="stylesheet" type="text/css"
47           href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css"/>
48     <link rel="stylesheet"
49           href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.0-rc.2/dist/css/foundation.min.css"
50           integrity="sha256-iJQ8dZac/jUYHxiEnZJsyVpKcdq2sQvdA7t02QFmp30= sha384-SplqNBo/0ZlvSdwrP/riIPDozO5ck8+yIm++KVqyMAC53S6m3BaV+2OLpi7ULOOh sha512-ho6hK4sAWdCeqopNZWNy1d9Ok2hzfTLQLcGSr8ZlRzDzh6tNHkVoqSl6wgLsqls3yazwiG9H9dBCtSfPuiLRCQ=="
51           crossorigin="anonymous">
52
53     <script type="text/javascript"
54             src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
55     <script type="text/javascript"
56             src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
57     <script type="text/javascript"
58             src="https://cdn.datatables.net/v/zf/jszip-2.5.0/dt-1.10.18/b-1.5.2/b-flash-1.5.2/b-html5-1.5.2/b-print-1.5.2/fh-3.1.4/datatables.min.js"></script>
59     <script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.0-rc.2/dist/js/foundation.min.js"
60             integrity="sha256-G6jsRyH1fxbsvFIXSCuwYmI1aIDYBa28xscrvmYjJy0= sha384-vtoG68NvPc9azmFJr447vvY8qgdyA4FdaJ5/bqvzIM4eAdZfO0iyRRF8l2AAscYI sha512-43seCcNrHA0BQgrtyajB9sp8yOdv5c8QdYvgjP7zJ7v+dmzAcxYDQ2gupb9aztsNWBq1COIp/3NHYkQs4l/dkg=="
61             crossorigin="anonymous"></script>
62 </head>
63 <style>
64     #collection_failures {
65         table-layout: fixed;
66     }
67     .fileNames {
68         width: 20%;
69         word-wrap: break-word;
70         word-break: break-all;
71         white-space: normal;
72     }
73     .fixtures {
74         width: 10%;
75     }
76     .errorColumn {
77         width: 40%;
78     }
79     .fileLinks, .errorMessage {
80         word-wrap: break-word;
81         word-break: break-all;
82         white-space: normal;
83     }
84     .details {
85         white-space: nowrap;
86     }
87
88     .codeCell {
89         width: 100%;
90         overflow: auto;
91     }
92 </style>
93 <body>
94 <div class="grid-container fluid">
95
96     <div class="callout {{ "alert" if failures or collection_failures else "success" }}">
97         <h1>Validation Report</h1>
98         <ul>
99             <li><b>Categories:</b> {{ categories }}</li>
100             <li><b>Tool Version:</b> {{ version }}</li>
101             <li><b>Directory Validated:</b> {{ template_dir }}</li>
102             <li><b>Checksum:</b> {{ checksum }}</li>
103             <li><b>Generated:</b> {{ timestamp }}</li>
104             <li><b>Total Failures:</b> {{ num_failures }}</li>
105         </ul>
106     </div>
107     {% if collection_failures %}
108         <div class="callout alert">
109             <h2>WARNING: Errors Occurred During Validation Setup</h2>
110             <p>
111                 The following unexpected errors occurred while preparing to validate
112                 the the input files. Some validations may not have been executed.
113                 Please refer these issue to the VNF Validation Tool team.
114             </p>
115         </div>
116         <table id="collection_failures">
117             <thead>
118             <tr>
119                 <th class="fileNames">Validation File</th>
120                 <th class="fileNames">Test</th>
121                 <th class="fixtures">Fixtures</th>
122                 <th class="errorColumnn">Error</th>
123             </tr>
124             </thead>
125             <tbody>
126             {% for failure in collection_failures %}
127                 <tr>
128                     <td class="fileNames">{{ failure.module }}</td>
129                     <td class="fileNames">{{ failure.test }}</td>
130                     <td class="fixtures">{{ failure.fixtures }}</td>
131                     <td class="errorColumn">
132                         <div class="codeCell">
133                             <pre class="code">{{ failure.error }}</pre>
134                         </div>
135                     </td>
136                 </tr>
137             {% endfor %}
138             </tbody>
139         </table>
140     {% endif %}
141
142     {% if failures %}
143         <h2>Validation Failures</h2>
144         <table id="failures">
145             <thead>
146             <tr>
147                 <th>File(s)</th>
148                 <th>Error Message</th>
149                 <th>Requirement(s)</th>
150             </tr>
151             </thead>
152             <tbody>
153             {% for failure in failures %}
154                 <tr>
155                     <td>
156                         {{ failure.file_links }}
157                     </td>
158                     <td>
159                         <p><b>Failed:</b> {{ failure.test_id }}</p>
160                         <p>{{ failure.error_message }}
161                             <a class="details" href="#"
162                                data-open="raw-output-{{ loop.index }}">Full&nbsp;Details</a>
163                         </p>
164                     </td>
165                     <td>
166                         {{ failure.requirements }}
167                     </td>
168                 </tr>
169             {% endfor %}
170             </tbody>
171             {% for failure in failures %}
172                 <div id="raw-output-{{ loop.index }}" class="large reveal" data-reveal
173                      aria-labelledby="modalTitle"
174                      aria-hidden="true" role="dialog">
175                     <h2 id="modalTitle">{{ failure.test_id }}</h2>
176                     <pre class="code">
177                             {{ failure.raw_output }}
178                         </pre>
179                     <button class="close-button" data-close aria-label="Close modal"
180                             type="button">
181                         <span aria-hidden="true">&times;</span>
182                     </button>
183                     <a class="close-reveal-modal" aria-label="Close">&#215;</a>
184                 </div>
185             {% endfor %}
186         </table>
187     {% else %}
188         <h2>No validation errors found.</h2>
189     {% endif %}
190     <script lang="javascript">
191         $(document).foundation();
192         $(document).ready(function () {
193             $('#failures').DataTable({
194                 dom: 'Bfrtip',
195                 buttons: [
196                     'csv',
197                     {
198                         extend: 'pdfHtml5',
199                         orientation: 'landscape',
200                     },
201                     'print'
202                 ],
203                 fixedHeader: true,
204                 pageLength: 50,
205                 columns: [
206                     {width: "20%", className: "fileLinks"},
207                     {width: "40%", className: "errorMessage"},
208                     {width: "40%", className: "requirements"},
209                 ]
210             });
211         });
212     </script>
213 </div>
214 </body>
215 </html>