| 413 | } |
| 414 | |
| 415 | fn render_finding_card(f: &Finding) -> String { |
| 416 | let sev = match f.severity.as_str() { |
| 417 | SEV_BLOCK => "block", |
| 418 | SEV_WARN => "warn", |
| 419 | SEV_INFO => "info", |
| 420 | _ => "info", |
| 421 | }; |
| 422 | let mut card = String::new(); |
| 423 | card.push_str(&format!( |
| 424 | "<div class=\"finding {sev}\" data-severity=\"{sev}\">\n" |
| 425 | )); |
| 426 | card.push_str(&format!( |
| 427 | "<div class=\"finding-head\"><span class=\"sev-badge {sev}\">{}</span><span class=\"code\">{}</span></div>\n", |
| 428 | html_escape(sev), |
| 429 | html_escape(&f.code) |
| 430 | )); |
| 431 | card.push_str(&format!( |
| 432 | "<div class=\"message\">{}</div>\n", |
| 433 | html_escape(&f.message) |
| 434 | )); |
| 435 | card.push_str(&format!( |
| 436 | "<div class=\"focus\">focus: <code>{}</code></div>\n", |
| 437 | html_escape(&f.focus) |
| 438 | )); |
| 439 | if let Some(q) = &f.suggested_query { |
| 440 | card.push_str(&format!( |
| 441 | "<div class=\"query\">query: <code>{}</code></div>\n", |
| 442 | html_escape(q) |
| 443 | )); |
| 444 | } |
| 445 | if let Some(r) = &f.remedy { |
| 446 | card.push_str(&format!( |
| 447 | "<div class=\"remedy\">remedy: {}</div>\n", |
| 448 | html_escape(r) |
| 449 | )); |
| 450 | } |
| 451 | card.push_str("</div>\n"); |
| 452 | card |
| 453 | } |
| 454 | |
| 455 | fn render_intent(intent: &IntentReport) -> String { |
| 456 | let conform = if intent.conforms { |