|
|
@@ -1,6 +1,8 @@
|
|
|
package cn.reghao.bnt.web.devops.app.controller;
|
|
|
|
|
|
+import cn.reghao.bnt.web.devops.app.model.dto.AppDomainDto;
|
|
|
import cn.reghao.bnt.web.devops.app.model.vo.AppConfigDetail;
|
|
|
+import cn.reghao.bnt.web.devops.app.service.AppConfigService;
|
|
|
import cn.reghao.bnt.web.util.SelectOption;
|
|
|
import cn.reghao.bnt.web.devops.app.model.dto.AppConfigDto;
|
|
|
import cn.reghao.bnt.web.devops.app.model.dto.AppConfigUpdateDto;
|
|
|
@@ -24,9 +26,7 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -44,15 +44,18 @@ public class AppConfigController {
|
|
|
private final CompilerConfigRepository compilerConfigRepository;
|
|
|
private final PackerConfigRepository packerConfigRepository;
|
|
|
private final AppBuildService appBuildService;
|
|
|
+ private final AppConfigService appConfigService;
|
|
|
|
|
|
public AppConfigController(AppBuildQuery appBuildQuery, RepoAuthConfigRepository repoAuthConfigRepository,
|
|
|
CompilerConfigRepository compilerConfigRepository,
|
|
|
- PackerConfigRepository packerConfigRepository, AppBuildService appBuildService) {
|
|
|
+ PackerConfigRepository packerConfigRepository, AppBuildService appBuildService,
|
|
|
+ AppConfigService appConfigService) {
|
|
|
this.appBuildQuery = appBuildQuery;
|
|
|
this.repoAuthConfigRepository = repoAuthConfigRepository;
|
|
|
this.compilerConfigRepository = compilerConfigRepository;
|
|
|
this.packerConfigRepository = packerConfigRepository;
|
|
|
this.appBuildService = appBuildService;
|
|
|
+ this.appConfigService = appConfigService;
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "应用配置列表页面", description = "N")
|
|
|
@@ -106,11 +109,30 @@ public class AppConfigController {
|
|
|
return WebResult.success(new AppConfigDetail(app));
|
|
|
}
|
|
|
|
|
|
+ @Operation(summary = "添加应用绑定的域名", description = "N")
|
|
|
+ @PostMapping("/bind_domain/add")
|
|
|
+ public String addAppBindDomain(@RequestBody @Validated AppDomainDto appDomainDto) {
|
|
|
+ appConfigService.addAppDomain(appDomainDto);
|
|
|
+ return WebResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "删除应用绑定的域名", description = "N")
|
|
|
+ @PostMapping("/bind_domain/delete")
|
|
|
+ public String deleteAppBindDomain(@RequestBody @Validated AppDomainDto appDomainDto) {
|
|
|
+ appConfigService.deleteAppDomain(appDomainDto);
|
|
|
+ return WebResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
@Operation(summary = "应用绑定的域名", description = "N")
|
|
|
- @GetMapping("/bind_domain")
|
|
|
+ @GetMapping("/bind_domain/list")
|
|
|
public String getAppBindDomains(@RequestParam("appId") String appId) {
|
|
|
AppConfig app = appBuildQuery.getAppConfig(appId);
|
|
|
- return WebResult.success(app.getDomains());
|
|
|
+ List<String> domainList = new ArrayList<>();
|
|
|
+ if (app.getDomains() != null) {
|
|
|
+ domainList = Arrays.asList(app.getDomains().split(","));
|
|
|
+ }
|
|
|
+
|
|
|
+ return WebResult.success(domainList);
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "添加应用配置", description = "N")
|