DockerLogsCtrl.java
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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;
}
}