{# "Top Cost Drivers with Issues and Suggestions Found" — same `ui-table` style as governor_web/_cost_drivers_table.html, with a server-side click-to-sort engine: each header is an that flips direction if the column is already active. Filters to jobs with at least one issue or one suggestion finding so any flagged row shows up. #} {% set _sort = sort_by | default('spend') %} {% set _dir = sort_dir | default('desc') %} {# Macro: render a sortable column header. Toggling the active column flips direction; switching columns resets to desc. Always returns page=1 so users don't end up past the new tail. #} {% macro _sort_th(col, label, align="left", extra="") %} {% set is_active = (_sort == col) %} {% set next_dir = 'asc' if (is_active and _dir == 'desc') else 'desc' %} {% set arrow = '↓' if (is_active and _dir == 'desc') else ('↑' if is_active else '') %}
|
{{ j.destination_dataset }}
|
{{ j.destination_object }}
{% if j.statement_type %}
{{ j.statement_type }}
{% endif %}
|
{{ j.cost_usd | format_usd }}
{{ "%.1f" | format(j.cost_share_pct) }}%
|
{{ j.bytes_processed | format_bytes }} | {{ "%.1f" | format((j.slot_time_ms or 0) / 3600000) }} | {% if j.issue_count > 0 %} {{ j.issue_count }} {% else %} 0 {% endif %} | {% if j.suggestion_count > 0 %} {{ j.suggestion_count }} {% else %} 0 {% endif %} | {# Mirrors the workload chip on /opportunities — ui-signal-chip + colour-coded ui-legend-dot — so visual grammar is consistent across both tables. #} {% if j.workload_kind == "build" %} Build {% elif j.workload_kind == "consumption" %} Consumption {% else %} Query {% endif %} | {# Plain text indicator — same green colour for "dbt" so it still reads as positive context, but without the chip background that competed visually with the Issues / Suggestions count pills on the same row. #} {% if j.is_dbt_originated %} dbt {% else %} other {% endif %} | {% if j.creation_time %} {{ j.creation_time.strftime("%Y-%m-%d %H:%M") }} UTC {% else %} — {% endif %} |
No flagged jobs in the scan window. Widen the lookback or relax the rule overrides.
{% endif %}