Files
sam-manage/resources/views/dev-tools/api-explorer/partials/history-drawer.blade.php
hskwon fbd4fb728e feat: [api-explorer] Phase 1 기본 구조 및 OpenAPI 파싱 구현
- Config, Service, Controller, View 생성
- Model 4개 (admin_api_* 테이블 참조)
- 3-Panel 레이아웃 (sidebar, request, response)
- HTMX 기반 동적 UI
- 마이그레이션은 api/ 프로젝트에서 관리
2025-12-17 22:06:28 +09:00

52 lines
2.4 KiB
PHP

@if($histories->isEmpty())
<div class="text-center text-gray-400 py-8">
<svg class="w-8 h-8 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<p class="text-sm">히스토리가 없습니다</p>
</div>
@else
<div class="divide-y divide-gray-100">
@foreach($histories as $history)
<div class="p-3 hover:bg-gray-50 cursor-pointer" onclick="replayHistory({{ $history->id }})">
<div class="flex items-center justify-between mb-1">
<div class="flex items-center gap-2">
<span class="method-badge method-{{ strtolower($history->method) }}">
{{ $history->method }}
</span>
<span class="status-{{ $history->response_status >= 200 && $history->response_status < 300 ? '2xx' : ($history->response_status >= 400 && $history->response_status < 500 ? '4xx' : ($history->response_status >= 500 ? '5xx' : '3xx')) }} font-semibold text-sm">
{{ $history->response_status }}
</span>
</div>
<span class="text-xs text-gray-400">{{ $history->duration_ms }}ms</span>
</div>
<div class="text-sm text-gray-700 truncate" title="{{ $history->endpoint }}">
{{ $history->endpoint }}
</div>
<div class="flex items-center justify-between mt-1">
<span class="text-xs text-gray-400">{{ $history->environment }}</span>
<span class="text-xs text-gray-400">{{ $history->created_at->diffForHumans() }}</span>
</div>
</div>
@endforeach
</div>
@endif
<script>
async function replayHistory(historyId) {
const response = await fetch(`/dev-tools/api-explorer/history/${historyId}/replay`, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
if (response.ok) {
const data = await response.json();
// TODO: 요청 패널에 데이터 채우기
showToast('히스토리가 로드되었습니다.');
toggleHistoryDrawer();
}
}
</script>