Загрузить файлы в «templates»
This commit is contained in:
24
templates/base.html
Normal file
24
templates/base.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{% block title %}Robot Management{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" href="/static/css/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header class="header">
|
||||||
|
<div class="container header-inner">
|
||||||
|
<a href="/" class="logo">Robot Management</a>
|
||||||
|
{% block nav %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main class="container main">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container">Прототип веб-системы управления роботами</div>
|
||||||
|
</footer>
|
||||||
|
<script src="/static/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
106
templates/cabinet.html
Normal file
106
templates/cabinet.html
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Личный кабинет — Robot Management{% endblock %}
|
||||||
|
|
||||||
|
{% block nav %}
|
||||||
|
<form method="post" action="/logout" class="logout-form">
|
||||||
|
<button type="submit" class="btn btn-ghost">Выйти</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Личный кабинет</h1>
|
||||||
|
|
||||||
|
<section class="grid">
|
||||||
|
<div class="card">
|
||||||
|
<h2>Профиль</h2>
|
||||||
|
<dl class="stats">
|
||||||
|
<div>
|
||||||
|
<dt>Email</dt>
|
||||||
|
<dd>{{ user.email }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>ID</dt>
|
||||||
|
<dd>{{ user.id }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>Рейтинг</dt>
|
||||||
|
<dd class="highlight">{{ "%.1f"|format(user.rating) }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>Баллы</dt>
|
||||||
|
<dd class="highlight">{{ user.points }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>Дата регистрации</dt>
|
||||||
|
<dd>{{ user.created_at.strftime("%d.%m.%Y %H:%M") }}</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h2>Активные сессии</h2>
|
||||||
|
{% if sessions %}
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Создана</th>
|
||||||
|
<th>Истекает</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for s in sessions %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ s.id }}</td>
|
||||||
|
<td>{{ s.created_at.strftime("%d.%m.%Y %H:%M") }}</td>
|
||||||
|
<td>{{ s.expires_at.strftime("%d.%m.%Y %H:%M") }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p class="muted">Нет активных сессий</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="card">
|
||||||
|
<h2>Данные от внешних приложений</h2>
|
||||||
|
{% if external_data %}
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Источник</th>
|
||||||
|
<th>Данные</th>
|
||||||
|
<th>Время</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in external_data %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ item.source }}</td>
|
||||||
|
<td><code class="payload">{{ item.payload[:120] }}{% if item.payload|length > 120 %}…{% endif %}</code></td>
|
||||||
|
<td>{{ item.created_at.strftime("%d.%m.%Y %H:%M") }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p class="muted">Пока нет записей от внешних систем</p>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="card api-info">
|
||||||
|
<h2>API для внешних приложений</h2>
|
||||||
|
<p class="muted">Передавайте ключ в заголовке: <code>Authorization: Bearer <API_KEY></code></p>
|
||||||
|
<ul class="api-list">
|
||||||
|
<li><code>GET /api/v1/users/{id}</code> — данные пользователя</li>
|
||||||
|
<li><code>GET /api/v1/users/by-email/{email}</code> — поиск по email</li>
|
||||||
|
<li><code>GET /api/v1/users/{id}/sessions</code> — активные сессии</li>
|
||||||
|
<li><code>POST /api/v1/users/{id}/data</code> — запись данных</li>
|
||||||
|
<li><code>GET /api/v1/users/{id}/data</code> — чтение данных</li>
|
||||||
|
</ul>
|
||||||
|
<p><a href="/docs" target="_blank">Открыть Swagger-документацию →</a></p>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
24
templates/login.html
Normal file
24
templates/login.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Вход — Robot Management{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="card auth-card">
|
||||||
|
<h1>Вход</h1>
|
||||||
|
{% if error %}
|
||||||
|
<div class="alert alert-error">{{ error }}</div>
|
||||||
|
{% endif %}
|
||||||
|
<form method="post" action="/login" class="form">
|
||||||
|
<label>
|
||||||
|
Email
|
||||||
|
<input type="email" name="email" required autocomplete="email" placeholder="user@example.com">
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Пароль
|
||||||
|
<input type="password" name="password" required autocomplete="current-password" minlength="6">
|
||||||
|
</label>
|
||||||
|
<button type="submit" class="btn btn-primary">Войти</button>
|
||||||
|
</form>
|
||||||
|
<p class="muted">Нет аккаунта? <a href="/register">Зарегистрироваться</a></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
24
templates/register.html
Normal file
24
templates/register.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}Регистрация — Robot Management{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="card auth-card">
|
||||||
|
<h1>Регистрация</h1>
|
||||||
|
{% if error %}
|
||||||
|
<div class="alert alert-error">{{ error }}</div>
|
||||||
|
{% endif %}
|
||||||
|
<form method="post" action="/register" class="form">
|
||||||
|
<label>
|
||||||
|
Email
|
||||||
|
<input type="email" name="email" required autocomplete="email" placeholder="user@example.com">
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Пароль
|
||||||
|
<input type="password" name="password" required autocomplete="new-password" minlength="6">
|
||||||
|
</label>
|
||||||
|
<button type="submit" class="btn btn-primary">Создать аккаунт</button>
|
||||||
|
</form>
|
||||||
|
<p class="muted">Уже есть аккаунт? <a href="/login">Войти</a></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user