MpakoImageAIbot/web/templates/index.html

99 lines
3.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}История запросов — MpakoImageAIbot{% endblock %}
{% block content %}
<section class="cards">
<div class="card"><span class="card-value">{{ stats.total }}</span><span class="card-label">Всего запросов</span></div>
<div class="card"><span class="card-value">{{ stats.users }}</span><span class="card-label">Пользователей</span></div>
<div class="card"><span class="card-value">{{ stats.by_status.get('done', 0) }}</span><span class="card-label">Готово</span></div>
<div class="card"><span class="card-value">{{ stats.by_status.get('failed', 0) }}</span><span class="card-label">Ошибок</span></div>
</section>
<form class="filters" method="get" action="/">
<label>
Telegram user_id
<input name="user_id" value="{{ user_id }}" list="known-users" inputmode="numeric" placeholder="например 7467236616">
</label>
<datalist id="known-users">
{% for user in users %}
<option value="{{ user.user_id }}">{{ user.total }} запросов</option>
{% endfor %}
</datalist>
<label>
Статус
<select name="status">
<option value="">Все</option>
{% for item in statuses %}
<option value="{{ item }}" {% if status == item %}selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
</label>
<label>
Режим
<select name="mode">
<option value="">Все</option>
{% for item in modes %}
<option value="{{ item }}" {% if mode == item %}selected{% endif %}>{{ item }}</option>
{% endfor %}
</select>
</label>
<div class="filter-actions">
<button type="submit">Фильтровать</button>
<a class="reset" href="/">Сбросить</a>
</div>
</form>
{% if error %}<div class="alert">{{ error }}</div>{% endif %}
<div class="table-wrap">
<table>
<thead>
<tr>
<th>ID</th>
<th>Превью</th>
<th>Дата</th>
<th>Пользователь</th>
<th>Режим</th>
<th>Статус</th>
<th>Промпт</th>
<th>Seed</th>
<th></th>
</tr>
</thead>
<tbody>
{% for item in rows %}
<tr>
<td class="mono">#{{ item.id }}</td>
<td class="thumb-cell">
{% if item.output_file_path %}
<a href="/media/{{ item.id }}/output" target="_blank" rel="noreferrer">
<img class="thumb" src="/thumb/{{ item.id }}" alt="Результат #{{ item.id }}" loading="lazy">
</a>
{% else %}
<span class="muted">—</span>
{% endif %}
</td>
<td class="nowrap">{{ item.timestamp|fmt_dt }}</td>
<td><a href="/?user_id={{ item.user_id }}">{{ item.user_id }}</a></td>
<td class="mono">{{ item.mode }}</td>
<td><span class="badge {{ item.status }}">{{ item.status }}</span></td>
<td class="prompt" title="{{ item.prompt_text }}">{{ item.prompt_text|truncate(90, True) }}</td>
<td class="mono">{{ item.seed if item.seed is not none else '—' }}</td>
<td><a class="details" href="/request/{{ item.id }}">Детали</a></td>
</tr>
{% else %}
<tr><td colspan="9" class="empty">Ничего не найдено</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<nav class="pagination">
{% if prev_url %}<a href="{{ prev_url }}">← Назад</a>{% else %}<span></span>{% endif %}
<span>Страница {{ page }} из {{ pages }} · {{ total }} запросов</span>
{% if next_url %}<a href="{{ next_url }}">Вперёд →</a>{% else %}<span></span>{% endif %}
</nav>
{% endblock %}