Initial commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
{% 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">
|
||||
یک apply در انتظار تأیید است.
|
||||
<a href="{{ url_for('apply.status', log_id=pending.id) }}">ادامه</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<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>
|
||||
<form method="post" action="{{ url_for('apply.apply', profile_id=p.id) }}">
|
||||
<div class="mb-2">
|
||||
<label class="form-label small">پنجره rollback (دقیقه)</label>
|
||||
<input type="number" name="rollback_minutes" class="form-control form-control-sm" value="15" min="5" max="60">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success" onclick="return confirm('Backup گرفته میشود. Docker ممکن است restart شود. ادامه؟')">
|
||||
اعمال پروفایل
|
||||
</button>
|
||||
</form>
|
||||
</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></tr></thead>
|
||||
<tbody>
|
||||
{% for log in recent_logs %}
|
||||
<tr>
|
||||
<td>{{ log.profile.name if log.profile else '-' }}</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 %}
|
||||
@@ -0,0 +1,62 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}وضعیت Apply{% endblock %}
|
||||
{% block content %}
|
||||
<h2>وضعیت اعمال پروفایل</h2>
|
||||
<p>پروفایل: <strong>{{ log.profile.name if log.profile else '-' }}</strong></p>
|
||||
<p>وضعیت: <span class="badge bg-{% if log.status == 'confirmed' %}success{% elif log.status == 'failed' %}danger{% else %}warning{% endif %}">{{ log.status }}</span></p>
|
||||
|
||||
{% if not log.confirmed and log.status == 'pending_confirm' %}
|
||||
<div class="alert alert-warning" id="rollback-alert">
|
||||
<strong>پنجره تست:</strong>
|
||||
<span id="countdown">{{ remaining_seconds }}</span> ثانیه تا rollback خودکار
|
||||
</div>
|
||||
<div class="d-flex gap-2 mb-4">
|
||||
<form method="post" action="{{ url_for('apply.confirm', log_id=log.id) }}">
|
||||
<button type="submit" class="btn btn-success">تأیید و نگهداشتن تغییرات</button>
|
||||
</form>
|
||||
<form method="post" action="{{ url_for('apply.rollback', log_id=log.id) }}">
|
||||
<button type="submit" class="btn btn-warning">Rollback دستی</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h4>جزئیات مراحل</h4>
|
||||
{% for step in details.get('steps', []) %}
|
||||
<div class="card mb-2">
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex justify-content-between">
|
||||
<span><strong>{{ step.category }}</strong> — {{ step.get('mirror', '') }}</span>
|
||||
{% if step.get('success', True) %}
|
||||
<span class="text-success">موفق</span>
|
||||
{% else %}
|
||||
<span class="text-danger">ناموفق</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if step.get('message') %}<small class="text-muted">{{ step.message }}</small>{% endif %}
|
||||
{% if step.get('error') %}<small class="text-danger d-block">{{ step.error }}</small>{% endif %}
|
||||
{% if step.get('warning') %}<small class="text-warning d-block">{{ step.warning }}</small>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<a href="{{ url_for('main.dashboard') }}" class="btn btn-secondary mt-3">داشبورد</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{% if not log.confirmed and log.status == 'pending_confirm' %}
|
||||
<script>
|
||||
(function() {
|
||||
let remaining = {{ remaining_seconds }};
|
||||
const el = document.getElementById('countdown');
|
||||
const tick = setInterval(function() {
|
||||
remaining--;
|
||||
if (el) el.textContent = remaining;
|
||||
if (remaining <= 0) {
|
||||
clearInterval(tick);
|
||||
location.reload();
|
||||
}
|
||||
}, 1000);
|
||||
})();
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user