Implement simulation environment management features in frontend

- Added new API functions for closing the simulation environment and retrieving its status.
- Enhanced the SimulationRunView and SimulationView components to gracefully handle simulation termination when navigating between steps.
- Introduced logging for better user feedback during the simulation closure process, including attempts to force stop if graceful closure fails.
This commit is contained in:
666ghj
2025-12-12 16:25:28 +08:00
parent 0577ecdae8
commit ec418c1def
3 changed files with 132 additions and 4 deletions

View File

@@ -152,3 +152,19 @@ export const getSimulationActions = (simulationId, params = {}) => {
return service.get(`/api/simulation/${simulationId}/actions`, { params })
}
/**
* 关闭模拟环境(优雅退出)
* @param {Object} data - { simulation_id, timeout? }
*/
export const closeSimulationEnv = (data) => {
return service.post('/api/simulation/close-env', data)
}
/**
* 获取模拟环境状态
* @param {Object} data - { simulation_id }
*/
export const getEnvStatus = (data) => {
return service.post('/api/simulation/env-status', data)
}