Преглед на файлове

优化修改 dmaster 应用模块的页面接口和页面

reghao преди 4 години
родител
ревизия
6d0ccae9f4
променени са 38 файла, в които са добавени 1003 реда и са изтрити 399 реда
  1. 0 230
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/AppPageController.java
  2. 137 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/BuildDeployLogPageController.java
  3. 64 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/BuildDeployPageController.java
  4. 79 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/StatusPageController.java
  5. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/AppConfigPageController.java
  6. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/BuildDirPageController.java
  7. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/CompilerPageController.java
  8. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/PackerPageController.java
  9. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/RepoAuthPageController.java
  10. 1 1
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/AppBuildingQuery.java
  11. 6 9
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/BuildLogQuery.java
  12. 32 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/BuildLogQueryImpl.java
  13. 8 9
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/DeployLogQuery.java
  14. 33 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/DeployLogQueryImpl.java
  15. 1 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/repository/log/DeployLogRepository.java
  16. 44 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/AppBuildingVO.java
  17. 26 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/AppDeployingVO.java
  18. 26 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/BuildTimeVo.java
  19. 38 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/CommitInfoVO.java
  20. 8 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/AppStatusPage.java
  21. 16 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployLogPage.java
  22. 40 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployLogPageImpl.java
  23. 18 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployPage.java
  24. 98 0
      dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployPageImpl.java
  25. 0 37
      dmaster/src/main/resources/templates/app/bd/buildconfig.html
  26. 0 74
      dmaster/src/main/resources/templates/app/bd/buildlog.html
  27. 0 25
      dmaster/src/main/resources/templates/app/bd/buildtime.html
  28. 4 7
      dmaster/src/main/resources/templates/app/bd/index.html
  29. 60 0
      dmaster/src/main/resources/templates/app/bd/log/buildconfig.html
  30. 66 0
      dmaster/src/main/resources/templates/app/bd/log/buildlog.html
  31. 0 0
      dmaster/src/main/resources/templates/app/bd/log/buildresult.html
  32. 27 0
      dmaster/src/main/resources/templates/app/bd/log/buildtime.html
  33. 1 2
      dmaster/src/main/resources/templates/app/bd/log/commitinfo.html
  34. 66 0
      dmaster/src/main/resources/templates/app/bd/log/deploylog.html
  35. 99 0
      dmaster/src/main/resources/templates/app/bd/log/index.html
  36. 0 0
      dmaster/src/main/resources/templates/app/bd/log/packscript.html
  37. 0 0
      dmaster/src/main/resources/templates/app/stat/applog.html
  38. 0 0
      dmaster/src/main/resources/templates/app/stat/index.html

+ 0 - 230
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/AppPageController.java

@@ -1,230 +0,0 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
-
-import cn.reghao.autodop.dmaster.app.model.constant.AppType;
-import cn.reghao.autodop.dmaster.app.model.constant.EnvList;
-import cn.reghao.autodop.dmaster.app.db.query.AppBuildingQuery;
-import cn.reghao.autodop.dmaster.app.db.query.AppDeployingQuery;
-import cn.reghao.autodop.dmaster.app.db.query.AppRunningQuery;
-import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
-import cn.reghao.autodop.dmaster.app.model.po.AppDeploying;
-import cn.reghao.autodop.dmaster.app.model.po.AppRunning;
-import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
-import cn.reghao.autodop.dmaster.app.model.po.config.DeployConfig;
-import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
-import cn.reghao.autodop.dmaster.app.model.po.AppBuilding;
-import cn.reghao.autodop.dmaster.app.model.po.log.BuildTime;
-import cn.reghao.autodop.dmaster.app.db.repository.log.BuildLogRepository;
-import cn.reghao.autodop.dmaster.app.model.vo.BuildConfig;
-import cn.reghao.autodop.dmaster.rbac.UserContext;
-import cn.reghao.autodop.dmaster.rbac.model.constant.RoleType;
-import cn.reghao.autodop.dmaster.util.db.PageList;
-import cn.reghao.autodop.dmaster.util.db.PageSort;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.data.domain.*;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-/**
- * @author reghao
- * @date 2019-08-30 18:49:15
- */
-@Slf4j
-@Api(tags = "应用页面接口")
-@Controller
-@RequestMapping("/app")
-public class AppPageController {
-    private AppConfigQuery appConfigQuery;
-    private AppBuildingQuery buildingQuery;
-    private AppDeployingQuery deployingQuery;
-    private AppRunningQuery runningQuery;
-    private BuildLogRepository buildLogRepository;
-
-    public AppPageController(AppConfigQuery appConfigQuery,
-                             AppBuildingQuery buildingQuery,
-                             AppDeployingQuery deployingQuery,
-                             AppRunningQuery runningQuery,
-                             BuildLogRepository buildLogRepository) {
-        this.appConfigQuery = appConfigQuery;
-        this.buildingQuery = buildingQuery;
-        this.deployingQuery = deployingQuery;
-        this.runningQuery = runningQuery;
-        this.buildLogRepository = buildLogRepository;
-    }
-
-    @ApiOperation(value = "构建部署页面")
-    @GetMapping("/build")
-    public String buildPage(@RequestParam(value = "env", required = false) String env,
-                            @RequestParam(value = "appName", required = false) String appName,
-                            Model model) {
-        if (env == null) {
-            env = EnvList.test.name();
-        }
-
-        if (appName != null) {
-            Map<String, String> map = new HashMap<>();
-            map.put("appName", appName);
-            List<AppBuilding> list = buildingQuery.queryAll(map);
-            Page<AppBuilding> page = new PageImpl<>(list);
-            PageList<AppBuilding> pageList = PageList.pageList(page);
-
-            model.addAttribute("env", env);
-            model.addAttribute("page", page);
-            model.addAttribute("list", pageList.getList());
-            return "/app/bd/build";
-        }
-
-        Set<String> set = new HashSet<>();
-        UserContext.currentUser().getAuthorities().forEach(auth -> {
-            set.add(auth.getAuthority());
-        });
-
-        String appType;
-        if (set.contains(RoleType.ROLE_BACKEND.name())) {
-            appType = AppType.dotnetCore.name();
-        } else if (set.contains(RoleType.ROLE_FRONTEND.name())) {
-            appType = AppType.npm.name();
-        } else {
-            appType = AppType.maven.name();
-        }
-
-        PageRequest pageRequest = PageSort.pageRequest();
-        Page<AppBuilding> appBuildings;
-        Map<String, String> queryMap = new HashMap<>();
-        if (set.contains(RoleType.ROLE_ADMIN.name())) {
-            queryMap.put("env", env);
-            appBuildings = buildingQuery.queryByPage(queryMap, pageRequest);
-        } else {
-            queryMap.put("env", env);
-            queryMap.put("appType", appType);
-            appBuildings = buildingQuery.queryByPage(queryMap, pageRequest);
-        }
-
-        PageList<AppBuilding> pageList = PageList.pageList(appBuildings);
-        model.addAttribute("env", env);
-        model.addAttribute("page", appBuildings);
-        model.addAttribute("list", pageList.getList());
-        return "/app/bd/build";
-    }
-
-    @ApiOperation(value = "部署页面")
-    @GetMapping("/deploy/{appId}")
-    public String deployPage(@PathVariable("appId") String appId, Model model) {
-        AppConfig app = appConfigQuery.findByIsDeleteFalseAndAppId(appId);
-        List<DeployConfig> deployConfigs = app.getDeployConfigs();
-        List<AppDeploying> list = new ArrayList<>();
-        for (DeployConfig deployConfig : deployConfigs) {
-            Map<String, String> queryMap = new HashMap<>();
-            queryMap.put("appId", appId);
-            queryMap.put("machineId", deployConfig.getMachineId());
-            AppDeploying deploying = deployingQuery.query(queryMap);
-            list.add(deploying);
-        }
-
-        model.addAttribute("list", list);
-        return "/app/bd/deploy";
-    }
-
-    // TODO 使用 layui 弹出层
-    // TODO /app/bd/buildresult 可以和 /app/bd/packscript 合并
-    @ApiOperation(value = "构建日志结果页面")
-    @GetMapping("/log/build/{buildLogId}/result")
-    public String buildLogResultPage(@PathVariable("buildLogId") BuildLog buildLog, Model model) {
-        String[] arr = buildLog.getResult().getMsg().split(System.lineSeparator());
-        model.addAttribute("list", arr);
-        return "/app/bd/buildresult";
-    }
-
-    @ApiOperation(value = "构建日志页面")
-    @GetMapping("/log/build")
-    public String buildLogPage(Model model) {
-        PageRequest pageRequest = PageSort.pageRequest();
-        Page<BuildLog> buildLogs = buildLogRepository.findAll(pageRequest);
-        PageList<BuildLog> pageList = PageList.pageList(buildLogs);
-
-        model.addAttribute("page", buildLogs);
-        model.addAttribute("list", pageList.getList());
-        return "/app/bd/buildlog";
-    }
-
-    // TODO 使用 layui 弹出层
-    @ApiOperation(value = "构建配置页面")
-    @GetMapping("/log/build/{buildLogId}/buildconfig")
-    public String buildConfigPage(@PathVariable("buildLogId") BuildLog buildLog, Model model) {
-        BuildConfig buildConfig = buildLog.getBuildConfig();
-        model.addAttribute("buildConfig", buildConfig);
-        return "/app/bd/buildconfig";
-    }
-
-    // TODO 使用 layui 弹出层
-    @ApiOperation(value = "打包脚本页面")
-    @GetMapping("/log/build/{buildLogId}/packscript")
-    public String packScriptPage(@PathVariable("buildLogId") BuildLog buildLog, Model model) {
-        String[] arr = buildLog.getPackScript().split(System.lineSeparator());
-        model.addAttribute("list", arr);
-        return "/app/bd/packscript";
-    }
-
-    // TODO 使用 layui 弹出层
-    @ApiOperation(value = "版本信息页面")
-    @GetMapping("/log/build/{buildLogId}/commitinfo")
-    public String commitInfoPage(@PathVariable("buildLogId") BuildLog buildLog, Model model) {
-        model.addAttribute("commitInfo", buildLog.getCommitInfo());
-        return "/app/bd/commitinfo";
-    }
-
-    // TODO 使用 layui 弹出层
-    @ApiOperation(value = "构建时间页面")
-    @GetMapping("/log/build/{buildLogId}/buildtime")
-    public String buildTimePage(@PathVariable("buildLogId") BuildLog buildLog, Model model) {
-        BuildTime buildTime = buildLog.getBuildTime();
-        model.addAttribute("buildTime", buildTime);
-        return "/app/bd/buildtime";
-    }
-
-    @ApiOperation(value = "应用运行状态页面")
-    @GetMapping("/status")
-    public String statusPage(@RequestParam(value = "env", required = false) String env,
-                             @RequestParam(value = "appName", required = false) String appName,
-                             Model model) {
-        if (env == null) {
-            env = EnvList.test.name();
-        }
-
-        if (appName != null) {
-            Map<String, String> map = new HashMap<>();
-            map.put("appName", appName);
-            List<AppRunning> list = runningQuery.queryAll(map);
-            Page<AppRunning> page = new PageImpl<>(list);
-            PageList<AppRunning> pageList = PageList.pageList(page);
-
-            model.addAttribute("env", env);
-            model.addAttribute("page", page);
-            model.addAttribute("list", pageList.getList());
-            return "/app/status";
-        }
-
-        Map<String, String> queryMap = new HashMap<>();
-        queryMap.put("env", env);
-        PageRequest pageRequest = PageSort.pageRequest();
-        Page<AppRunning> appRunnings = runningQuery.queryByPage(queryMap, pageRequest);
-        PageList<AppRunning> pageList = PageList.pageList(appRunnings);
-
-        model.addAttribute("env", env);
-        model.addAttribute("page", appRunnings);
-        model.addAttribute("list", pageList.getList());
-        return "/app/status/appstatus";
-    }
-
-    @ApiOperation(value = "应用运行日志页面")
-    @GetMapping("/status/applog/{appId}/{machineId}")
-    public String appLogPage(@PathVariable("appId") String appId,
-                             @PathVariable("machineId") String machineId,
-                             Model model) {
-        return "/app/status/applog";
-    }
-}

