머신 상세 페이지 Headscale CLI 기반 완전 재구현

- get_machine_detail 함수를 Headscale CLI 기반으로 완전 교체
- 기존 FARMQ DB 의존성에서 실시간 Headscale 데이터로 전환
- strftime 템플릿 오류 완전 해결 (datetime 객체 타입 체크 추가)
- 실제 머신 정보 표시: 호스트명, IP 주소, 온라인 상태, 사용자 정보
- 약국 정보 매핑: Headscale 사용자명을 통한 약국 연동
- 시간 정보 인간화: "N시간 전", "N분 전" 형식으로 표시
- 네트워크 정보: IPv4/IPv6 주소, 엔드포인트, 키 정보 표시
- 조건부 모니터링 데이터 표시 (향후 확장 대비)
- 전체 머신 상세 페이지 기능 정상화

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-11 12:07:53 +09:00
parent 56b72629f9
commit f3965a67fd
3 changed files with 136 additions and 40 deletions

View File

@@ -96,7 +96,17 @@
</tr>
<tr>
<th>등록일</th>
<td>{{ machine.created_at.strftime('%Y년 %m월 %d일 %H:%M') if machine.created_at else '알 수 없음' }}</td>
<td>
{% if machine.created_at %}
{% if machine.created_at.__class__.__name__ == 'datetime' %}
{{ machine.created_at.strftime('%Y년 %m월 %d일 %H:%M') }}
{% else %}
{{ machine.created_at }}
{% endif %}
{% else %}
알 수 없음
{% endif %}
</td>
</tr>
</table>
</div>
@@ -141,7 +151,11 @@
<th>마지막 접속</th>
<td>
{% if machine.last_seen %}
{{ machine.last_seen.strftime('%Y-%m-%d %H:%M:%S') }}
{% if machine.last_seen.__class__.__name__ == 'datetime' %}
{{ machine.last_seen.strftime('%Y-%m-%d %H:%M:%S') }}
{% else %}
{{ machine.last_seen }}
{% endif %}
<br><small class="text-muted">{{ last_seen_humanized }}</small>
{% else %}
<span class="text-muted">알 수 없음</span>
@@ -210,7 +224,16 @@
<div class="card">
<div class="card-header">
<h5 class="mb-0"><i class="fas fa-chart-line"></i> 현재 상태</h5>
<small class="text-muted">최종 업데이트: {{ latest_monitoring.collected_at.strftime('%Y-%m-%d %H:%M:%S') }}</small>
{% if latest_monitoring and latest_monitoring.collected_at %}
<small class="text-muted">
최종 업데이트:
{% if latest_monitoring.collected_at.__class__.__name__ == 'datetime' %}
{{ latest_monitoring.collected_at.strftime('%Y-%m-%d %H:%M:%S') }}
{% else %}
{{ latest_monitoring.collected_at }}
{% endif %}
</small>
{% endif %}
</div>
<div class="card-body">
<div class="row">