Implement report generation features and UI enhancements
- Added a new API for generating reports, including functions to retrieve report status, agent logs, console logs, and report details. - Enhanced the Step3Simulation component to manage report generation with loading indicators and improved user feedback during the process. - Introduced a new Step4Report component to display report details and logs, providing a comprehensive view of the report generation workflow. - Updated routing to include a dedicated report view, improving navigation and user experience in the application.
This commit is contained in:
43
frontend/src/api/report.js
Normal file
43
frontend/src/api/report.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import service, { requestWithRetry } from './index'
|
||||
|
||||
/**
|
||||
* 开始报告生成
|
||||
* @param {Object} data - { simulation_id, force_regenerate? }
|
||||
*/
|
||||
export const generateReport = (data) => {
|
||||
return requestWithRetry(() => service.post('/api/report/generate', data), 3, 1000)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报告生成状态
|
||||
* @param {string} reportId
|
||||
*/
|
||||
export const getReportStatus = (reportId) => {
|
||||
return service.get(`/api/report/generate/status`, { params: { report_id: reportId } })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Agent 日志(增量)
|
||||
* @param {string} reportId
|
||||
* @param {number} fromLine - 从第几行开始获取
|
||||
*/
|
||||
export const getAgentLog = (reportId, fromLine = 0) => {
|
||||
return service.get(`/api/report/${reportId}/agent-log`, { params: { from_line: fromLine } })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取控制台日志(增量)
|
||||
* @param {string} reportId
|
||||
* @param {number} fromLine - 从第几行开始获取
|
||||
*/
|
||||
export const getConsoleLog = (reportId, fromLine = 0) => {
|
||||
return service.get(`/api/report/${reportId}/console-log`, { params: { from_line: fromLine } })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报告详情
|
||||
* @param {string} reportId
|
||||
*/
|
||||
export const getReport = (reportId) => {
|
||||
return service.get(`/api/report/${reportId}`)
|
||||
}
|
||||
Reference in New Issue
Block a user