{# Adapted from packages/web/src/governor_web/templates/configurations/detail.html @ 19455c57c5a9. For governor-audit there's exactly one config (single-machine, single-tenant). This page is the scan-control hub: shows config + scan form + scan history. Once at least one scan has succeeded, the user can navigate to /dashboard for the cost-drivers view; before that, /dashboard redirects here. #} {% extends "layout.html" %} {% block content %}
{# ── Header ── eyebrow + title + status badge, mirrors governor_web/templates/configurations/detail.html @ 19455c57c5a9. #}

Setup

Configuration

{{ adc_state.label }}

GCP Project: {{ config.gcp_project_id }} · Region: {{ config.bigquery_region }} · dbt-only default: {{ "on" if config.scan_defaults.dbt_only else "off" }}

{# ── Stats strip ── governor-web shows last sync + last manifest; audit shows last scan + cached jobs + active opps. Same flex-wrap gap-6 grammar so the visual rhythm matches. #}
Last scan: {{ cache_stats.last_scan_at | timeago }}
Cached jobs: {{ "{:,}".format(cache_stats.cached_jobs) }}
Active opportunities: {{ "{:,}".format(cache_stats.active_opps) }}
{# ── Inline action row ── governor-web has [View Jobs] + [Sync Now] + status; audit has [View dashboard] (when data exists) + signed-in principal. The Run Scan card lives below — this row is the primary nav, not a duplicate scan trigger. #}
{% if has_scan_data %} View dashboard {% endif %} Settings {% if active_principal %} Signed in as {{ active_principal }} {% endif %}
{% if scan_banner %}

{{ scan_banner.headline }}

{% if scan_banner.detail %}

{{ scan_banner.detail }}

{% endif %}
{% if scan_banner.level == 'success' and has_scan_data %} View dashboard {% endif %}
{% endif %} {% if errors and errors.get('_general') %}
{{ errors['_general'] }}
{% endif %} {# ── Run scan ── #}

Run scan

Queries INFORMATION_SCHEMA.JOBS_BY_PROJECT for the requested period and caches the results locally. Subsequent scans of the same window are served from cache (no BigQuery cost).

{% with compact=False %} {% include "dashboard/_run_scan_form.html" %} {% endwith %}
{# ── Two-column block: active config + re-configure ── #}

Active Configuration

Project
{{ config.gcp_project_id }}
Region
{{ config.bigquery_region }}
Lookback (default)
{{ config.scan_defaults.lookback_days }}d
Cost cap
{{ "{:.1f}".format(config.scan_defaults.max_scan_bytes / 1024 / 1024 / 1024) }} GB billed
dbt-only default
{{ "true" if config.scan_defaults.dbt_only else "false" }}
Web UI port
{{ config.web_ui.port }} (loopback only)

Edit advanced fields by hand: ~/.governor-audit/config.json

Re-configure

Submitting overwrites the active config and re-runs the ADC probe.

{% if active_principal %}

Signed in as {{ active_principal }}.

{% endif %}
{% if gcp_projects %} {% for project in gcp_projects %} {% endfor %} {% endif %} {% if errors and errors.get('gcp_project_id') %}

{{ errors['gcp_project_id'] }}

{% endif %}
{% if errors and errors.get('bigquery_region') %}

{{ errors['bigquery_region'] }}

{% endif %}
{# ── Scan history ── #}

Scan history

{{ scans | length }} most recent

{% if scans %}
{% for scan in scans %} {% endfor %}
Started Status Lookback Jobs Cost dbt-only
{{ scan.started_at.strftime("%Y-%m-%d %H:%M") }} UTC {% if scan.status == "succeeded" %} succeeded {% elif scan.status == "failed" %} failed {% elif scan.status == "running" %} running {% else %} {{ scan.status }} {% endif %} {{ scan.requested_lookback_days }}d {{ "{:,}".format(scan.fetched_job_count) }} {{ (scan.actual_cost_usd or scan.estimated_cost_usd) | format_usd }} {% if scan.dbt_only_filter %} on {% else %} {% endif %}
{% else %}

No scans yet. Use the form above to run your first scan.

{% endif %}
{# ── Danger zone: wipe cache ── #}

Danger zone — Reset audit cache

Deletes every bigquery_jobs, opportunities, and scan_runs row collected from INFORMATION_SCHEMA. Your saved configuration (project, region, defaults) is preserved — you'll just need to run a fresh scan to repopulate.

{% endblock %}