{% extends "layout.html" %} {% block content %} {% set current_sort = sort | default('created_at') %} {% set current_direction = direction | default('desc') %} {% set current_job_status = job_status_filter | default('all') %} {% set current_window = window_filter | default('all') %} {# Macro for sort link #} {% macro sort_link(label, col_name) %} {% set is_active = current_sort == col_name %} {% set next_dir = 'asc' if (is_active and current_direction == 'desc') else 'desc' %} {{ label }}{% if is_active %} {{ '▲' if current_direction == 'asc' else '▼' }}{% endif %} {% endmacro %} {% macro filter_link(label, job_status, window='all') %} {% set is_active = current_job_status == job_status and current_window == window %} {{ label }} {% endmacro %}

Admin Only

{# Header with re-generate button #}

Solutions

{{ active_filter_label }}.

{# Queue metrics #}
{{ filter_link('All', 'all') }} {{ filter_link('Pending', 'queued') }} {{ filter_link('Running', 'in_progress') }} {{ filter_link('Completed', 'completed') }} {{ filter_link('Completed (24h)', 'completed', '24h') }} {{ filter_link('Failed', 'failed') }} {{ filter_link('Failed (24h)', 'failed', '24h') }}
{# Processing banner #} {% if solution_metrics.pending > 0 or solution_metrics.running > 0 %}

Processing solutions...

{{ solution_metrics.pending }} pending, {{ solution_metrics.running }} running. Refresh the page to see updates.

{% endif %} {# Sort controls #} {% if not show_solution_jobs and solutions and solutions | length > 0 %}
Sort by: {{ sort_link('Created', 'created_at') }} | {{ sort_link('Risk Level', 'risk_level') }} | {{ sort_link('Category', 'resolution_category') }}
{% endif %} {# Solutions list #} {% if show_solution_jobs %} {% if solution_jobs and solution_jobs | length > 0 %} {% for job in solution_jobs %}

{{ job.opportunity_type }} → {{ job.affected_table }}

Job {{ job.id[:8] }} · queued {{ job.queued_at or '-' }} {% if job.started_at %} · started {{ job.started_at }}{% endif %} {% if job.completed_at %} · completed {{ job.completed_at }}{% endif %}

{{ job.status_label }} {% if job.resolution_category %} {{ job.resolution_category }} {% endif %}
{% if job.error_message %}

Failure

{{ job.error_message }}

{% endif %}
retries: {{ job.retry_count }} lifetime retries: {{ job.lifetime_retry_count }} solutions generated: {{ job.solutions_generated_count }} {% if job.llm_model %}model: {{ job.llm_model }}{% endif %} {% if job.error_stage %}stage: {{ job.error_stage }}{% endif %}
{% if job.config_id and job.opp_id %} {% endif %}
{% endfor %} {% if job_pagination and job_pagination.total_items > 0 %}

Showing {{ job_pagination.start_index }} to {{ job_pagination.end_index }} of {{ job_pagination.total_items }} results

{% if job_pagination.total_pages > 1 %} {% endif %}
{% endif %} {% else %}

No solution jobs match this filter.

{% endif %} {% elif solutions and solutions | length > 0 %} {% for sol in solutions %}

{{ sol.opportunity_type | replace('_', ' ') | title }}

{{ sol.affected_table }} {% if sol.file_path %} · {{ sol.file_path }}{% endif %} {% if sol.created_at %} · {{ sol.created_at }}{% endif %}

{% if sol.config_id and sol.opp_id %} View opportunity → {% endif %}
{% set create_pr_route_prefix = '/app' %} {% include "components/solution_detail_content.html" %}
{% endfor %} {# Pagination #} {% if pagination and pagination.total_items > 0 %}

Showing {{ pagination.start_index }} to {{ pagination.end_index }} of {{ pagination.total_items }} results

{% if pagination.total_pages > 1 %} {% endif %}
{% endif %} {% else %}

No solutions generated yet. Solutions are created automatically after opportunity detection.

{% endif %}
{% endblock %}