{# Fragment: Opportunities table + empty states + pagination. Rendered by initial page load ({% include %}) and SSE endpoint (patch_elements). Expects: opportunities (list[dict]), pagination (PaginationContext), config, search_query, selected_status #}
| {{ col_label }} | {% endfor %}Solution | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| {{ opp.type | replace('_', ' ') }} | {{ opp.dbt_model if opp.dbt_model != '—' else opp.table_short }} |
{% if opp.severity_score >= 70 %}High{% elif opp.severity_score >= 40 %}Medium{% else %}Low{% endif %}
|
{% if opp.query_workload_kind == 'build' %} Build {% elif opp.query_workload_kind == 'consumption' %} Consumption {% elif local_execution_mode %} Unclassified {% else %} Other {% endif %} |
{% if opp.query_cost_value is not none %}
{{ opp.query_cost_value | format_usd }}
{{ opp.query_cost_source_label }}
{% else %}
—
{% endif %}
|
{% if opp.optimized_cost_value is not none %}
{{ opp.optimized_cost_value | format_usd }}
{% if opp.optimized_delta_direction == 'down' %}
↓
{% elif opp.optimized_delta_direction == 'up' %}
↑
{% endif %}
{{ opp.optimized_cost_source_label }}
Generating
Solution {{ 'running' if opp.solution_job_status == 'in_progress' else 'queued' }}
{% elif opp.possible_savings_value is not none %}
~{{ opp.possible_savings_value | format_usd }}
↓
{{ opp.possible_savings_label }}
|
{% if local_execution_mode and opp.status == 'pr_pending' %} Local Change Pending {% elif local_execution_mode and opp.status == 'clearing' %} Pending Verification {% elif opp.status == 'pr_pending' %} PR Pending {% elif opp.status == 'resolved' %} Resolved {% elif opp.status == 'clearing' %} Clearing {% else %} Active {% endif %} | {{ opp.occurrence_count }} | {{ opp.created_at }} | {% if opp.solution_risk_level == 'low' %} Safe {% elif opp.solution_risk_level == 'medium' %} Review {% elif opp.solution_risk_level == 'high' %} High risk {% elif opp.solution_job_status in ('queued', 'in_progress') %} {{ 'Running' if opp.solution_job_status == 'in_progress' else 'Queued' }} {% else %} Pending {% endif %} |
No opportunities match your filter.
{% elif selected_status == 'active' and background_jobs_running %}Analysis in progress — opportunities and savings are still being updated.
{% elif selected_status == 'active' %}No active opportunities detected.
{% else %}No {{ selected_status }} opportunities found.
{% endif %}