{# UI utility macros: empty_state, card, status_dot, task_status_badge, task_status_text. #} {% from "_macros.html" import icon %} {% macro empty_state(text, icon=None, class='') %}

{% if icon %}{% endif %}{{ text }}

{% endmacro %} {% macro loading(text='Загрузка…', class='') %}
{{ icon("loading") }} {{ text }}
{% endmacro %} {% macro jobs_filter_qs(source_filter, status_filter, page, limit) -%} {%- set _parts = [] -%} {%- if source_filter %}{% set _ = _parts.append('source=' ~ source_filter) %}{% endif -%} {%- if status_filter and status_filter != 'all' %}{% set _ = _parts.append('status=' ~ status_filter) %}{% endif -%} {%- if page and page != 1 %}{% set _ = _parts.append('page=' ~ page) %}{% endif -%} {%- if limit and limit != 100 %}{% set _ = _parts.append('limit=' ~ limit) %}{% endif -%} {{- ('?' ~ _parts|join('&')) if _parts else '' -}} {%- endmacro %} {% macro task_type_label(value) -%} {%- set kind = value.value if value.value is defined else value -%} {%- if kind == 'channel_collect' %}Сбор канала {%- elif kind == 'stats_all' %}Статистика {%- elif kind == 'sq_stats' %}Статистика запроса {%- elif kind == 'photo_due' %}Фото {%- elif kind == 'photo_auto' %}Автофото {%- elif kind == 'pipeline_run' %}Пайплайн {%- elif kind == 'content_generate' %}Генерация контента {%- elif kind == 'content_publish' %}Публикация контента {%- elif kind == 'translate_batch' %}Перевод {%- elif kind == 'filter_analyze' %}Анализ фильтров {%- else %}{{ kind }} {%- endif -%} {%- endmacro %} {% macro card(title) %}
{{ title }}
{% if caller is defined %}{{ caller() }}{% endif %}
{% endmacro %} {% macro status_dot(ch) %} {% if ch.is_filtered %}● {% elif ch.is_active %}{{ icon("active") }} {% else %}●{% endif %} {% endmacro %} {% macro task_status_badge(task) %} {% if task.status == 'running' %} {% elif task.status == 'completed' %} OK {% elif task.status == 'failed' %} Ошибка {% elif task.status == 'cancelled' %} Отменена {% else %} Ожидание {% endif %} {% endmacro %} {% macro task_status_text(task) %} {% if task.status == 'running' %} Выполняется {% elif task.status == 'completed' %} Завершено {% if task.note %}
{{ task.note }}{% endif %} {% elif task.status == 'failed' %} Ошибка {% if task.error %}
{{ task.error[:100] }}{% endif %} {% elif task.status == 'cancelled' %} Отменена {% if task.note %}
{{ task.note }}{% endif %} {% else %} {% if task.run_after %} Ожидание до {{ task.run_after|local_dt }} {% else %} Ожидание {% endif %} {% if task.note %}
{{ task.note }}{% endif %} {% endif %} {% endmacro %}