github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/control/controldisplay/templates/html/output.tmpl (about) 1 {{ define "output" }} 2 <!DOCTYPE html> 3 <html lang="en"> 4 5 <head> 6 <title>Steampipe Report</title> 7 <style> 8 /** 9 {{- template "normalize_css" -}} 10 **/ 11 /** 12 {{- template "style_css" -}} 13 **/ 14 </style> 15 <meta charset="UTF-8"> 16 <link rel="icon" href='{{ template "favicon" }}' type="image/svg+xml" sizes="any"> 17 </head> 18 19 <body> 20 <div class="container"> 21 {{/* we expect 0 or 1 root control runs */}} 22 {{ range .Data.Root.ControlRuns -}} 23 {{ template "control_run_template" . -}} 24 {{ end }} 25 {{/* we expect 0 or 1 root groups */}} 26 {{ range .Data.Root.Groups -}} 27 {{ template "root_group_template" . -}} 28 {{ end }} 29 <footer><em>Report run at <code>{{ .Data.StartTime.Format "2006-01-02 15:04:05" }}</code> using <a href="https://steampipe.io" 30 rel="nofollow"><code>Steampipe {{ .Constants.SteampipeVersion }}</code></a> in dir 31 <code>{{ .Constants.WorkingDir }}</code>.</em></footer> 32 </div> 33 </body> 34 35 </html> 36 {{ end }} 37 38 {{ define "root_summary" }} 39 <table role="table"> 40 <thead> 41 <tr> 42 <th></th> 43 <th>TOTAL</th> 44 <th>{{ .TotalCount }}</th> 45 </tr> 46 </thead> 47 <tbody> 48 <tr> 49 <td class="align-center">✅</td> 50 <td>OK</td> 51 <td class="{{ template "summaryokclass" .Ok }}">{{ .Ok }}</td> 52 </tr> 53 <tr> 54 <td class="align-center">⇨</td> 55 <td>Skip</td> 56 <td class="{{ template "summaryskipclass" .Skip}}">{{ .Skip }}</td> 57 </tr> 58 <tr> 59 <td class="align-center">ℹ</td> 60 <td>Info</td> 61 <td class="{{ template "summaryinfoclass" .Info}}">{{ .Info }}</td> 62 </tr> 63 <tr> 64 <td class="align-center">❌</td> 65 <td>Alarm</td> 66 <td class="{{ template "summaryalarmclass" .Alarm}}">{{ .Alarm }}</td> 67 </tr> 68 <tr> 69 <td class="align-center">❗</td> 70 <td>Error</td> 71 <td class="{{ template "summaryerrorclass" .Error}}">{{ .Error }}</td> 72 </tr> 73 </tbody> 74 </table> 75 {{ end }} 76 77 {{ define "summary" }} 78 <table role="table"> 79 <thead> 80 <tr> 81 <th>OK</th> 82 <th>Skip</th> 83 <th>Info</th> 84 <th>Alarm</th> 85 <th>Error</th> 86 <th>Total</th> 87 </tr> 88 </thead> 89 <tbody> 90 <tr> 91 <td class="{{ template "summaryokclass" .Ok }}">{{ .Ok }}</td> 92 <td class="{{ template "summaryskipclass" .Skip }}">{{ .Skip }}</td> 93 <td class="{{ template "summaryinfoclass" .Info }}">{{ .Info }}</td> 94 <td class="{{ template "summaryalarmclass" .Alarm }}">{{ .Alarm }}</td> 95 <td class="{{ template "summaryerrorclass" .Error }}">{{ .Error }}</td> 96 <td>{{ .TotalCount }}</td> 97 </tr> 98 </tbody> 99 </table> 100 {{ end }} 101 102 {{ define "root_group_template"}} 103 <section class="group"> 104 <div class="header"> 105 <h1 class="title">{{ .Title }}</h1> 106 <a href="https://steampipe.io" rel="noopener noreferrer" target="_blank"><img class="logo" src="{{ template "logo"}}" alt="Steampipe Report" /></a> 107 </div> 108 {{ template "root_summary" .Summary.Status }} 109 110 {{ if .ControlRuns }} 111 {{ range .ControlRuns}} 112 {{ template "control_run_template" . }} 113 {{ end }} 114 {{ end }} 115 116 {{ range .Groups }} 117 {{ template "group_template" . }} 118 {{ end }} 119 </section> 120 {{ end }} 121 122 {{ define "group_template"}} 123 <section class="group"> 124 <h2>{{ .Title }}</h2> 125 {{ template "summary" .Summary.Status }} 126 127 {{ if .ControlRuns }} 128 {{ range .ControlRuns}} 129 {{ template "control_run_template" . }} 130 {{ end }} 131 {{ end }} 132 133 {{ range .Groups }} 134 {{ template "group_template" . }} 135 {{ end }} 136 </section> 137 {{ end }} 138 139 {{ define "control_run_template"}} 140 <section class="control"> 141 <h3>{{ .Title }}</h3> 142 143 {{ if .Description }} 144 <p><em>{{ .Description }}</em></p> 145 {{ end }} 146 147 {{ template "summary" .Summary }} 148 149 {{ if .GetError }} 150 <blockquote>{{ .GetError }}</blockquote> 151 {{ else }} 152 {{ $length := len .Rows }} 153 {{ if gt $length 0 }} 154 {{ template "control_run_table_template" . }} 155 {{ end }} 156 {{ end }} 157 </section> 158 {{ end }} 159 160 {{ define "control_run_table_template" }} 161 <table role="table"> 162 <thead> 163 <tr> 164 <th></th> 165 <th>Reason</th> 166 <th>Dimensions</th> 167 </tr> 168 </thead> 169 <tbody> 170 {{ range .Rows }} 171 {{ template "control_run_table_row_template" . }} 172 {{ end }} 173 </tbody> 174 </table> 175 {{ end }} 176 177 {{ define "control_run_table_row_template" }} 178 <tr> 179 <td class="align-center" title="Resource: {{ .Resource }}">{{ template "statusicon" .Status }}</td> 180 <td title="Resource: {{ .Resource }}">{{ .Reason }}</td> 181 <td> 182 {{ range .Dimensions }} 183 <code>{{ .Value }}</code> 184 {{ end }} 185 </td> 186 </tr> 187 {{ end }} 188 189 {{ define "statusicon" }} 190 {{- if eq . "ok" -}} 191 ✅ 192 {{- end -}} 193 {{- if eq . "skip" -}} 194 ⇨ 195 {{- end -}} 196 {{- if eq . "info" -}} 197 ℹ 198 {{- end -}} 199 {{- if eq . "alarm" -}} 200 ❌ 201 {{- end -}} 202 {{- if eq . "error" -}} 203 ❗ 204 {{- end -}} 205 {{- end -}} 206 207 {{ define "summaryokclass" }} 208 {{- if gt . 0 -}} 209 summary-total-ok highlight 210 {{- end -}} 211 {{- if eq . 0 -}} 212 summary-total-ok 213 {{- end -}} 214 {{- end -}} 215 216 {{ define "summaryskipclass" }} 217 {{- if gt . 0 -}} 218 summary-total-skip highlight 219 {{- end -}} 220 {{- if eq . 0 -}} 221 summary-total-skip 222 {{- end -}} 223 {{- end -}} 224 225 {{- define "summaryinfoclass" }} 226 {{- if gt . 0 -}} 227 summary-total-info highlight 228 {{- end -}} 229 {{- if eq . 0 -}} 230 summary-total-info 231 {{- end -}} 232 {{- end -}} 233 234 {{- define "summaryalarmclass" }} 235 {{- if gt . 0 -}} 236 summary-total-alarm highlight 237 {{- end -}} 238 {{- if eq . 0 -}} 239 summary-total-alarm 240 {{- end -}} 241 {{- end -}} 242 243 {{- define "summaryerrorclass" }} 244 {{- if gt . 0 -}} 245 summary-total-error highlight 246 {{- end -}} 247 {{- if eq . 0 -}} 248 summary-total-error 249 {{- end -}} 250 {{- end -}}