+ 137 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/BuildDeployLogPageController.java

@@ -0,0 +1,137 @@
+package cn.reghao.autodop.dmaster.app.controller.page;
+
+import cn.reghao.autodop.dmaster.app.model.constant.EnvList;
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildTime;
+import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import cn.reghao.autodop.dmaster.app.model.vo.AppBuildingVO;
+import cn.reghao.autodop.dmaster.app.model.vo.BuildConfig;
+import cn.reghao.autodop.dmaster.app.model.vo.BuildTimeVo;
+import cn.reghao.autodop.dmaster.app.model.vo.CommitInfoVO;
+import cn.reghao.autodop.dmaster.app.service.bd.tools.repo.CommitInfo;
+import cn.reghao.autodop.dmaster.app.service.page.BuildDeployLogPage;
+import cn.reghao.autodop.dmaster.app.service.page.BuildDeployPage;
+import cn.reghao.autodop.dmaster.util.db.PageList;
+import cn.reghao.autodop.dmaster.util.db.PageSort;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @author reghao
+ * @date 2019-08-30 18:49:15
+ */
+@Slf4j
+@Api(tags = "构建部署日志页面")
+@Controller
+@RequestMapping("/app/bd/log")
+public class BuildDeployLogPageController {
+    private final BuildDeployPage buildDeployPage;
+    private final BuildDeployLogPage buildDeployLogPage;
+
+    public BuildDeployLogPageController(BuildDeployPage buildDeployPage, BuildDeployLogPage buildDeployLogPage) {
+        this.buildDeployPage = buildDeployPage;
+        this.buildDeployLogPage = buildDeployLogPage;
+    }
+
+    @ApiOperation(value = "构建部署日志页面")
+    @GetMapping
+    public String index(@RequestParam(value = "env", required = false) String env,
+                        @RequestParam(value = "appName", required = false) String appName, Model model) {
+        if (env == null) {
+            env = EnvList.test.name();
+        }
+
+        Page<AppBuildingVO> appBuildings;
+        if (appName != null) {
+            appBuildings = buildDeployPage.searchResultPage(appName);
+        } else {
+            PageRequest pageRequest = PageSort.pageRequest();
+            appBuildings = buildDeployPage.indexPage(env, pageRequest);
+        }
+
+        PageList<AppBuildingVO> pageList = PageList.pageList(appBuildings);
+        model.addAttribute("env", env);
+        model.addAttribute("page", appBuildings);
+        model.addAttribute("list", pageList.getList());
+        return "/app/bd/log/index";
+    }
+
+    @ApiOperation(value = "构建日志页面")
+    @GetMapping("/build/{appId}")
+    public String buildLogPage(@PathVariable("appId") String appId, Model model) {
+        PageRequest pageRequest = PageSort.pageRequest();
+        Page<BuildLog> buildLogs = buildDeployLogPage.buildLogs(appId, pageRequest);
+        PageList<BuildLog> pageList = PageList.pageList(buildLogs);
+
+        model.addAttribute("page", buildLogs);
+        model.addAttribute("list", pageList.getList());
+        return "/app/bd/log/buildlog";
+    }
+
+    // TODO 使用 layui 弹出层
+    @ApiOperation(value = "构建配置页面")
+    @GetMapping("/build/{buildLogId}/buildconfig")
+    public String buildConfigPage(@PathVariable("buildLogId") String buildLogId, Model model) {
+        BuildLog buildLog = buildDeployLogPage.findByBuildLogId(buildLogId);
+        BuildConfig buildConfig = buildLog.getBuildConfig();
+        model.addAttribute("buildConfig", buildConfig);
+        return "/app/bd/log/buildconfig";
+    }
+
+    @ApiOperation(value = "打包脚本页面")
+    @GetMapping("/build/{buildLogId}/packscript")
+    public String packScriptPage(@PathVariable("buildLogId") String buildLogId, Model model) {
+        BuildLog buildLog = buildDeployLogPage.findByBuildLogId(buildLogId);
+        String[] arr = buildLog.getPackScript().split(System.lineSeparator());
+        model.addAttribute("list", arr);
+        return "/app/bd/log/packscript";
+    }
+
+    @ApiOperation(value = "版本信息页面")
+    @GetMapping("/build/{buildLogId}/commitinfo")
+    public String commitInfoPage(@PathVariable("buildLogId") String buildLogId, Model model) {
+        BuildLog buildLog = buildDeployLogPage.findByBuildLogId(buildLogId);
+        CommitInfo commitInfo = buildLog.getCommitInfo();
+        model.addAttribute("commitInfo", new CommitInfoVO(commitInfo));
+        return "/app/bd/log/commitinfo";
+    }
+
+    @ApiOperation(value = "构建时间页面")
+    @GetMapping("/build/{buildLogId}/buildtime")
+    public String buildTimePage(@PathVariable("buildLogId") String buildLogId, Model model) {
+        BuildLog buildLog = buildDeployLogPage.findByBuildLogId(buildLogId);
+        BuildTime buildTime = buildLog.getBuildTime();
+        model.addAttribute("buildTime", new BuildTimeVo(buildTime));
+        return "/app/bd/log/buildtime";
+    }
+
+    @ApiOperation(value = "构建日志结果页面")
+    @GetMapping("/build/{buildLogId}/result")
+    public String buildLogResultPage(@PathVariable("buildLogId") String buildLogId, Model model) {
+        BuildLog buildLog = buildDeployLogPage.findByBuildLogId(buildLogId);
+        String[] arr = buildLog.getResult().getMsg().split(System.lineSeparator());
+        model.addAttribute("list", arr);
+        return "/app/bd/log/buildresult";
+    }
+
+    @ApiOperation(value = "部署日志页面")
+    @GetMapping("/deploy/{appId}")
+    public String deployLogPage(@PathVariable("appId") String appId, Model model) {
+        PageRequest pageRequest = PageSort.pageRequest();
+        Page<DeployLog> deployLogs = buildDeployLogPage.deployLogs(appId, pageRequest);
+        PageList<DeployLog> pageList = PageList.pageList(deployLogs);
+
+        model.addAttribute("page", deployLogs);
+        model.addAttribute("list", pageList.getList());
+        return "/app/bd/log/deploylog";
+    }
+}

