|
@@ -1,129 +0,0 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.controller.page;
|
|
|
|
|
-
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.db.query.config.ProjConfigQuery;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.db.query.config.CompilerConfigQuery;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.db.query.config.PackerConfigQuery;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.db.query.config.RepoAuthConfigQuery;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.model.constant.AppType;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.model.constant.EnvList;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.config.ProjConfig;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app.model.vo.KeyValue;
|
|
|
|
|
-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;
|
|
|
|
|
-
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * @author reghao
|
|
|
|
|
- * @date 2021-09-17 10:17:15
|
|
|
|
|
- */
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@Api(tags = "项目配置页面")
|
|
|
|
|
-@Controller
|
|
|
|
|
-@RequestMapping("/app/config/proj")
|
|
|
|
|
-public class ProjConfigPageController {
|
|
|
|
|
- private final ProjConfigQuery projConfigQuery;
|
|
|
|
|
- private final RepoAuthConfigQuery repoAuthConfigQuery;
|
|
|
|
|
- private final CompilerConfigQuery compilerConfigQuery;
|
|
|
|
|
- private final PackerConfigQuery packerConfigQuery;
|
|
|
|
|
-
|
|
|
|
|
- public ProjConfigPageController(ProjConfigQuery projConfigQuery, RepoAuthConfigQuery repoAuthConfigQuery,
|
|
|
|
|
- CompilerConfigQuery compilerConfigQuery, PackerConfigQuery packerConfigQuery) {
|
|
|
|
|
- this.projConfigQuery = projConfigQuery;
|
|
|
|
|
- this.repoAuthConfigQuery = repoAuthConfigQuery;
|
|
|
|
|
- this.compilerConfigQuery = compilerConfigQuery;
|
|
|
|
|
- this.packerConfigQuery = packerConfigQuery;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private void setCommon(Model model) {
|
|
|
|
|
- List<KeyValue> envs = new ArrayList<>();
|
|
|
|
|
- for (EnvList envList : EnvList.values()) {
|
|
|
|
|
- envs.add(new KeyValue(envList.name(), envList.name()));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- List<KeyValue> appTypes = new ArrayList<>();
|
|
|
|
|
- for (AppType appType : AppType.values()) {
|
|
|
|
|
- appTypes.add(new KeyValue(appType.name(), appType.name()));
|
|
|
|
|
- }
|
|
|
|
|
- model.addAttribute("environments", envs);
|
|
|
|
|
- model.addAttribute("appTypes", appTypes);
|
|
|
|
|
-
|
|
|
|
|
- List<KeyValue> repoAuths = repoAuthConfigQuery.findAll().stream()
|
|
|
|
|
- .map(repoAuthConfig -> new KeyValue(String.valueOf(repoAuthConfig.getName()), repoAuthConfig.getName()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- List<KeyValue> compilers = compilerConfigQuery.findAllByIsDeleteFalse().stream()
|
|
|
|
|
- .map(compilerConfig -> new KeyValue(String.valueOf(compilerConfig.getName()), compilerConfig.getName()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
- List<KeyValue> packers = packerConfigQuery.findAllByIsDeleteFalse().stream()
|
|
|
|
|
- .map(packerConfig -> new KeyValue(String.valueOf(packerConfig.getName()), packerConfig.getName()))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- model.addAttribute("repoAuths", repoAuths);
|
|
|
|
|
- model.addAttribute("compilers", compilers);
|
|
|
|
|
- model.addAttribute("packers", packers);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @ApiOperation(value = "项目配置页面")
|
|
|
|
|
- @GetMapping
|
|
|
|
|
- public String projConfigPage(@RequestParam(value = "projName", required = false) String projName, Model model) {
|
|
|
|
|
-
|
|
|
|
|
- /*if (projName != null) {
|
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
|
- map.put("projName", projName);
|
|
|
|
|
- List<AppOrchestration> list = appConfigQuery.query(map);
|
|
|
|
|
- Page<AppOrchestration> page = new PageImpl<>(list);
|
|
|
|
|
- PageList<AppOrchestration> pageList = PageList.pageList(page);
|
|
|
|
|
-
|
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
|
- model.addAttribute("list", pageList.getList());
|
|
|
|
|
- return "/app/config/app/index";
|
|
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
- PageRequest pageRequest = PageSort.pageRequest();
|
|
|
|
|
- Page<ProjConfig> page = projConfigQuery.findByIsDeleteFalse(pageRequest);
|
|
|
|
|
- PageList<ProjConfig> pageList = PageList.pageList(page);
|
|
|
|
|
-
|
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
|
- model.addAttribute("list", pageList.getList());
|
|
|
|
|
- return "/app/config/proj/index";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/add")
|
|
|
|
|
- public String addProjConfigPage(Model model) {
|
|
|
|
|
- setCommon(model);
|
|
|
|
|
- return "/app/config/proj/add";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/edit/{id}")
|
|
|
|
|
- public String editProjConfigPage(@PathVariable("id") ProjConfig proj, Model model) {
|
|
|
|
|
- setCommon(model);
|
|
|
|
|
- model.addAttribute("proj", proj);
|
|
|
|
|
- return "/app/config/proj/add";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/copy/{id}")
|
|
|
|
|
- public String copyProjConfigPage(@PathVariable("id") ProjConfig proj, Model model) {
|
|
|
|
|
- model.addAttribute("proj", proj);
|
|
|
|
|
- return "/app/config/proj/copy";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/detail/{projId}")
|
|
|
|
|
- public String projConfigDetailPage(@PathVariable("projId") String projId, Model model) {
|
|
|
|
|
- ProjConfig proj = projConfigQuery.findByIsDeleteFalseAndProjId(projId);
|
|
|
|
|
- model.addAttribute("proj", proj);
|
|
|
|
|
- return "/app/config/proj/detail";
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|