|
|
@@ -1,16 +1,13 @@
|
|
|
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.db.query.config.*;
|
|
|
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.DeployConfig;
|
|
|
+import cn.reghao.autodop.dmaster.app.model.po.config.AppDeployConfig;
|
|
|
import cn.reghao.autodop.dmaster.machine.db.query.MachineHostQuery;
|
|
|
import cn.reghao.autodop.dmaster.notification.model.po.NotifyGroup;
|
|
|
import cn.reghao.autodop.dmaster.notification.model.po.NotifyType;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.query.config.AppConfigQuery;
|
|
|
-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.po.config.AppConfig;
|
|
|
import cn.reghao.autodop.dmaster.app.model.vo.KeyValue;
|
|
|
import cn.reghao.autodop.dmaster.notification.db.repository.NotifyGroupRepository;
|
|
|
@@ -44,16 +41,19 @@ public class AppConfigPageController {
|
|
|
private final PackerConfigQuery packerConfigQuery;
|
|
|
private final MachineHostQuery hostQuery;
|
|
|
private final NotifyGroupRepository receiverRepository;
|
|
|
+ private final AppDeployConfigQuery deployConfigQuery;
|
|
|
|
|
|
public AppConfigPageController(AppConfigQuery appConfigQuery, RepoAuthConfigQuery repoAuthConfigQuery,
|
|
|
- CompilerConfigQuery compilerConfigQuery, PackerConfigQuery packerConfigQuery, MachineHostQuery hostQuery,
|
|
|
- NotifyGroupRepository receiverRepository) {
|
|
|
+ CompilerConfigQuery compilerConfigQuery, PackerConfigQuery packerConfigQuery,
|
|
|
+ MachineHostQuery hostQuery, NotifyGroupRepository receiverRepository,
|
|
|
+ AppDeployConfigQuery deployConfigQuery) {
|
|
|
this.appConfigQuery = appConfigQuery;
|
|
|
this.repoAuthConfigQuery = repoAuthConfigQuery;
|
|
|
this.compilerConfigQuery = compilerConfigQuery;
|
|
|
this.packerConfigQuery = packerConfigQuery;
|
|
|
this.hostQuery = hostQuery;
|
|
|
this.receiverRepository = receiverRepository;
|
|
|
+ this.deployConfigQuery = deployConfigQuery;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "应用配置页面")
|
|
|
@@ -186,14 +186,22 @@ public class AppConfigPageController {
|
|
|
|
|
|
@ApiOperation(value = "部署配置页面")
|
|
|
@GetMapping("/deploy/{id}")
|
|
|
- public String deployConfigPage(@PathVariable("id") AppConfig app, Model model) {
|
|
|
+ public String deployConfigIndexPage(@PathVariable("id") AppConfig app, Model model) {
|
|
|
+ PageRequest pageRequest = PageSort.pageRequest();
|
|
|
+ Page<AppDeployConfig> deployConfigPage = deployConfigQuery.findByAppId(app.getAppId(), pageRequest);
|
|
|
+ PageList<AppDeployConfig> pageList = PageList.pageList(deployConfigPage);
|
|
|
+
|
|
|
+ model.addAttribute("page", deployConfigPage);
|
|
|
+ model.addAttribute("list", pageList.getList());
|
|
|
+ return "/app/config/app/deployconfig";
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "部署配置页面")
|
|
|
+ @GetMapping("/deploy1/{id}")
|
|
|
+ public String deployConfigPage1(@PathVariable("id") AppConfig app, Model model) {
|
|
|
int id = app.getId();
|
|
|
String packType = app.getPackerConfig().getType();
|
|
|
- List<DeployConfig> list = app.getDeployConfigs();
|
|
|
- if (list == null) {
|
|
|
- list = Collections.emptyList();
|
|
|
- }
|
|
|
-
|
|
|
+ List<AppDeployConfig> list = deployConfigQuery.findByAppId(app.getAppId());
|
|
|
String env = app.getEnv();
|
|
|
List<KeyValue> machines = hostQuery.findByEnv(env).stream()
|
|
|
.map(machineHost -> {
|
|
|
@@ -207,6 +215,6 @@ public class AppConfigPageController {
|
|
|
model.addAttribute("packType", packType);
|
|
|
model.addAttribute("machines", machines);
|
|
|
model.addAttribute("list", list);
|
|
|
- return "/app/config/app/deploy";
|
|
|
+ return "/app/config/app/deployconfig1";
|
|
|
}
|
|
|
}
|