+ 64 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/BuildDeployPageController.java

@@ -0,0 +1,64 @@
+package cn.reghao.autodop.dmaster.app.controller.page;
+
+import cn.reghao.autodop.dmaster.app.model.constant.EnvList;
+import cn.reghao.autodop.dmaster.app.model.vo.AppBuildingVO;
+import cn.reghao.autodop.dmaster.app.model.vo.AppDeployingVO;
+import cn.reghao.autodop.dmaster.app.service.page.BuildDeployPage;
+import cn.reghao.autodop.dmaster.util.db.PageList;
+import cn.reghao.autodop.dmaster.util.db.PageSort;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+
+/**
+ * @author reghao
+ * @date 2019-08-30 18:49:15
+ */
+@Slf4j
+@Api(tags = "构建部署页面")
+@Controller
+@RequestMapping("/app/bd")
+public class BuildDeployPageController {
+    private final BuildDeployPage buildDeployPage;
+
+    public BuildDeployPageController(BuildDeployPage buildDeployPage) {
+        this.buildDeployPage = buildDeployPage;
+    }
+
+    @ApiOperation(value = "构建部署页面")
+    @GetMapping
+    public String index(@RequestParam(value = "env", required = false) String env,
+                        @RequestParam(value = "appName", required = false) String appName, Model model) {
+        if (env == null) {
+            env = EnvList.test.name();
+        }
+
+        Page<AppBuildingVO> appBuildings;
+        if (appName != null) {
+            appBuildings = buildDeployPage.searchResultPage(appName);
+        } else {
+            PageRequest pageRequest = PageSort.pageRequest();
+            appBuildings = buildDeployPage.indexPage(env, pageRequest);
+        }
+
+        PageList<AppBuildingVO> pageList = PageList.pageList(appBuildings);
+        model.addAttribute("env", env);
+        model.addAttribute("page", appBuildings);
+        model.addAttribute("list", pageList.getList());
+        return "/app/bd/index";
+    }
+
+    @ApiOperation(value = "部署状态页面")
+    @GetMapping("/deploy/{appId}")
+    public String deployStatusPage(@PathVariable("appId") String appId, Model model) {
+        List<AppDeployingVO> list = buildDeployPage.deployStatus(appId);
+        model.addAttribute("list", list);
+        return "/app/bd/deploy";
+    }
+}

+ 79 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/StatusPageController.java

