()
| 462 | } |
| 463 | |
| 464 | async function loadTraceFile() { |
| 465 | const selectedFile = elements.fileSelect.value; |
| 466 | if (!selectedFile) { |
| 467 | showError('请选择一个trace文件'); |
| 468 | return; |
| 469 | } |
| 470 | |
| 471 | showLoading(); |
| 472 | |
| 473 | try { |
| 474 | // 加载文件 |
| 475 | await apiCall('/api/load_trace', { |
| 476 | method: 'POST', |
| 477 | body: JSON.stringify({ file_path: selectedFile }) |
| 478 | }); |
| 479 | |
| 480 | // 并行加载所有数据 |
| 481 | const [basicInfo, executionSummary, performanceSummary, executionFlow, spansStats, stepLogsStats] = await Promise.all([ |
| 482 | apiCall('/api/basic_info'), |
| 483 | apiCall('/api/execution_summary'), |
| 484 | apiCall('/api/performance_summary'), |
| 485 | apiCall('/api/execution_flow'), |
| 486 | apiCall('/api/spans_summary'), |
| 487 | apiCall('/api/step_logs_summary') |
| 488 | ]); |
| 489 | |
| 490 | // 更新界面 |
| 491 | updateBasicInfo(basicInfo); |
| 492 | updateExecutionSummary(executionSummary); |
| 493 | updatePerformanceSummary(performanceSummary); |
| 494 | updateExecutionFlow(executionFlow); |
| 495 | updateSpansStats(spansStats); |
| 496 | updateStepLogsStats(stepLogsStats); |
| 497 | |
| 498 | // 显示当前文件信息 |
| 499 | const currentFile = currentFileList[currentFileIndex]; |
| 500 | if (currentFile) { |
| 501 | showSuccess(`文件加载成功: ${currentFile.name} (${currentFileIndex + 1}/${currentFileList.length})`); |
| 502 | } else { |
| 503 | showSuccess('文件加载成功'); |
| 504 | } |
| 505 | |
| 506 | } catch (error) { |
| 507 | showError('加载文件失败: ' + error.message); |
| 508 | } finally { |
| 509 | hideLoading(); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | // 界面更新函数 |
| 514 | function updateBasicInfo(data) { |
no test coverage detected