0a51001791
Co-authored-by: Cursor <cursoragent@cursor.com>
81 lines
4.4 KiB
HTML
81 lines
4.4 KiB
HTML
{% extends "admin/layout.html" %}
|
|
|
|
{% block title %}Версии Git — Админка{% endblock %}
|
|
{% block admin_title %}Обновление Git{% endblock %}
|
|
{% block admin_subtitle %}<p class="admin-main__subtitle">Переключение релизов и пересборка Docker</p>{% endblock %}
|
|
|
|
{% block admin_content %}
|
|
<div class="admin-stats">
|
|
<div class="stat-card stat-card--admin">
|
|
<span class="stat-card__value">{{ status.current or '—' }}</span>
|
|
<span class="stat-card__label">текущая версия</span>
|
|
</div>
|
|
<div class="stat-card stat-card--admin">
|
|
<span class="stat-card__value">{% if status.repo_ready %}OK{% else %}—{% endif %}</span>
|
|
<span class="stat-card__label">репозиторий</span>
|
|
</div>
|
|
<div class="stat-card stat-card--admin">
|
|
<span class="stat-card__value">{% if status.enabled %}ON{% else %}OFF{% endif %}</span>
|
|
<span class="stat-card__label">deploy из админки</span>
|
|
</div>
|
|
</div>
|
|
|
|
{% if not status.repo_ready %}
|
|
<div class="alert alert--error">
|
|
Git-репозиторий недоступен по пути <code>{{ status.repo_path }}</code>.
|
|
Смонтируйте проект в контейнер: <code>./:/repo</code> в docker-compose.yml
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not status.enabled %}
|
|
<div class="alert alert--error">
|
|
Обновление через админку отключено. Установите <code>ALLOW_GIT_DEPLOY=true</code> в .env
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="admin-grid">
|
|
<div class="admin-panel">
|
|
<h2 class="admin-panel__title">1. Обновить список версий</h2>
|
|
<p class="folder-hint">Путь: {{ status.repo_path }}{% if status.remote_url %} · {{ status.remote_url }}{% endif %}</p>
|
|
<form method="post">
|
|
<input type="hidden" name="action" value="fetch">
|
|
<button type="submit" class="btn btn--primary" {% if not status.repo_ready %}disabled{% endif %}>git fetch</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="admin-panel">
|
|
<h2 class="admin-panel__title">2. Переключить версию</h2>
|
|
<form method="post" class="auth-form">
|
|
<input type="hidden" name="action" value="checkout">
|
|
<div class="form-group">
|
|
<label for="ref">Тег или ветка</label>
|
|
<input type="text" id="ref" name="ref" list="git-refs" required placeholder="v1.1">
|
|
<datalist id="git-refs">
|
|
{% for tag in status.tags %}
|
|
<option value="{{ tag }}">
|
|
{% endfor %}
|
|
{% for branch in status.branches %}
|
|
<option value="{{ branch }}">
|
|
{% endfor %}
|
|
</datalist>
|
|
</div>
|
|
<button type="submit" class="btn btn--primary" {% if not status.repo_ready %}disabled{% endif %}>git checkout</button>
|
|
</form>
|
|
{% if status.tags %}
|
|
<p class="folder-hint">Теги: {{ status.tags[:8]|join(', ') }}{% if status.tags|length > 8 %}…{% endif %}</p>
|
|
{% elif status.tags_error %}
|
|
<p class="folder-hint">{{ status.tags_error }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="admin-panel">
|
|
<h2 class="admin-panel__title">3. Пересобрать Docker</h2>
|
|
<p class="folder-hint">Требуется доступ к <code>/var/run/docker.sock</code> в контейнере web</p>
|
|
<form method="post" onsubmit="return confirm('Пересобрать и перезапустить контейнеры?');">
|
|
<input type="hidden" name="action" value="rebuild">
|
|
<button type="submit" class="btn btn--primary" {% if not status.enabled or not status.repo_ready %}disabled{% endif %}>docker compose up -d --build</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|