{# Audit Opportunity Explorer — read-only mirror of governor-web's /opportunities index. Same visual grammar (ui-shell → page-header → summary cards → filter chip strip → table → pagination) without PR/GitHub surface or live-refresh machinery. #} {% extends "layout.html" %} {% block content %}

Recommendation Workspace

Opportunities

{{ "{:,}".format(summary.total) }} active opportunit{{ "ies" if summary.total != 1 else "y" }} across the cached scan window. Toggle rules →

{# ── Summary cards ── #}

Total opportunities

{{ "{:,}".format(summary.total) }}

Estimated savings

${{ "{:,.2f}".format(summary.total_savings) }}

summed across all active findings

Current cost

${{ "{:,.2f}".format(summary.total_cost) }}

By severity

{% if summary.by_bucket.critical %}{{ summary.by_bucket.critical }} critical{% endif %} {% if summary.by_bucket.high %}{{ summary.by_bucket.high }} high{% endif %} {% if summary.by_bucket.medium %}{{ summary.by_bucket.medium }} medium{% endif %} {% if summary.by_bucket.low %}{{ summary.by_bucket.low }} low{% endif %}
{# ── Filter chip strip ── #}

Filter

{% if active_filters.rule_type or active_filters.severity or active_filters.dbt_only %} Clear filters {% endif %}
{# All chip — clears rule_type but keeps severity/dbt #} {% set _other = [] %} {% if active_filters.severity %}{% set _ = _other.append('severity=' ~ active_filters.severity) %}{% endif %} {% if active_filters.dbt_only %}{% set _ = _other.append('dbt_only=1') %}{% endif %} {% set _all_qs = _other | join('&') %} All {{ summary.total }} {% for chip in chips %} {% set _chip_qs = (_other + ['rule_type=' ~ chip.rule_type]) | join('&') %} {{ chip.label }} {{ chip.count }} {% endfor %}
Severity: {% set _sev_other = [] %} {% if active_filters.rule_type %}{% set _ = _sev_other.append('rule_type=' ~ active_filters.rule_type) %}{% endif %} {% if active_filters.dbt_only %}{% set _ = _sev_other.append('dbt_only=1') %}{% endif %} {% for bucket in ['critical', 'high', 'medium', 'low'] %} {% set _bucket_qs = (_sev_other + ['severity=' ~ bucket]) | join('&') %} {{ bucket | capitalize }} {{ summary.by_bucket.get(bucket, 0) }} {% endfor %} dbt: {% set _dbt_other = [] %} {% if active_filters.rule_type %}{% set _ = _dbt_other.append('rule_type=' ~ active_filters.rule_type) %}{% endif %} {% if active_filters.severity %}{% set _ = _dbt_other.append('severity=' ~ active_filters.severity) %}{% endif %} {% set _dbt_qs = (_dbt_other + ['dbt_only=1']) | join('&') %} dbt-originated only
{# ── Table ── #}
{% if rows %}
{% for row in rows %} {% endfor %}
Rule Affected Table Severity Current Cost Estimated Savings Last Detected
{{ row.rule_label }} {% if row.is_dbt_originated %} dbt {% endif %} {{ row.dbt_model_name or row.table_short }} {% if row.severity_bucket == 'critical' %} {{ row.severity }} {% elif row.severity_bucket == 'high' %} {{ row.severity }} {% else %} {{ row.severity }} {% endif %} ${{ "{:,.4f}".format(row.current_cost) }} ${{ "{:,.4f}".format(row.expected_savings) }} {% if row.last_detected %}{{ row.last_detected.strftime("%Y-%m-%d") }}{% else %}—{% endif %}
{% if pagination.total_pages > 1 %}

Showing {{ pagination.start_index }}–{{ pagination.end_index }} of {{ "{:,}".format(filtered_count) }}

{% set _page_other = [] %} {% if active_filters.rule_type %}{% set _ = _page_other.append('rule_type=' ~ active_filters.rule_type) %}{% endif %} {% if active_filters.severity %}{% set _ = _page_other.append('severity=' ~ active_filters.severity) %}{% endif %} {% if active_filters.dbt_only %}{% set _ = _page_other.append('dbt_only=1') %}{% endif %} {% if sort_by != 'savings' %}{% set _ = _page_other.append('sort=' ~ sort_by) %}{% endif %} {% if sort_dir != 'desc' %}{% set _ = _page_other.append('direction=' ~ sort_dir) %}{% endif %} {% if pagination.has_prev %} {% set _prev_qs = (_page_other + ['page=' ~ (pagination.page - 1)]) | join('&') %} ← Prev {% endif %} Page {{ pagination.page }} / {{ pagination.total_pages }} {% if pagination.has_next %} {% set _next_qs = (_page_other + ['page=' ~ (pagination.page + 1)]) | join('&') %} Next → {% endif %}
{% endif %} {% else %}

No opportunities match the current filters.

{% endif %}
{% endblock %}