Files
sam-manage/resources/views/dev-tools/api-explorer/partials/history-drawer.blade.php
hskwon bfbf4d3225 feat(api-explorer): Phase 1 기본 구조 및 OpenAPI 파싱 구현
- Config: api-explorer.php (환경, 보안, 캐시 설정)
- Migration: api_bookmarks, api_templates, api_histories, api_environments
- Model: ApiBookmark, ApiTemplate, ApiHistory, ApiEnvironment
- Service: OpenApiParserService, ApiRequestService, ApiExplorerService
- Controller: ApiExplorerController (CRUD, 실행, 히스토리)
- View: 3-Panel 레이아웃 (sidebar, request, response, history)
- Route: 23개 엔드포인트 등록

Swagger UI 대체 개발 도구, HTMX 기반 SPA 경험
2025-12-17 21:06:41 +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>