{# Vendored from packages/web/src/governor_web/templates/opportunities/_table.html. Audit changes: - Column-header click → plain with ?sort=...&direction=... so the table sorts via standard GET round-trip (no SSE). - Local-runtime branches kept (audit IS local) — so the Occurrences column doesn't render and the workload chip falls back to "Unclassified" when the kind is unknown. - Row click target: /opportunities/{id} (audit has no /projects/... namespace; everything is single-tenant). - State column: derived from severity bucket (audit has no solution_risk_level / recommendation_state). Same chip grammar (ui-signal-chip + ui-legend-dot). #}
{% if opportunities and opportunities | length > 0 %}
{# 'Savings' column dropped in v0.0.16 — audit doesn't run dry-runs and refuses to display the existing rules' hard- coded percentage savings. See _DEFAULT_SORT comment in routes/opportunities.py. #} {% set exp_cols = [ ('dataset', 'Dataset', 'left'), ('table', 'Object', 'left'), ('type', 'Type', 'left'), ('workload', 'Workload', 'left'), ('cost', 'Query Cost', 'right'), ] %} {% if not local_runtime_mode %} {% set exp_cols = exp_cols + [('occurrence', 'Occurrences', 'right')] %} {% endif %} {% set exp_cols = exp_cols + [('age', 'Last Detected', 'right')] %} {% for col_key, col_label, col_align in exp_cols %} {% set _next_dir = 'asc' if (signals.sort == col_key and signals.direction == 'desc') else 'desc' %} {% set _qs = pagination.query_string_without_sort_or_page %} {% set _sep = '&' if _qs else '' %} {% set _href = '?' ~ _qs ~ _sep ~ 'sort=' ~ col_key ~ '&direction=' ~ _next_dir %} {# ` {% endfor %} {% for opp in opportunities %} {# Savings cell removed in v0.0.16. #} {% if not local_runtime_mode %} {% endif %} {% endfor %}
` instead of wrapping in an `` so the absolute-positioned tooltip doesn't get clipped by the anchor's own bounding box. Same column click-to-sort grammar the cloud uses. #} {% if col_key in ('cost', 'savings') %}
{% if col_key == 'cost' %} Cost from the most recent BigQuery job execution, dry-run estimate, or detection heuristic. {% else %} Estimated per-run savings from solution dry-runs or detection heuristics. {% endif %} {{ col_label }}{% if signals.sort == col_key %} {{ '↓' if signals.direction == 'desc' else '↑' }}{% endif %}
{% else %} {{ col_label }}{% if signals.sort == col_key %} {{ '↓' if signals.direction == 'desc' else '↑' }}{% endif %} {% endif %}
Number of SQL-rewrite improvements that apply to the same query as this issue. Click into the row to see each diff. Suggestions
{{ opp.affected_dataset }} {{ opp.affected_object }} {{ opp.opportunity_type | replace('_', ' ') }} {% if opp.query_workload_kind == 'build' %} Build {% elif opp.query_workload_kind == 'consumption' %} Consumption {% elif local_runtime_mode %} Unclassified {% else %} Query {% endif %} {% if opp.query_cost_value is not none %} {{ opp.query_cost_value | format_usd }} {% else %} {% endif %} {{ opp.occurrence_count }} {{ opp.last_detected_at.strftime("%d/%m/%Y") if opp.last_detected_at else (opp.created_at.strftime("%d/%m/%Y") if opp.created_at else "—") }} {# Suggestions count — replaces the old severity bucket pill. Shows how many SQL-rewrite improvements apply to the same query as this issue. The detail page renders each as a green/red diff. #} {% set _sugg = opp.improvements_count or 0 %} {% set _sugg_diff = opp.improvements_with_diff_count or 0 %} {% if _sugg == 0 %} None {% elif _sugg_diff > 0 %} {{ _sugg }} suggested · {{ _sugg_diff }} with diff {% else %} {{ _sugg }} suggested {% endif %}
{% include "opportunities/_pagination.html" %} {% else %}

No opportunities match your filters

{% endif %}