{# Defensive defaults — keep the template renderable when the upstream transform short-circuited. Mirrors B.1 cve_component_evidence.html and sibling C.1 component_remediation_package.html. Placed BEFORE the render-mode gate so fragment and standalone modes share the same defaults. #} {% set summary = summary | default({}) %} {% if not summary is mapping %}{% set summary = {} %}{% endif %} {% set locations = locations | default([]) %} {# Macro import — produces no output, just binds `fs` to the namespace. Safe to hoist above the render-mode gate. #} {% import "_console_macros.html" as fs with context %} {# Build topbar meta items conditionally. #} {% set ci_meta = [{"label": "Domain", "value": domain or "—"}] %} {% set _ = ci_meta.append({"label": "Scope", "value": scope_label or "All Projects"}) %} {% if summary.get('component_name') %} {% set _ = ci_meta.append({"label": "Component", "value": summary.component_name}) %} {% endif %} {% if summary.get('version_range') %} {% set _ = ci_meta.append({"label": "Version range", "value": summary.version_range}) %} {% endif %} {% set _ = ci_meta.append({"label": "Generated", "value": generated_at or "—"}) %} {% if render_mode != 'fragment' %} {% if domain %}{% endif %} Component Impact Report - Finite State Report {# No charts in this recipe (output.charts: []) — ECharts CDN is intentionally NOT included. Only design-system tokens + console shell chrome. Pre-migration template had dead Chart.js + chartjs-plugin-datalabels CDN tags; those are removed. #} {% include "_design_system.html" %} {% include "_console_shell.html" %} {% endif %} {# Recipe-local styles — render in BOTH standalone and fragment modes so fragment_extractor (_STYLE_RE) collects them, scopes under .fs-section-component-impact, and re-emits at the top of the fragment. #} {% if render_mode != 'fragment' %} {% endif %} {% if render_mode != 'fragment' %} {{ fs.topbar( crumbs=["Finite State", "Component Impact"], meta=ci_meta, controls=[], ) }} {% endif %}

Component Impact Report

{{ summary.get('component_name', 'Unknown Component') }} — Blast Radius Analysis

{# 5 KPI cells via fs.kpi_cell. #}
{{ fs.kpi_cell( "Projects with Component", summary.get('projects_with_component', 0), dot=("critical" if summary.get('projects_with_component', 0) > 0 else None), ) }} {{ fs.kpi_cell( "With Known CVEs", summary.get('projects_with_findings', 0), dot=("high" if summary.get('projects_with_findings', 0) > 0 else None), ) }} {{ fs.kpi_cell( "Total CVE Findings", summary.get('total_cve_count', 0), ) }} {{ fs.kpi_cell( "Critical", summary.get('critical_count', 0), dot=("critical" if summary.get('critical_count', 0) > 0 else None), ) }} {{ fs.kpi_cell( "High", summary.get('high_count', 0), dot=("high" if summary.get('high_count', 0) > 0 else None), ) }}
{% if summary.get('version_range') %}
⚠ Version range filter active: {{ summary.version_range }} — only projects with matching component versions are shown.
{% endif %} {% if locations and (locations | length) > 0 %}
{{ fs.panel_head("Portfolio locations", meta=((locations | length) | string) ~ " project" ~ ("s" if (locations | length) != 1 else "")) }}

{{ locations | length }} project(s) contain {{ summary.get('component_name', 'this component') }}. Projects with known CVE findings are listed first.

{% for loc in locations %} {% if loc is mapping %} {% set with_cves = (loc.get('cve_count', 0) | int) > 0 %} {% endif %} {% endfor %}
Project Detected Version(s) CVE Findings Critical High Top CVE
{{ loc.get('project_name', '') }} {% if loc.get('detected_versions') %} {{ loc.detected_versions | join(', ') }} {% else %} {% endif %} {% if (loc.get('cve_count', 0) | int) > 0 %} {{ loc.cve_count }} {% else %} {% endif %} {% if (loc.get('critical_count', 0) | int) > 0 %} {{ loc.critical_count }} {% else %} {% endif %} {% if (loc.get('high_count', 0) | int) > 0 %} {{ loc.high_count }} {% else %} {% endif %} {% if loc.get('top_cves') and (loc.top_cves | length) > 0 %} {% set tc = loc.top_cves[0] %} {% set sev = (tc.get('severity', '') | upper) %} {{ tc.get('cve_id', '') }} {% if sev == 'CRITICAL' %}{{ sev }} {% elif sev == 'HIGH' %}{{ sev }} {% elif sev == 'MEDIUM' %}{{ sev }} {% elif sev == 'LOW' %}{{ sev }} {% else %}{{ sev or 'UNKNOWN' }}{% endif %} {% if (loc.top_cves | length) > 1 %} +{{ loc.top_cves | length - 1 }} more {% endif %} {% else %} No CVE findings {% endif %}
{% else %}
✓ No projects found containing {{ summary.get('component_name', 'this component') }}{% if summary.get('version_range') %} in version range {{ summary.version_range }}{% endif %}.
{% endif %}
{% if render_mode != 'fragment' %} {{ fs.status_bar(items=[ "Recipe: Component Impact", "Projects: " ~ ((locations | length) | string), "CVE findings: " ~ ((summary.get('total_cve_count', 0)) | string), generated_at | default(''), ], version='fs-report ' ~ (fs_report_version | default('dev'))) }} {% endif %} {% if render_mode != 'fragment' %} {% include '_action_buttons.html' %} {% endif %}