{% extends "base.html" %} {% block title %}داشبورد{% endblock %} {% block page_title %} داشبورد{% endblock %} {% block content %}
به‌روزرسانی خودکار هر ۱۰ ثانیه · آخرین: {{ m.generated_at }}
{# ── Service status strip ── #}
وضعیت سرویس‌ها
{% set svc = [('telegram','Telegram','telegram'),('bale','Bale','chat-dots'),('ai','AI','cpu'), ('database','Database','database'),('queue','Queue/Worker','diagram-3')] %} {% for key, label, icon in svc %}
{{ label }}
{% endfor %}
{% set sysm = m.services.system %}
CPU
{{ sysm.cpu if sysm.cpu is not none else '—' }}
RAM
{{ sysm.ram if sysm.ram is not none else '—' }}
Storage
{% if sysm.storage %}{{ sysm.storage.used_gb }}/{{ sysm.storage.total_gb }}GB ({{ sysm.storage.percent }}%){% else %}—{% endif %}
Uptime
{{ sysm.uptime or '—' }}
{# ── Module widget cards ── #} {% macro widget(title, icon, color, items) %}
{{ title }}
{% for label, path, val in items %}
{{ val }}
{{ label }}
{% endfor %}
{% endmacro %}
{{ widget('مدیریت اکانت‌ها', 'person-badge', '#60A55F', [ ('کل','accounts.total', m.accounts.total), ('فعال','accounts.active', m.accounts.active), ('غیرفعال','accounts.inactive', m.accounts.inactive), ('خطا','accounts.error', m.accounts.error), ('متصل','accounts.connected', m.accounts.connected), ('قطع','accounts.disconnected', m.accounts.disconnected)]) }} {{ widget('پیام ثابت', 'pin-angle', '#4a9fd8', [ ('فعال','fixed_message.active', m.fixed_message.active), ('متوقف','fixed_message.stopped', m.fixed_message.stopped), ('ارسال امروز','fixed_message.sent_today', m.fixed_message.sent_today), ('بازنویسی AI','fixed_message.ai_rewritten', m.fixed_message.ai_rewritten), ('خطا','fixed_message.errors', m.fixed_message.errors), ('—','_', '') ]) }} {{ widget('فوروارد خودکار', 'arrow-left-right', '#d9a441', [ ('Rule فعال','forward.rules_active', m.forward.rules_active), ('Rule غیرفعال','forward.rules_inactive', m.forward.rules_inactive), ('فوروارد امروز','forward.forwarded_today', m.forward.forwarded_today), ('ناموفق','forward.failed_today', m.forward.failed_today), ('پردازش AI','forward.ai_processing', m.forward.ai_processing), ('—','_','') ]) }} {{ widget('تعامل هوشمند', 'chat-dots', '#c3bdf5', [ ('فعال','interaction.active', m.interaction.active), ('متوقف','interaction.stopped', m.interaction.stopped), ('پیام‌ها','interaction.messages', m.interaction.messages), ('پاسخ AI','interaction.ai_responses', m.interaction.ai_responses), ('خطا','interaction.errors', m.interaction.errors), ('—','_','') ]) }} {{ widget('کاربران', 'people', '#60A55F', [ ('کل','users.total', m.users.total), ('آنلاین','users.online', m.users.online), ('—','_','') ]) }}
آخرین ورودها
{% for u in m.users.recent_logins %}
{{ u.username }}{{ u.last_login }}
{% else %}
{% endfor %}
{# ── Chart + recent logs ── #}
روند ۷ روز اخیر (پیام‌ها / خطاها)
آخرین لاگ‌ها
{% for l in m.recent_logs %}
{{ l.level }}{{ l.time }}{{ l.message }}
{% else %}
لاگی موجود نیست
{% endfor %}
{% endblock %} {% block scripts %} {% endblock %}