@extends('layouts.app') @section('title', '실행 상세 - #' . $run->id) @section('content')

실행 상세 #{{ $run->id }}

{{ $run->flow->name }}

@if($run->status === 'FAILED' || $run->status === 'PARTIAL') @endif 편집 {{ $run->status_label }}

실행 정보

상태
{{ $run->status_label }}
진행률
{{ $run->progress }}%
완료 스텝
{{ $run->completed_steps }}/{{ $run->total_steps ?? '-' }}
@if($run->failed_step)
실패 스텝
Step {{ $run->failed_step }}
@endif
소요시간
@if($run->duration_ms) {{ number_format($run->duration_ms / 1000, 2) }}s @else - @endif
시작시간
{{ $run->started_at?->format('H:i:s') ?? '-' }}
완료시간
{{ $run->completed_at?->format('H:i:s') ?? '-' }}
실행일
{{ $run->created_at->format('Y-m-d') }}
@if($run->error_message)

에러 메시지

{{ $run->error_message }}

@endif

실행 로그

@php // 전체 스텝 목록 (flow_definition에서) $allSteps = $run->flow->flow_definition['steps'] ?? []; // execution_log를 stepId로 인덱싱 $executionByStepId = []; foreach ($run->execution_log ?? [] as $log) { $stepId = $log['stepId'] ?? $log['step_id'] ?? null; if ($stepId) $executionByStepId[$stepId] = $log; } // api_logs를 URI 기준으로 그룹화 $apiLogsByUri = []; foreach ($run->api_logs ?? [] as $apiLog) { $uri = $apiLog['uri'] ?? ''; if ($uri) { $apiLogsByUri[$uri][] = $apiLog; } } @endphp @if(count($allSteps) > 0)
@foreach($allSteps as $index => $step) @php $stepId = $step['id'] ?? 'step_'.($index + 1); $stepName = $step['name'] ?? ''; $stepMethod = $step['method'] ?? ''; $stepEndpoint = $step['endpoint'] ?? ''; $executed = $executionByStepId[$stepId] ?? null; // null = 미실행, true = 성공, false = 실패 $status = $executed ? ($executed['success'] ?? false) : null; // 실패 스텝의 api_logs 찾기 $stepApiLogs = []; if ($status === false && $stepEndpoint) { foreach ($apiLogsByUri as $uri => $logs) { if (str_contains($uri, $stepEndpoint) || str_contains($stepEndpoint, $uri)) { $stepApiLogs = array_merge($stepApiLogs, $logs); } } } @endphp {{-- 미실행 카드 (회색) --}} @if($status === null)
{{ $stepId }} {{ $stepName }} {{ $stepMethod }} {{ Str::limit($stepEndpoint, 30) }} (미실행)
{{-- 성공 카드 (녹색, 항상 펼쳐짐) --}} @elseif($status === true)
{{-- 헤더 --}}
{{ $stepId }} {{ $executed['name'] ?? $executed['stepName'] ?? $stepName }} {{ $executed['request']['method'] ?? $stepMethod }} {{ Str::limit($executed['request']['endpoint'] ?? $stepEndpoint, 30) }}
@if(isset($executed['response']['status'])) {{ $executed['response']['status'] }} @endif {{ $executed['duration'] ?? '' }}ms
{{-- 상세 (항상 표시) --}}
@if(isset($executed['request']))
Request
{{ $executed['request']['method'] ?? '' }} {{ $executed['request']['endpoint'] ?? '' }} @if(!empty($executed['request']['body']))
요청 데이터
{{ json_encode($executed['request']['body'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif
@endif @if(isset($executed['response']))
Response
{{ $executed['response']['status'] ?? '-' }} @if(!empty($executed['response']['body']))
응답 데이터
{{ json_encode($executed['response']['body'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif
@endif @if(isset($executed['reason']))
성공 이유: {{ $executed['reason'] }}
@endif
{{-- 실패 카드 (빨간색, 항상 펼쳐짐 + Laravel Log 버튼) --}} @else
{{-- 헤더 --}}
{{ $stepId }} {{ $executed['name'] ?? $executed['stepName'] ?? $stepName }} {{ $executed['request']['method'] ?? $stepMethod }} {{ Str::limit($executed['request']['endpoint'] ?? $stepEndpoint, 30) }}
@if(isset($executed['response']['status'])) {{ $executed['response']['status'] }} @endif {{ $executed['duration'] ?? '' }}ms
{{-- 상세 (항상 표시) --}}
@if(isset($executed['request']))
Request
{{ $executed['request']['method'] ?? '' }} {{ $executed['request']['endpoint'] ?? '' }} @if(!empty($executed['request']['body']))
요청 데이터
{{ json_encode($executed['request']['body'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif
@endif @if(isset($executed['response']))
Response
{{ $executed['response']['status'] ?? '-' }} @if(isset($executed['expect']['status'])) 예상: {{ is_array($executed['expect']['status']) ? implode(', ', $executed['expect']['status']) : $executed['expect']['status'] }} @endif
@if(!empty($executed['response']['body']))
응답 데이터
{{ json_encode($executed['response']['body'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif
@endif @if(isset($executed['reason']))
실패 이유: {{ $executed['reason'] }}
@endif @if(isset($executed['error']))
에러
{{ $executed['error'] }}
@endif {{-- Laravel Log 보기 (DaisyUI collapse) --}} @if(!empty($stepApiLogs))
Laravel Log 보기 (API 서버) {{ count($stepApiLogs) }}
@foreach($stepApiLogs as $apiLog) @php $isReq = ($apiLog['type'] ?? '') === 'request'; $isErr = !$isReq && (($apiLog['status'] ?? 0) >= 400); @endphp
{{ $isReq ? 'REQ' : 'RES' }} @if($isReq) {{ $apiLog['method'] ?? '' }} {{ $apiLog['uri'] ?? '' }} @else {{ $apiLog['status'] ?? '-' }} @endif {{ $apiLog['timestamp'] ?? '' }}
{{-- 원본 로그 표시 --}} @if(!empty($apiLog['raw']))
{{ $apiLog['raw'] }}
@else {{-- raw가 없는 경우 기존 방식 --}} @if($isReq && !empty($apiLog['input']))
요청 데이터
{{ json_encode($apiLog['input'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}
@endif @if(!$isReq && isset($apiLog['message']))
{{ $apiLog['message'] }}
@endif @if(!$isReq && isset($apiLog['error']))
오류 상세
{{ is_array($apiLog['error']) ? json_encode($apiLog['error'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) : $apiLog['error'] }}
@endif @endif
@endforeach
@endif
@endif @endforeach
@else

스텝 정보가 없습니다.

@endif
@endsection @push('scripts') @endpush