DockerLogsCtrl.java 1.99 KB
package com.ui.ctrl;


import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.domain.DockerLogResp;
import com.ui.model.domain.Logsets;
import com.ui.model.req.DockerLogReq;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.LinkedHashMap;
import java.util.List;

@Controller
@RequestMapping("/dockerLogs")
public class DockerLogsCtrl {

    private  static final Logger LOGGER  = LoggerFactory.getLogger(DockerLogsCtrl.class);
    @Autowired
    HttpRestClient httpRestClient;

    /**
     * 跳转至 docker 日志查询页面
     *
     * @return
     */
    @RequestMapping("toDockerLog")
    public ModelAndView toMonitorAlarmPage() {
        ModelAndView mv = new ModelAndView("dockerLog/dockerLog");
        //获取日志集 list
        BaseResponse resp = httpRestClient.defaultGet("/dockerLogs/logsets" , BaseResponse.class ,null );
        if( resp.getCode() == 200){
            mv.addObject("logSetInfoList" , resp.getData() );
        }

        return mv;
    }

    @RequestMapping("/searchlog")
    @ResponseBody
    public BaseResponse<DockerLogResp> searchlog(@RequestBody DockerLogReq req ) {
        LOGGER.info("searchlog, req param is {}", req);
        BaseResponse resp = httpRestClient.defaultPost("/dockerLogs/searchlog", req, BaseResponse.class);
        return resp;
    }

    @RequestMapping("/getTopicList")
    @ResponseBody
    public BaseResponse getTopicList(String logset_id ) {

        BaseResponse resp = httpRestClient.defaultGet("/dockerLogs/getTopicList?logset_id="+logset_id,  BaseResponse.class, null);
        return resp;
    }

}