{% extends "server/base.html" %} {% import "agents/macros.html" as m with context %} {% set agent = row.kept.agent %} {% set short = ref(agent.id) %} {% block title %}{{ t.text("agents.status.title") }}{% endblock %} {% block top %}{% endblock %} {% block head %}{% endblock %} {% block body %} {# a group a channel, in the order the agent has them: how it is connected, its bot, since when, its last message and its latest error, as the computer last said; what it said last while it is away #}

{{ t.text("agents.status.title") }}

{% for provider in agent.channel %} {% set link = (row.activity.channels | selectattr("connection", "equalto", provider.connection) | first | default(none)) if row.activity else none %}
{{ m.logo(provider.kind) }}{{ (link.identity.name or link.identity.id) if link and link.identity else provider.kind }} {%- if not row.online %}{{ t.text("agents.state.offline") }} {%- elif not link %}— {%- elif link.state == "running" %}{% include "agents/icons/circle-check.svg" %}{{ t.text("agents.link.running") }} {%- elif link.state == "reconnecting" %}{% include "agents/icons/triangle-alert.svg" %}{{ t.text("agents.link.reconnecting", {"n": link.failures}) }} {%- elif link.state in ("disconnected", "failed", "blocked") %}{% include "agents/icons/triangle-alert.svg" %}{{ t.text("agents.link.disconnected") }} {%- elif link.state == "starting" %}{{ t.text("agents.link.starting") }} {%- else %}{{ t.text("agents.link.stopped") }}{% endif %}
{% if link and (link.connected_at_ms or link.received_at_ms) %}
{%- if link.connected_at_ms %}{{ t.text("agents.status.connected", {"when": link.connected_at_ms | moment}) }}{% endif %} {%- if link.connected_at_ms and link.received_at_ms %} · {% endif %} {%- if link.received_at_ms %}{{ t.text("agents.status.received", {"ago": link.received_at_ms | ago}) }}{% endif %}
{% endif %} {% if link and link.error %}
{{ t.text("agents.status.error", {"error": link.error}) }}
{% endif %}
{% else %}

{{ t.text("agents.status.none") }}

{% endfor %}
{% endblock %}