Files
mirror/app/templates/apply/index.html
T
mohammadian7 63d0699cdd Fix Docker apply crash and add safe profile test flow
Remove invalid _mirror_manager from daemon.json that prevented Docker from starting. Add 2-minute test apply with auto-rollback, final apply confirmation, emergency-restore CLI/UI, and post-restart Docker health checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 20:20:10 +03:30

75 lines
3.5 KiB
HTML

{% extends "base.html" %}
{% from "macros.html" import guide_box %}
{% block title %}اعمال تنظیمات{% endblock %}
{% block content %}
<h2>اعمال پروفایل</h2>
{{ guide_box(guide, 'profiles') }}
{% if pending and not pending.confirmed %}
<div class="alert alert-warning">
یک تست موقت در انتظار تأیید است.
<a href="{{ url_for('apply.status', log_id=pending.id) }}">ادامه و تأیید / rollback</a>
</div>
{% endif %}
<div class="alert alert-info small">
<strong>توصیه:</strong> همیشه ابتدا «تست موقت» را بزنید.
اگر {{ test_minutes }} دقیقه تأیید نکنید، تنظیمات قبلی خودکار برمی‌گردد.
Docker ممکن است چند ثانیه restart شود.
</div>
<div class="row g-3 mb-4">
{% for p in profiles %}
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h5>{{ p.name }}</h5>
<p class="small text-muted">{{ p.description }}</p>
<ul class="list-unstyled small mb-3">
{% for item in p.items %}
<li>{{ item.category }}: <strong>{{ item.mirror.name if item.mirror else '-' }}</strong></li>
{% endfor %}
</ul>
<div class="d-flex flex-wrap gap-2">
<form method="post" action="{{ url_for('apply.apply_test', profile_id=p.id) }}">
<button type="submit" class="btn btn-warning" onclick="return confirm('تست موقت {{ test_minutes }} دقیقه‌ای اعمال شود؟ در صورت مشکل خودکار rollback می‌شود.')">
تست موقت ({{ test_minutes }} دقیقه)
</button>
</form>
<form method="post" action="{{ url_for('apply.apply_final', profile_id=p.id) }}">
<button type="submit" class="btn btn-success" onclick="return confirm('اعمال نهایی بدون پنجره rollback. فقط بعد از تست موفق بزنید. ادامه؟')">
اعمال نهایی
</button>
</form>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
<h4>تاریخچه apply</h4>
<div class="table-responsive">
<table class="table table-sm">
<thead><tr><th>پروفایل</th><th>نوع</th><th>وضعیت</th><th>شروع</th><th></th></tr></thead>
<tbody>
{% for log in recent_logs %}
<tr>
<td>{{ log.profile.name if log.profile else '-' }}</td>
<td>
{% if log.get_details().get('mode') == 'final' %}
<span class="badge bg-success">نهایی</span>
{% else %}
<span class="badge bg-warning text-dark">تست</span>
{% endif %}
</td>
<td><span class="badge bg-secondary">{{ log.status }}</span></td>
<td>{{ log.started_at.strftime('%Y-%m-%d %H:%M') }}</td>
<td><a href="{{ url_for('apply.status', log_id=log.id) }}">جزئیات</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}