89 lines
3.2 KiB
HTML
89 lines
3.2 KiB
HTML
{% 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>Seed</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for item in rows %}
|
||
<tr>
|
||
<td class="mono">#{{ item.id }}</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="8" 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 %}
|