package com.ruoyi.platform.controller.tensorBoard;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.service.TensorBoardService;
import com.ruoyi.platform.vo.FrameLogPathVo;
import com.ruoyi.platform.vo.PodStatusVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("tensorBoard")
@Api("TensorBoard管理")
public class TensorBoardController extends BaseController {

    @Resource
    private TensorBoardService tensorBoardService;

    /**
     * 启动tensorBoard接口
     *
     * @param frameLogPathVo 存储路径
     * @return url
     */
    @PostMapping("/run")
    @ApiOperation("启动tensorBoard")
    @ApiResponse
    public GenericsAjaxResult<String> runTensorBoard(@RequestBody FrameLogPathVo frameLogPathVo) throws Exception {
        return  genericsSuccess(tensorBoardService.runTensorBoard(frameLogPathVo));
    }
    @PostMapping("/getStatus")
    @ApiResponse
    public GenericsAjaxResult<PodStatusVo> getStatus(@RequestBody FrameLogPathVo frameLogPathVo) throws Exception {
        return  genericsSuccess(tensorBoardService.getTensorBoardStatus(frameLogPathVo));
    }
}
