- Add /connections page showing all integrations with online/offline status - Add background health checker that polls Evotor API every 10 minutes - Add is_online and last_checked_at fields to evotor_connections table - Replace Evotor navbar link with unified Connections link - Redirect connect/disconnect flows to /connections - Add Alembic migration for new columns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
87 lines
4.5 KiB
HTML
87 lines
4.5 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Подключение Эвотор — EvoSync{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="row justify-content-center">
|
||
<div class="col-sm-10 col-md-7 col-lg-6">
|
||
|
||
{% if error %}
|
||
<div class="alert alert-danger mt-4">
|
||
{% if error == "invalid_state" %}
|
||
<i class="bi bi-exclamation-triangle me-2"></i>Ошибка безопасности. Попробуйте подключить аккаунт заново.
|
||
{% elif error == "token_exchange" %}
|
||
<i class="bi bi-exclamation-triangle me-2"></i>Не удалось получить токен доступа от Эвотор. Попробуйте позже.
|
||
{% elif error == "no_token" %}
|
||
<i class="bi bi-exclamation-triangle me-2"></i>Эвотор не вернул токен доступа. Попробуйте позже.
|
||
{% else %}
|
||
<i class="bi bi-exclamation-triangle me-2"></i>Произошла ошибка при подключении: {{ error }}
|
||
{% endif %}
|
||
</div>
|
||
{% endif %}
|
||
|
||
<div class="card shadow-sm mt-4">
|
||
<div class="card-header">
|
||
<h1 class="h5 mb-0">Подключение Эвотор</h1>
|
||
</div>
|
||
|
||
{% if connection %}
|
||
{# ── CONNECTED STATE ── #}
|
||
<ul class="list-group list-group-flush">
|
||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||
<span class="text-muted small">Статус</span>
|
||
<span class="badge bg-success"><i class="bi bi-check-circle me-1"></i>Подключено</span>
|
||
</li>
|
||
{% if connection.store_name %}
|
||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||
<span class="text-muted small">Магазин</span>
|
||
<span>{{ connection.store_name }}</span>
|
||
</li>
|
||
{% endif %}
|
||
{% if connection.store_id %}
|
||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||
<span class="text-muted small">ID магазина</span>
|
||
<span class="font-monospace small text-muted">{{ connection.store_id }}</span>
|
||
</li>
|
||
{% endif %}
|
||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||
<span class="text-muted small">Подключено</span>
|
||
<span class="small">{{ connection.connected_at.strftime("%d.%m.%Y %H:%M") }}</span>
|
||
</li>
|
||
</ul>
|
||
<div class="card-body d-grid gap-2">
|
||
<a href="/evotor/connect" class="btn btn-primary">Переподключить</a>
|
||
<form method="post" action="/evotor/disconnect">
|
||
<button type="submit" class="btn btn-outline-danger w-100">Отключить аккаунт Эвотор</button>
|
||
</form>
|
||
</div>
|
||
|
||
{% else %}
|
||
{# ── NOT CONNECTED STATE ── #}
|
||
<div class="card-body">
|
||
<p class="text-muted mb-3">
|
||
Подключите ваш аккаунт Эвотор, чтобы система могла автоматически синхронизировать
|
||
каталог товаров из вашей кассы в ВКонтакте.
|
||
</p>
|
||
<ul class="text-muted small mb-4">
|
||
<li>Вы будете перенаправлены на сайт Эвотор для авторизации</li>
|
||
<li>После подтверждения доступа синхронизация будет настроена автоматически</li>
|
||
<li>Вы можете отключить доступ в любой момент</li>
|
||
</ul>
|
||
<div class="d-grid">
|
||
<a href="/evotor/connect" class="btn btn-primary btn-lg">Подключить Эвотор</a>
|
||
</div>
|
||
</div>
|
||
{% endif %}
|
||
|
||
</div>
|
||
|
||
<div class="mt-3 text-center">
|
||
<a href="/connections" class="text-muted small">
|
||
<i class="bi bi-arrow-left me-1"></i>Вернуться к подключениям
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
{% endblock %}
|