{% from 'message_box.html' import message_box %} {% macro add_agent_link(name, backend, standalone=false) %} {% if standalone %} {% trans backend=backend.title %}Add {{ backend }} agent{% endtrans %} {% else %} {{ backend.title }} {% endif %} {% endmacro %}

{% trans %}LiveSync Agents{% endtrans %}

{% if agents %} {% for agent in agents %} {% endfor %}
{% trans %}ID{% endtrans %} {% trans %}Name{% endtrans %} {% trans %}Backend{% endtrans %} {% trans %}Last Run{% endtrans %} {% trans %}Queue{% endtrans %} {% trans %}Status{% endtrans %} {% trans %}Actions{% endtrans %}
{{ agent.id }} {{ agent.name }} {% if agent.backend %} {{ agent.backend.title }} {% else %} {% trans name=agent.backend_name %}Not loaded: {{ name }}{% endtrans %} {% endif %} {%- if agent.last_run -%} {{ agent.last_run | format_datetime('short') }} {%- else -%} {% trans %}Never{% endtrans %} {%- endif -%} {{ agent.queue.filter_by(processed=false).count() }} {% if agent.backend %} {% set queue_ready, reason = agent.create_backend().check_queue_status() %} {% if queue_ready %} {% trans %}Ready{% endtrans %} {% else %} {{ reason }} {% endif %} {% else %} {% trans %}n/a{% endtrans %} {% endif %} {%- if agent.backend -%} {%- endif -%}
{% else %} {% call message_box('info') %} {% trans %}No agents have been added yet.{% endtrans %} {% endcall %} {% endif %}
{% if backends|length == 1 %} {% set name, backend = backends.items()|first %} {{ add_agent_link(name, backend, standalone=true) }} {% else %} {% trans %}Add{% endtrans %} {% endif %}
{% set missing_initial_export = agents|rejectattr('initial_data_exported')|list %} {% if missing_initial_export %}

{% trans -%} You still need to run the initial export for some agents by executing the commands below in a shell.
Please note that this may take a very long time if there are many events in Indico! {%- endtrans %}


            {%- filter dedent %}
                {%- for agent in missing_initial_export -%}
                    indico livesync initial-export {{ agent.id }}
                {% endfor -%}
            {% endfilter -%}
        
{% endif %}