c1aac7ecac
Co-authored-by: Cursor <cursoragent@cursor.com>
93 lines
4.6 KiB
HTML
93 lines
4.6 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Версии Git — Админка{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="page-header page-header--admin">
|
|
<div class="container">
|
|
<h1 class="page-header__title">Обновление и версии Git</h1>
|
|
<p class="page-header__subtitle">Переключение между релизами и пересборка Docker</p>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="admin-section">
|
|
<div class="container">
|
|
{% include "admin/_nav.html" %}
|
|
{% include "partials/alerts.html" %}
|
|
|
|
<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>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|