feat: sync execution with 3s progress polling (stage 2)
- pulp_client: get_repo / sync_repo / get_task (비동기 task href 반환)
- POST /repos/{uuid}/sync: remote 확인 후 동기화 시작, 진행률 조각 반환
- GET /repos/{uuid}/progress: progress_reports 합산 → 바/퍼센트,
완료/실패 시 hx-trigger 제거로 폴링 중단
- task_store: uuid→task_href 메모리 추적 (단일 인스턴스), 대시보드 '동기화 중' 집계
- views.task_progress: state/done/total/percent + created_resources에서 새 vN
- 동기화는 안전 동작이라 확인 모달 없이 실행 (스펙 §5-1)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
21
app/templates/partials/progress.html
Normal file
21
app/templates/partials/progress.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{# 진행률 바 조각. running 일 때만 hx-trigger 를 달아 3초 폴링; 완료/실패 시 폴링 중단. #}
|
||||
<div id="prog-{{ uuid }}"
|
||||
{% if progress.running %}hx-get="/repos/{{ uuid }}/progress" hx-trigger="every 3s" hx-swap="outerHTML"{% endif %}>
|
||||
{% if progress.failed %}
|
||||
<span class="status-line status-bad">동기화 실패: {{ progress.error }}</span>
|
||||
{% elif progress.completed %}
|
||||
<span class="badge badge-pass">동기화 완료{% if progress.new_version %} · v{{ progress.new_version }} 생성됨{% endif %}</span>
|
||||
{% elif progress.idle %}
|
||||
{# 추적 중인 작업 없음 — 빈 조각 #}
|
||||
{% else %}
|
||||
<div class="sync-progress">
|
||||
{% if progress.total %}
|
||||
<progress value="{{ progress.done }}" max="{{ progress.total }}"></progress>
|
||||
<small class="num">{{ progress.done }}/{{ progress.total }} 패키지 · {{ progress.percent }}%</small>
|
||||
{% else %}
|
||||
<progress></progress>
|
||||
<small>동기화 준비 중…</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -31,8 +31,13 @@
|
||||
<td class="num">{% if repo.package_count is not none %}{{ repo.package_count }}{% else %}—{% endif %}</td>
|
||||
<td>{{ repo.last_sync or "—" }}</td>
|
||||
<td>
|
||||
<!-- 동기화 버튼은 단계2에서 동작 연결 -->
|
||||
<button disabled class="secondary">동기화</button>
|
||||
<div id="sync-{{ repo.uuid }}">
|
||||
<button class="secondary"
|
||||
hx-post="/repos/{{ repo.uuid }}/sync"
|
||||
hx-target="#sync-{{ repo.uuid }}"
|
||||
hx-swap="innerHTML"
|
||||
hx-disabled-elt="this">동기화</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user