|
|
@@ -2,6 +2,8 @@ package cn.reghao.devops.mgr.admin.controller;
|
|
|
|
|
|
import cn.reghao.devops.mgr.admin.model.vo.DashboardData;
|
|
|
import cn.reghao.devops.mgr.admin.service.HomeViewService;
|
|
|
+import cn.reghao.devops.mgr.ops.srv.mon.ContainerReportVO;
|
|
|
+import cn.reghao.devops.mgr.ops.srv.mon.PrometheusService;
|
|
|
import cn.reghao.jutil.web.WebResult;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
@@ -19,9 +21,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
@Controller
|
|
|
public class HomeController {
|
|
|
private final HomeViewService homeViewService;
|
|
|
+ private final PrometheusService prometheusService;
|
|
|
|
|
|
- public HomeController(HomeViewService homeViewService) {
|
|
|
+ public HomeController(HomeViewService homeViewService, PrometheusService prometheusService) {
|
|
|
this.homeViewService = homeViewService;
|
|
|
+ this.prometheusService = prometheusService;
|
|
|
}
|
|
|
|
|
|
//@Operation(summary = "后台首页", description = "N")
|
|
|
@@ -33,8 +37,13 @@ public class HomeController {
|
|
|
@Operation(summary = "后台首页", description = "N")
|
|
|
@GetMapping(value = "/api/devops/dashboard", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
@ResponseBody
|
|
|
- public String dashboardData() {
|
|
|
- DashboardData dashboardData = homeViewService.getDashboardData();
|
|
|
- return WebResult.success(dashboardData);
|
|
|
+ public String dashboardData() throws Exception {
|
|
|
+ //DashboardData dashboardData = homeViewService.getDashboardData();
|
|
|
+ ContainerReportVO containerReportVO = prometheusService.getReportData();
|
|
|
+ if (containerReportVO != null) {
|
|
|
+ return WebResult.success(containerReportVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return WebResult.failWithMsg("get dashboard data failed");
|
|
|
}
|
|
|
}
|