@@ -0,0 +1,79 @@
+package cn.reghao.autodop.dmaster.app.controller.page;
+
+import cn.reghao.autodop.dmaster.app.db.query.AppRunningQuery;
+import cn.reghao.autodop.dmaster.app.model.constant.EnvList;
+import cn.reghao.autodop.dmaster.app.model.po.AppRunning;
+import cn.reghao.autodop.dmaster.util.db.PageList;
+import cn.reghao.autodop.dmaster.util.db.PageSort;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.*;
+
+/**
+ * @author reghao
+ * @date 2019-08-30 18:49:15
+ */
+@Slf4j
+@Api(tags = "应用状态页面")
+@Controller
+@RequestMapping("/app/stat")
+public class StatusPageController {
+    private AppRunningQuery runningQuery;
+
+    public StatusPageController(AppRunningQuery runningQuery) {
+        this.runningQuery = runningQuery;
+    }
+
+    @ApiOperation(value = "应用运行状态页面")
+    @GetMapping
+    public String statusPage(@RequestParam(value = "env", required = false) String env,
+                             @RequestParam(value = "appName", required = false) String appName,
+                             Model model) {
+        if (env == null) {
+            env = EnvList.test.name();
+        }
+
+        if (appName != null) {
+            Map<String, String> map = new HashMap<>();
+            map.put("appName", appName);
+            List<AppRunning> list = runningQuery.queryAll(map);
+            Page<AppRunning> page = new PageImpl<>(list);
+            PageList<AppRunning> pageList = PageList.pageList(page);
+
+            model.addAttribute("env", env);
+            model.addAttribute("page", page);
+            model.addAttribute("list", pageList.getList());
+            return "/app/status";
+        }
+
+        Map<String, String> queryMap = new HashMap<>();
+        queryMap.put("env", env);
+        PageRequest pageRequest = PageSort.pageRequest();
+        Page<AppRunning> appRunnings = runningQuery.queryByPage(queryMap, pageRequest);
+        PageList<AppRunning> pageList = PageList.pageList(appRunnings);
+
+        model.addAttribute("env", env);
+        model.addAttribute("page", appRunnings);
+        model.addAttribute("list", pageList.getList());
+        return "/app/stat/index";
+    }
+
+    @ApiOperation(value = "应用运行日志页面")
+    @GetMapping("/status/applog/{appId}/{machineId}")
+    public String appLogPage(@PathVariable("appId") String appId,
+                             @PathVariable("machineId") String machineId,
+                             Model model) {
+        return "/app/stat/applog";
+    }
+}

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/AppConfigPageController.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/AppConfigPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
+package cn.reghao.autodop.dmaster.app.controller.page.config;
 
 import cn.reghao.autodop.common.msg.rpc.dto.app.PackType;
 import cn.reghao.autodop.dmaster.app.model.constant.AppType;

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/BuildDirPageController.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/BuildDirPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
+package cn.reghao.autodop.dmaster.app.controller.page.config;
 
 import cn.reghao.autodop.common.machine.Disk;
 import cn.reghao.autodop.dmaster.app.db.query.config.BuildDirQuery;

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/CompilerPageController.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/CompilerPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
+package cn.reghao.autodop.dmaster.app.controller.page.config;
 
 import cn.reghao.autodop.common.machine.Machine;
 import cn.reghao.autodop.dmaster.app.db.query.config.CompilerConfigQuery;

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/PackerPageController.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/PackerPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
+package cn.reghao.autodop.dmaster.app.controller.page.config;
 
 import cn.reghao.autodop.common.machine.Machine;
 import cn.reghao.autodop.common.msg.rpc.dto.app.PackType;

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/RepoAuthPageController.java → dmaster/src/main/java/cn/reghao/autodop/dmaster/app/controller/page/config/RepoAuthPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.autodop.dmaster.app.controller.page;
+package cn.reghao.autodop.dmaster.app.controller.page.config;
 
 import cn.reghao.autodop.dmaster.app.db.query.config.RepoAuthConfigQuery;
 import cn.reghao.autodop.dmaster.app.model.constant.build.RepoAuthType;

+ 1 - 1
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/AppBuildingQuery.java

