{% set is_daemon = task.type == 'daemon' %} {% set ds = task.get('daemon_status') if is_daemon else none %} {% set dstatus = ds.status if ds else ('stopped' if is_daemon else '') %} {% set rs = task.get('relay_status') %} {% if not task.enabled %} {% set sev = '' %} {% elif rs %} {% if rs.status == 'running' %}{% set sev = 'ok' %} {% elif rs.status == 'error' %}{% set sev = 'err' %} {% else %}{% set sev = 'warn' %}{% endif %} {% elif is_daemon %} {% if dstatus == 'running' %}{% set sev = 'ok' %} {% elif dstatus == 'restarting' %}{% set sev = 'warn' %} {% else %}{% set sev = 'err' %}{% endif %} {% else %} {% if task.last_status == 'ok' %}{% set sev = 'ok' %} {% elif task.last_status == 'error' %}{% set sev = 'err' %} {% elif task.last_status in ('pending', 'running') %}{% set sev = 'warn' %} {% else %}{% set sev = '' %}{% endif %} {% endif %}
{% if can_edit(request, 'tasks') %} {% endif %}
{{ task.name }} {{ task.type }}
{% if rs %} {% if rs.status == 'running' %} {{ t('task_rows.relay_running', server_id=rs.server_id) }} {% if rs.last_heartbeat_ago is not none %}{{ t('task_rows.relay_last_heartbeat', ago=(rs.last_heartbeat_ago | fmt_uptime)) }}{% endif %} {% elif rs.status == 'waiting' %} {{ t('task_rows.relay_waiting', server_id=rs.server_id) }} {% else %} {{ rs.error or rs.status }} {% endif %} {% if rs.dropped %}{{ t('task_rows.relay_dropped', count=rs.dropped, reason=rs.error) }}{% endif %} {% elif is_daemon %} {% if dstatus == 'running' and ds.uptime_s is not none %} {{ t('task_rows.up', uptime=(ds.uptime_s | fmt_uptime)) }} {% if ds.restart_count %}{{ t('task_rows.restart_count', count=ds.restart_count, plural=('s' if ds.restart_count != 1 else '')) }}{% endif %} {% else %} {{ dstatus }} {% endif %} {% if ds and ds.source %} {{ t('task_rows.logs') }} {{ ds.source }} {% endif %} {% else %} {% if task.schedule %} {% if task.schedule.type == 'cron' %} {{ t('task_rows.cron', cron='') }}{{ task.schedule.cron }} {% else %} {{ t('task_rows.every_minutes', minutes=task.schedule.minutes) }} {% endif %} {% endif %} {% if task.last_run %} {{ t('task_rows.last_run', timestamp=task.last_run[:16].replace('T',' ')) }} {% else %} {{ t('task_rows.never_run') }} {% endif %} {% if task.last_status and task.last_status != 'ok' %} {{ task.last_status }} {% endif %} {% endif %}
{% if can_edit(request, 'tasks') %} {% if is_daemon or task.type in ('plugin', 'relay') %} {% else %} {% endif %} {% if task.type == 'relay' %} {% endif %} {% endif %}
{% if task.get('plugin_actions') %}
{% for action in task.plugin_actions %} {% set action_text = action.label or action.title or action.url %} {{ action_text }} {% endfor %}
{% endif %}