@@ -18,7 +18,7 @@ import java.util.Map;
  */
 @Service
 public class AppBuildingQuery {
-    private AppBuildingRepository buildingRepository;
+    private final AppBuildingRepository buildingRepository;
 
     public AppBuildingQuery(AppBuildingRepository buildingRepository) {
         this.buildingRepository = buildingRepository;

+ 6 - 9
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/BuildLogQuery.java

@@ -1,17 +1,14 @@
 package cn.reghao.autodop.dmaster.app.db.query.log;
 
-import cn.reghao.autodop.dmaster.app.db.repository.log.BuildLogRepository;
-import org.springframework.stereotype.Service;
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 
 /**
  * @author reghao
  * @date 2021-06-17 15:50:46
  */
-@Service
-public class BuildLogQuery {
-    private BuildLogRepository buildLogRepository;
-
-    public BuildLogQuery(BuildLogRepository buildLogRepository) {
-        this.buildLogRepository = buildLogRepository;
-    }
+public interface BuildLogQuery {
+    Page<BuildLog> findByAppId(String appId, Pageable pageable);
+    BuildLog findById(String id);
 }

+ 32 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/BuildLogQueryImpl.java

@@ -0,0 +1,32 @@
+package cn.reghao.autodop.dmaster.app.db.query.log;
+
+import cn.reghao.autodop.dmaster.app.db.repository.log.BuildLogRepository;
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2021-06-17 15:50:46
+ */
+@Service
+public class BuildLogQueryImpl implements BuildLogQuery {
+    private final BuildLogRepository buildLogRepository;
+
+    public BuildLogQueryImpl(BuildLogRepository buildLogRepository) {
+        this.buildLogRepository = buildLogRepository;
+    }
+
+    @Override
+    public Page<BuildLog> findByAppId(String appId, Pageable pageable) {
+        return buildLogRepository.findByAppId(appId, pageable);
+    }
+
+    @Override
+    public BuildLog findById(String id) {
+        return buildLogRepository.findById(id).orElse(null);
+    }
+}

+ 8 - 9
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/DeployLogQuery.java

@@ -1,17 +1,16 @@
 package cn.reghao.autodop.dmaster.app.db.query.log;
 
-import cn.reghao.autodop.dmaster.app.db.repository.log.DeployLogRepository;
-import org.springframework.stereotype.Service;
+import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.util.List;
 
 /**
  * @author reghao
  * @date 2021-06-17 15:50:46
  */
-@Service
-public class DeployLogQuery {
-    private DeployLogRepository deployLogRepository;
-
-    public DeployLogQuery(DeployLogRepository deployLogRepository) {
-        this.deployLogRepository = deployLogRepository;
-    }
+public interface DeployLogQuery {
+    List<DeployLog> findDeployLogByBuildLogId(String buildLogId);
+    Page<DeployLog> deployLogs(String appId, Pageable pageable);
 }

+ 33 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/query/log/DeployLogQueryImpl.java

@@ -0,0 +1,33 @@
+package cn.reghao.autodop.dmaster.app.db.query.log;
+
+import cn.reghao.autodop.dmaster.app.db.repository.log.DeployLogRepository;
+import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2021-06-17 15:50:46
+ */
+@Service
+public class DeployLogQueryImpl implements DeployLogQuery {
+    private DeployLogRepository deployLogRepository;
+
+    public DeployLogQueryImpl(DeployLogRepository deployLogRepository) {
+        this.deployLogRepository = deployLogRepository;
+    }
+
+    @Override
+    public List<DeployLog> findDeployLogByBuildLogId(String buildLogId) {
+        return null;
+    }
+
+    @Override
+    public Page<DeployLog> deployLogs(String appId, Pageable pageable) {
+
+        return null;
+    }
+}

+ 1 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/db/repository/log/DeployLogRepository.java

@@ -1,6 +1,7 @@
 package cn.reghao.autodop.dmaster.app.db.repository.log;
 
 import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import org.springframework.data.domain.Page;
 import org.springframework.data.mongodb.repository.MongoRepository;
 
 import java.util.List;

+ 44 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/AppBuildingVO.java

@@ -0,0 +1,44 @@
+package cn.reghao.autodop.dmaster.app.model.vo;
+
+import cn.reghao.autodop.dmaster.app.model.po.AppBuilding;
+import cn.reghao.jdkutil.converter.DateTimeConverter;
+import lombok.Data;
+
+/**
+ * @author reghao
+ * @date 2021-05-21 09:57:35
+ */
+@Data
+public class AppBuildingVO {
+    private String appId;
+    private String appName;
+    private String appType;
+    private String env;
+    private String repoBranch;
+    private Integer httpPort;
+
+    private String buildLogId;
+    private String commitId;
+    private String commitTime;
+    private String buildResult;
+    private String buildTime;
+    private String packagePath;
+    private String buildBy;
+
+    public AppBuildingVO(AppBuilding appBuilding) {
+        this.appId = appBuilding.getAppId();
+        this.appName = appBuilding.getAppName();
+        this.appType = appBuilding.getAppType();
+        this.env = appBuilding.getEnv();
+        this.repoBranch = appBuilding.getRepoBranch();
+        this.httpPort = appBuilding.getHttpPort();
+
+        this.buildLogId = appBuilding.getBuildLogId();
+        this.commitId = appBuilding.getCommitId();
+        this.commitTime = DateTimeConverter.format(appBuilding.getCommitTime());
+        this.buildResult = appBuilding.getBuildResult();
+        this.buildTime = DateTimeConverter.format(appBuilding.getBuildTime());
+        this.packagePath = appBuilding.getPackagePath();
+        this.buildBy = appBuilding.getBuildBy();
+    }
+}

+ 26 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/AppDeployingVO.java

@@ -0,0 +1,26 @@
+package cn.reghao.autodop.dmaster.app.model.vo;
+
+import cn.reghao.autodop.dmaster.app.model.po.AppDeploying;
+import cn.reghao.jdkutil.converter.DateTimeConverter;
+import lombok.Data;
+
+/**
+ * @author reghao
+ * @date 2021-05-21 09:57:35
+ */
+@Data
+public class AppDeployingVO {
+    private String machineIpv4;
+    private String commitId;
+    private String deployTime;
+    private String deployResult;
+    private String deployBy;
+
+    public AppDeployingVO(AppDeploying appDeploying) {
+        this.machineIpv4 = appDeploying.getMachineIpv4();
+        this.commitId = appDeploying.getCommitId();
+        this.deployTime = DateTimeConverter.format(appDeploying.getDeployTime());
+        this.deployResult = appDeploying.getDeployResult();
+        this.deployBy = appDeploying.getDeployBy();
+    }
+}

+ 26 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/BuildTimeVo.java

@@ -0,0 +1,26 @@
+package cn.reghao.autodop.dmaster.app.model.vo;
+
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildTime;
+import cn.reghao.jdkutil.converter.DateTimeConverter;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 20:40:29
+ */
+@Data
+public class BuildTimeVo {
+    private Long updateTotalTime;
+    private Long compileTotalTime;
+    private Long packTotalTime;
+    private String buildTime;
+
+    public BuildTimeVo(BuildTime buildTime) {
+        this.updateTotalTime = buildTime.getUpdateTotalTime();
+        this.compileTotalTime = buildTime.getCompileTotalTime();
+        this.packTotalTime = buildTime.getPackTotalTime();
+        this.buildTime = DateTimeConverter.format(buildTime.getBuildTime());
+    }
+}

+ 38 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/model/vo/CommitInfoVO.java

@@ -0,0 +1,38 @@
+package cn.reghao.autodop.dmaster.app.model.vo;
+
+import cn.reghao.autodop.dmaster.app.service.bd.tools.repo.ChangedFile;
+import cn.reghao.autodop.dmaster.app.service.bd.tools.repo.CommitInfo;
+import cn.reghao.jdkutil.converter.DateTimeConverter;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 20:40:37
+ */
+@Data
+public class CommitInfoVO {
+    private String remote;
+    private String branch;
+    private String local;
+    // 代码是否更新
+    private boolean isUpdate;
+    private String commitId;
+    private String commitAuthor;
+    private String commitMsg;
+    private String commitTime;
+    private List<ChangedFile> changedFiles;
+
+    public CommitInfoVO(CommitInfo commitInfo) {
+        this.remote = commitInfo.getRemote();
+        this.branch = commitInfo.getBranch();
+        this.local = commitInfo.getLocal();
+        this.isUpdate = commitInfo.isUpdate();
+        this.commitId = commitInfo.getCommitId();
+        this.commitAuthor = commitInfo.getCommitAuthor();
+        this.commitMsg = commitInfo.getCommitMsg();
+        this.commitTime = DateTimeConverter.format(commitInfo.getMsCommitTime());
+        this.changedFiles = commitInfo.getChangedFiles();
+    }
+}

+ 8 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/AppStatusPage.java

@@ -0,0 +1,8 @@
+package cn.reghao.autodop.dmaster.app.service.page;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 18:46:44
+ */
+public interface AppStatusPage {
+}

+ 16 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployLogPage.java

@@ -0,0 +1,16 @@
+package cn.reghao.autodop.dmaster.app.service.page;
+
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
+import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 18:46:34
+ */
+public interface BuildDeployLogPage {
+    Page<BuildLog> buildLogs(String appId, PageRequest pageRequest);
+    BuildLog findByBuildLogId(String buildLogId);
+    Page<DeployLog> deployLogs(String appId, PageRequest pageRequest);
+}

+ 40 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployLogPageImpl.java

@@ -0,0 +1,40 @@
+package cn.reghao.autodop.dmaster.app.service.page;
+
+import cn.reghao.autodop.dmaster.app.db.query.log.BuildLogQuery;
+import cn.reghao.autodop.dmaster.app.db.query.log.DeployLogQuery;
+import cn.reghao.autodop.dmaster.app.model.po.log.BuildLog;
+import cn.reghao.autodop.dmaster.app.model.po.log.DeployLog;
+import cn.reghao.autodop.dmaster.app.model.vo.AppBuildingVO;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 18:46:34
+ */
+@Service
+public class BuildDeployLogPageImpl implements BuildDeployLogPage {
+    private final BuildLogQuery buildLogQuery;
+    private final DeployLogQuery deployLogQuery;
+
+    public BuildDeployLogPageImpl(BuildLogQuery buildLogQuery, DeployLogQuery deployLogQuery) {
+        this.buildLogQuery = buildLogQuery;
+        this.deployLogQuery = deployLogQuery;
+    }
+
+    @Override
+    public Page<BuildLog> buildLogs(String appId, PageRequest pageRequest) {
+        return buildLogQuery.findByAppId(appId, pageRequest);
+    }
+
+    @Override
+    public BuildLog findByBuildLogId(String buildLogId) {
+        return buildLogQuery.findById(buildLogId);
+    }
+
+    @Override
+    public Page<DeployLog> deployLogs(String appId, PageRequest pageRequest) {
+        return null;
+    }
+}

+ 18 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployPage.java

@@ -0,0 +1,18 @@
+package cn.reghao.autodop.dmaster.app.service.page;
+
+import cn.reghao.autodop.dmaster.app.model.vo.AppBuildingVO;
+import cn.reghao.autodop.dmaster.app.model.vo.AppDeployingVO;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+
+import java.util.List;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 18:46:34
+ */
+public interface BuildDeployPage {
+    Page<AppBuildingVO> indexPage(String env, PageRequest pageRequest);
+    Page<AppBuildingVO> searchResultPage(String appName);
+    List<AppDeployingVO> deployStatus(String appId);
+}

+ 98 - 0
dmaster/src/main/java/cn/reghao/autodop/dmaster/app/service/page/BuildDeployPageImpl.java

@@ -0,0 +1,98 @@
+package cn.reghao.autodop.dmaster.app.service.page;
+
+import cn.reghao.autodop.dmaster.app.db.query.AppBuildingQuery;
+import cn.reghao.autodop.dmaster.app.db.query.AppDeployingQuery;
+import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
+import cn.reghao.autodop.dmaster.app.db.query.log.BuildLogQuery;
+import cn.reghao.autodop.dmaster.app.model.constant.AppType;
+import cn.reghao.autodop.dmaster.app.model.po.AppBuilding;
+import cn.reghao.autodop.dmaster.app.model.po.AppDeploying;
+import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
+import cn.reghao.autodop.dmaster.app.model.po.config.DeployConfig;
+import cn.reghao.autodop.dmaster.app.model.vo.AppBuildingVO;
+import cn.reghao.autodop.dmaster.app.model.vo.AppDeployingVO;
+import cn.reghao.autodop.dmaster.rbac.UserContext;
+import cn.reghao.autodop.dmaster.rbac.model.constant.RoleType;
+import cn.reghao.autodop.dmaster.util.db.PageSort;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @author reghao
+ * @date 2021-10-20 18:46:34
+ */
+@Service
+public class BuildDeployPageImpl implements BuildDeployPage {
+    private AppConfigQuery appConfigQuery;
+    private AppBuildingQuery buildingQuery;
+    private AppDeployingQuery deployingQuery;
+    private BuildLogQuery buildLogQuery;
+
+    public BuildDeployPageImpl(AppConfigQuery appConfigQuery, AppBuildingQuery buildingQuery,
+                               AppDeployingQuery deployingQuery, BuildLogQuery buildLogQuery) {
+        this.appConfigQuery = appConfigQuery;
+        this.buildingQuery = buildingQuery;
+        this.deployingQuery = deployingQuery;
+        this.buildLogQuery = buildLogQuery;
+    }
+
+    @Override
+    public Page<AppBuildingVO> indexPage(String env, PageRequest pageRequest) {
+        Set<String> set = new HashSet<>();
+        UserContext.currentUser().getAuthorities().forEach(auth -> {
+            set.add(auth.getAuthority());
+        });
+
+        String appType;
+        if (set.contains(RoleType.ROLE_BACKEND.name())) {
+            appType = AppType.dotnetCore.name();
+        } else if (set.contains(RoleType.ROLE_FRONTEND.name())) {
+            appType = AppType.npm.name();
+        } else {
+            appType = AppType.maven.name();
+        }
+
+        Page<AppBuilding> appBuildings;
+        Map<String, String> queryMap = new HashMap<>();
+        if (set.contains(RoleType.ROLE_ADMIN.name())) {
+            queryMap.put("env", env);
+            appBuildings = buildingQuery.queryByPage(queryMap, pageRequest);
+        } else {
+            queryMap.put("env", env);
+            queryMap.put("appType", appType);
+            appBuildings = buildingQuery.queryByPage(queryMap, pageRequest);
+        }
+
+        return appBuildings.map(AppBuildingVO::new);
+    }
+
+    @Override
+    public Page<AppBuildingVO> searchResultPage(String appName) {
+        Map<String, String> map = new HashMap<>();
+        map.put("appName", appName);
+        List<AppBuilding> list = buildingQuery.queryAll(map);
+        Page<AppBuilding> page = new PageImpl<>(list);
+        return page.map(AppBuildingVO::new);
+    }
+
+    @Override
+    public List<AppDeployingVO> deployStatus(String appId) {
+        AppConfig app = appConfigQuery.findByIsDeleteFalseAndAppId(appId);
+        List<DeployConfig> deployConfigs = app.getDeployConfigs();
+
+        List<AppDeployingVO> list = new ArrayList<>();
+        for (DeployConfig deployConfig : deployConfigs) {
+            Map<String, String> queryMap = new HashMap<>();
+            queryMap.put("appId", appId);
+            queryMap.put("machineId", deployConfig.getMachineId());
+            AppDeploying deploying = deployingQuery.query(queryMap);
+            list.add(new AppDeployingVO(deploying));
+        }
+
+        return list;
+    }
+}

+ 0 - 37
dmaster/src/main/resources/templates/app/bd/buildconfig.html

@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org">
-<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
-<body>
-<div class="timo-detail-page">
-    <table class="layui-table timo-detail-table">
-        <tbody>
-        <tr>
-            <th>仓库类型</th>
-            <td th:text="${buildConfig.repoAuth.type}"></td>
-            <th>仓库认证名字</th>
-            <td th:text="${buildConfig.repoAuth.name}"></td>
-            <th>认证类型</th>
-            <td th:text="${buildConfig.repoAuth.authType}"></td>
-        </tr>
-        <tr>
-            <th>编译器类型</th>
-            <td th:text="${buildConfig.compiler.type}"></td>
-            <th>编译器名字</th>
-            <td th:text="${buildConfig.compiler.name}"></td>
-            <th>编译命令</th>
-            <td th:text="${buildConfig.compiler.compileCmd}"></td>
-        </tr>
-        <tr>
-            <th>打包类型</th>
-            <td th:text="${buildConfig.packer.type}"></td>
-            <th>打包名字</th>
-            <td th:text="${buildConfig.packer.name}"></td>
-            <th>打包路径</th>
-            <td th:text="${buildConfig.packer.targetPath}"></td>
-        </tr>
-        </tbody>
-    </table>
-</div>
-<script th:replace="/common/template :: script"></script>
-</body>
-</html>

+ 0 - 74
dmaster/src/main/resources/templates/app/bd/buildlog.html

@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org">
-<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
-
-<body class="timo-layout-page">
-<div class="layui-card">
-    <div class="layui-card-header timo-card-header">
-        <span><i class="fa fa-bars"></i> 构建日志</span>
-        <i class="layui-icon layui-icon-refresh refresh-btn"></i>
-    </div>
-    <div class="layui-card-body">
-        <div class="timo-table-wrap">
-            <table class="layui-table timo-table">
-                <thead>
-                <tr>
-                    <th class="sortable" data-field="appId">应用 ID</th>
-                    <th class="sortable" data-field="appType">应用类型</th>
-                    <th class="sortable" data-field="env">环境</th>
-                    <th class="sortable" data-field="repoBranch">分支</th>
-                    <th class="sortable" data-field="buildConfig">构建配置</th>
-                    <th class="sortable" data-field="packScript">打包脚本</th>
-                    <th class="sortable" data-field="packagePath">包路径</th>
-                    <th class="sortable" data-field="commitInfo">版本信息</th>
-                    <th class="sortable" data-field="buildTime">构建时间</th>
-                    <th class="sortable" data-field="result">构建结果</th>
-                    <th class="sortable" data-field="buildBy">构建用户</th>
-                    <th>操作</th>
-                </tr>
-                </thead>
-                <tbody>
-                <tr th:each="item:${list}">
-                    <td th:text="${item.appId}">应用 ID</td>
-                    <td th:text="${item.appType}">应用类型</td>
-                    <td th:text="${item.env}">环境</td>
-                    <td th:text="${item.repoBranch}">分支</td>
-                    <td>
-                        <a class="open-popup" data-title="构建配置" data-size="1000,500" href="#"
-                           th:attr="data-url=@{'/app/log/build/'+${item.id} + '/buildconfig'}">查看</a>
-                    </td>
-                    <td>
-                        <a class="open-popup" data-title="打包脚本" data-size="1000,500" href="#"
-                           th:attr="data-url=@{'/app/log/build/'+${item.id} + '/packscript'}">查看</a>
-                    </td>
-                    <td th:text="${item.packagePath}">包路径</td>
-                    <td>
-                        <a class="open-popup" data-title="版本信息" data-size="1000,500" href="#"
-                           th:attr="data-url=@{'/app/log/build/'+${item.id} + '/commitinfo'}">查看</a>
-                    </td>
-                    <td>
-                        <a class="open-popup" data-title="构建时间" data-size="1000,500" href="#"
-                           th:attr="data-url=@{'/app/log/build/'+${item.id} + '/buildtime'}">查看</a>
-                    </td>
-                    <td>
-                        <a class="open-popup" data-title="构建结果" data-size="1000,500" href="#"
-                           th:attr="data-url=@{'/app/log/build/'+${item.id} + '/result'}">查看</a>
-                    </td>
-                    <td th:text="${item.buildBy}">构建用户</td>
-                    <td>
-                        <a class="open-popup" data-title="应用部署" th:attr="data-url=@{'/app/deploy/' + ${item.appId}}"
-                           data-size="1000,500" href="#">部署</a>
-                    </td>
-                </tr>
-                </tbody>
-            </table>
-        </div>
-        <div th:replace="/common/fragment :: page"></div>
-    </div>
-</div>
-
-<script th:replace="/common/template :: script"></script>
-<script type="text/javascript">
-</script>
-</body>
-</html>

+ 0 - 25
dmaster/src/main/resources/templates/app/bd/buildtime.html

@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:th="http://www.thymeleaf.org">
-<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
-<body>
-<div class="timo-detail-page">
-    <table class="layui-table timo-detail-table">
-        <tbody>
-        <tr>
-            <th>代码更新耗时</th>
-            <td th:text="${buildTime.updateTotalTime}"></td>
-            <th>代码编译耗时</th>
-            <td th:text="${buildTime.compileTotalTime}"></td>
-            <th>代码打包耗时</th>
-            <td th:text="${buildTime.packTotalTime}"></td>
-        </tr>
-        <tr>
-            <th>构建时间</th>
-            <td th:text="${buildTime.buildTime}"></td>
-        </tr>
-        </tbody>
-    </table>
-</div>
-<script th:replace="/common/template :: script"></script>
-</body>
-</html>

+ 4 - 7
dmaster/src/main/resources/templates/app/bd/build.html → dmaster/src/main/resources/templates/app/bd/index.html

@@ -49,7 +49,6 @@
                     <th class="sortable" data-field="commitTime">提交时间</th>
                     <th class="sortable" data-field="result">结果</th>
                     <th class="sortable" data-field="buildTime">构建时间</th>
-                    <!--<th class="sortable" data-field="packagePath">包路径</th>-->
                     <th class="sortable" data-field="buildBy">构建用户</th>
                     <th>操作</th>
                 </tr>
@@ -69,18 +68,16 @@
                     <td th:text="${item.commitTime}">提交时间</td>
                     <td>
                         <a class="open-popup build-result" data-title="构建结果" href="#"
-                           th:text="${item.buildResult}" th:attr="data-url=@{'/app/log/build/'+${item.buildLogId} + '/result'}"></a>
+                           th:text="${item.buildResult}" th:attr="data-url=@{'/app/bd/log/build/'+${item.buildLogId} + '/result'}"></a>
                     </td>
                     <td th:text="${item.buildTime}">构建时间</td>
-                    <!--<td th:text="${item.packagePath}">包路径</td>-->
                     <td th:text="${item.buildBy}">构建用户</td>
                     <td>
                         <a class="ajax-post" th:href="@{'/api/app/bd/update?appId='+${item.appId}}">更新</a>
                         <a class="ajax-post" th:href="@{'/api/app/bd/build?appId='+${item.appId}}">构建</a>
-                        <a class="open-popup" data-title="应用部署" th:attr="data-url=@{'/app/deploy/'+${item.appId}}"
-                           data-size="1000,500" href="#">部署</a>
-                        <a class="open-popup" data-title="构建历史" th:attr="data-url=@{'/app/deploy/'+${item.appId}}"
-                           data-size="1000,500" href="#">构建历史</a>
+                        <a class="ajax-post" th:href="@{'/api/app/bd/deploy?appId='+${item.buildLogId}}">部署</a>
+                        <a class="open-popup" data-title="应用部署状态" th:attr="data-url=@{'/app/bd/deploy/'+${item.appId}}"
+                           data-size="1000,500" href="#">部署状态</a>
                     </td>
                 </tr>
                 </tbody>

+ 60 - 0
dmaster/src/main/resources/templates/app/bd/log/buildconfig.html

@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
+<body>
+<div class="timo-detail-page">
+    <div class="timo-detail-title">仓库认证</div>
+    <table class="layui-table timo-detail-table">
+        <thead>
+        <tr>
+            <th data-field="type">仓库类型</th>
+            <th data-field="name">认证名字</th>
+            <th data-field="authType">认证类型</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td th:text="${buildConfig.repoAuth.type}"></td>
+            <td th:text="${buildConfig.repoAuth.name}"></td>
+            <td th:text="${buildConfig.repoAuth.authType}"></td>
+        </tr>
+        </tbody>
+    </table>
+    <div class="timo-detail-title">编译配置</div>
+    <table class="layui-table timo-detail-table">
+        <thead>
+        <tr>
+            <th data-field="type">编译器类型</th>
+            <th data-field="name">编译器名字</th>
+            <th data-field="compileCmd">编译命令</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td th:text="${buildConfig.compiler.type}"></td>
+            <td th:text="${buildConfig.compiler.name}"></td>
+            <td th:text="${buildConfig.compiler.compileCmd}"></td>
+        </tr>
+        </tbody>
+    </table>
+    <div class="timo-detail-title">打包配置</div>
+    <table class="layui-table timo-detail-table">
+        <thead>
+        <tr>
+            <th data-field="type">打包类型</th>
+            <th data-field="name">打包名字</th>
+            <th data-field="targetPath">打包路径</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td th:text="${buildConfig.packer.type}"></td>
+            <td th:text="${buildConfig.packer.name}"></td>
+            <td th:text="${buildConfig.packer.targetPath}"></td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+<script th:replace="/common/template :: script"></script>
+</body>
+</html>

+ 66 - 0
dmaster/src/main/resources/templates/app/bd/log/buildlog.html

@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
+
+<body class="timo-layout-page">
+<div class="layui-card">
+    <div class="timo-table-wrap">
+        <table class="layui-table timo-table">
+            <thead>
+            <tr>
+                <th class="sortable" data-field="appId">应用 ID</th>
+                <th class="sortable" data-field="appType">应用类型</th>
+                <th class="sortable" data-field="env">环境</th>
+                <th class="sortable" data-field="repoBranch">分支</th>
+                <th class="sortable" data-field="buildConfig">构建配置</th>
+                <th class="sortable" data-field="packScript">打包脚本</th>
+                <th class="sortable" data-field="packagePath">包路径</th>
+                <th class="sortable" data-field="commitInfo">版本信息</th>
+                <th class="sortable" data-field="buildTime">构建时间</th>
+                <th class="sortable" data-field="result">构建结果</th>
+                <th class="sortable" data-field="buildBy">构建用户</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr th:each="item:${list}">
+                <td th:text="${item.appId}">应用 ID</td>
+                <td th:text="${item.appType}">应用类型</td>
+                <td th:text="${item.env}">环境</td>
+                <td th:text="${item.repoBranch}">分支</td>
+                <td>
+                    <a class="open-popup" data-title="构建配置" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/buildconfig'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="打包脚本" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/packscript'}">查看</a>
+                </td>
+                <td th:text="${item.packagePath}">包路径</td>
+                <td>
+                    <a class="open-popup" data-title="版本信息" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/commitinfo'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="构建时间" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/buildtime'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="构建结果" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/result'}">查看</a>
+                </td>
+                <td th:text="${item.buildBy}">构建用户</td>
+                <td>
+                    <a class="ajax-post" th:href="@{'/api/app/bd/deploy?appId='+${item.id}}">部署</a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+    <div th:replace="/common/fragment :: page"></div>
+</div>
+
+<script th:replace="/common/template :: script"></script>
+<script type="text/javascript"></script>
+</body>
+</html>

+ 0 - 0
dmaster/src/main/resources/templates/app/bd/buildresult.html → dmaster/src/main/resources/templates/app/bd/log/buildresult.html


+ 27 - 0
dmaster/src/main/resources/templates/app/bd/log/buildtime.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
+<body>
+<div class="timo-detail-page">
+    <table class="layui-table timo-detail-table">
+        <thead>
+        <tr>
+            <th class="sortable" data-field="updateTotalTime">更新耗时(ms)</th>
+            <th class="sortable" data-field="compileTotalTime">编译耗时(ms)</th>
+            <th class="sortable" data-field="packTotalTime">打包耗时(ms)</th>
+            <th class="sortable" data-field="buildTime">构建时间</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td th:text="${buildTime.updateTotalTime}">更新耗时</td>
+            <td th:text="${buildTime.compileTotalTime}">编译耗时</td>
+            <td th:text="${buildTime.packTotalTime}">打包耗时</td>
+            <td th:text="${buildTime.buildTime}">构建时间</td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+<script th:replace="/common/template :: script"></script>
+</body>
+</html>

+ 1 - 2
dmaster/src/main/resources/templates/app/bd/commitinfo.html → dmaster/src/main/resources/templates/app/bd/log/commitinfo.html

@@ -19,7 +19,7 @@
             <th>提交信息</th>
             <td th:text="${commitInfo?.commitMsg}"></td>
             <th>提交时间</th>
-            <td th:text="${commitInfo?.msCommitTime}"></td>
+            <td th:text="${commitInfo?.commitTime}"></td>
         </tr>
         </tbody>
     </table>
@@ -32,7 +32,6 @@
             <th class="sortable" data-field="newFilePath">变更后路径</th>
         </tr>
         </thead>
-
         <tbody>
         <tr th:each="item:${commitInfo?.changedFiles}">
             <td th:text="${item.changeType}">变更类型</td>

+ 66 - 0
dmaster/src/main/resources/templates/app/bd/log/deploylog.html

@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
+
+<body class="timo-layout-page">
+<div class="layui-card">
+    <div class="timo-table-wrap">
+        <table class="layui-table timo-table">
+            <thead>
+            <tr>
+                <th class="sortable" data-field="appId">应用 ID</th>
+                <th class="sortable" data-field="appType">应用类型</th>
+                <th class="sortable" data-field="env">环境</th>
+                <th class="sortable" data-field="repoBranch">分支</th>
+                <th class="sortable" data-field="buildConfig">构建配置</th>
+                <th class="sortable" data-field="packScript">打包脚本</th>
+                <th class="sortable" data-field="packagePath">包路径</th>
+                <th class="sortable" data-field="commitInfo">版本信息</th>
+                <th class="sortable" data-field="buildTime">构建时间</th>
+                <th class="sortable" data-field="result">构建结果</th>
+                <th class="sortable" data-field="buildBy">构建用户</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr th:each="item:${list}">
+                <td th:text="${item.appId}">应用 ID</td>
+                <td th:text="${item.appType}">应用类型</td>
+                <td th:text="${item.env}">环境</td>
+                <td th:text="${item.repoBranch}">分支</td>
+                <td>
+                    <a class="open-popup" data-title="构建配置" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/buildconfig'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="打包脚本" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/packscript'}">查看</a>
+                </td>
+                <td th:text="${item.packagePath}">包路径</td>
+                <td>
+                    <a class="open-popup" data-title="版本信息" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/commitinfo'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="构建时间" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/buildtime'}">查看</a>
+                </td>
+                <td>
+                    <a class="open-popup" data-title="构建结果" data-size="1000,500" href="#"
+                       th:attr="data-url=@{'/app/bd/log/build/'+${item.id} + '/result'}">查看</a>
+                </td>
+                <td th:text="${item.buildBy}">构建用户</td>
+                <td>
+                    <a class="ajax-post" th:href="@{'/api/app/bd/deploy?appId='+${item.id}}">部署</a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+    <div th:replace="/common/fragment :: page"></div>
+</div>
+
+<script th:replace="/common/template :: script"></script>
+<script type="text/javascript"></script>
+</body>
+</html>

+ 99 - 0
dmaster/src/main/resources/templates/app/bd/log/index.html

@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org"
+      xmlns:mo="https://gitee.com/aun/Timo">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})"></head>
+
+<body class="timo-layout-page">
+<div class="layui-card" th:attr="data-url=@{'/app/build/list?env=' + ${env}}">
+    <div class="layui-card-header timo-card-header">
+        <span><i class="fa fa-bars"></i> 构建部署日志</span>
+        <i class="layui-icon layui-icon-refresh refresh-btn"></i>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-row timo-card-screen put-row">
+            <div class="pull-left layui-form-pane">
+                <div class="layui-inline">
+                    <label class="layui-form-label">环境</label>
+                    <div class="layui-input-block timo-search-status">
+                        <select id="getPageByEnv" class="timo-search-select" name="env" onchange="getPageByEnv()"
+                                mo:dict="ENVIRONMENT" mo-selected="${env}"></select>
+                    </div>
+                </div>
+                <div class="layui-inline timo-search-box">
+                    <label class="layui-form-label">应用名</label>
+                    <div class="layui-input-block">
+                        <input type="text" name="appName" th:value="${param.appName}" placeholder="请输入应用名"
+                               autocomplete="off" class="layui-input">
+                    </div>
+                </div>
+                <div class="layui-inline">
+                    <button class="layui-btn timo-search-btn">
+                        <i class="fa fa-search"></i>
+                    </button>
+                </div>
+            </div>
+        </div>
+        <div class="timo-table-wrap">
+            <table class="layui-table timo-table">
+                <thead>
+                <tr>
+                    <th class="timo-table-checkbox">
+                        <label class="timo-checkbox"><input type="checkbox">
+                            <i class="layui-icon layui-icon-ok"></i></label>
+                    </th>
+                    <th class="sortable" data-field="appName">应用</th>
+                    <th class="sortable" data-field="appType">类型</th>
+                    <th class="sortable" data-field="repoBranch">分支</th>
+                    <th class="sortable" data-field="httpPort">HTTP 端口</th>
+                    <th class="sortable" data-field="commitId">构建日志</th>
+                    <th class="sortable" data-field="commitTime">部署日志</th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr th:each="item:${list}">
+                    <td><label class="timo-checkbox"><input type="checkbox" th:value="${item.appId}">
+                        <i class="layui-icon layui-icon-ok"></i></label></td>
+                    <td>
+                        <a class="open-popup" data-title="应用配置详情" data-size="1200,500" href="#"
+                           th:text="${item.appName}" th:attr="data-url=@{'/app/config/app/detail/'+${item.appId}}"></a>
+                    </td>
+                    <td th:text="${item.appType}">类型</td>
+                    <td th:text="${item.repoBranch}">分支</td>
+                    <td th:text="${item.httpPort}">HTTP 端口</td>
+                    <td>
+                        <a class="open-popup" data-title="构建日志" th:attr="data-url=@{'/app/bd/log/build/'+${item.appId}}"
+                           data-size="max" href="#">查看</a>
+                    </td>
+                    <td>
+                        <a class="open-popup" data-title="部署日志" th:attr="data-url=@{'/app/bd/log/deploy/'+${item.appId}}"
+                           href="#">查看</a>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
+        </div>
+        <div th:replace="/common/fragment :: page"></div>
+    </div>
+</div>
+
+<script th:replace="/common/template :: script"></script>
+<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
+<script type="text/javascript">
+    function getPageByEnv() {
+        var selectedOption = $("#getPageByEnv option:selected")
+        var param = selectedOption.text()
+        url = '?env=' + param
+        window.location.href = window.location.pathname + url;
+    }
+
+    $(".build-result").each(function () {
+        var text = $(this).text().trim()
+        if (text === '成功') {
+            $(this).css("color", "#009688")
+        } else {
+            $(this).css("color", "#ff0000")
+        }
+    })
+</script>
+</body>
+</html>

+ 0 - 0
dmaster/src/main/resources/templates/app/bd/packscript.html → dmaster/src/main/resources/templates/app/bd/log/packscript.html


+ 0 - 0
dmaster/src/main/resources/templates/app/status/applog.html → dmaster/src/main/resources/templates/app/stat/applog.html


+ 0 - 0
dmaster/src/main/resources/templates/app/status/appstatus.html → dmaster/src/main/resources/templates/app/stat/index.html