|
|
@@ -2,19 +2,23 @@ package cn.reghao.devops.mgr.app.controller.page;
|
|
|
|
|
|
import cn.reghao.devops.mgr.app.db.query.AppBuildQuery;
|
|
|
import cn.reghao.devops.mgr.app.db.query.AppDeployQuery;
|
|
|
+import cn.reghao.devops.mgr.app.model.dto.DeployConfigDto;
|
|
|
import cn.reghao.devops.mgr.app.model.po.config.AppConfig;
|
|
|
import cn.reghao.devops.mgr.app.model.po.config.AppDeployConfig;
|
|
|
import cn.reghao.devops.mgr.app.model.vo.AppDeployConfigVO;
|
|
|
import cn.reghao.devops.common.util.KeyValue;
|
|
|
+import cn.reghao.devops.mgr.app.service.AppDeployService;
|
|
|
import cn.reghao.devops.mgr.machine.service.MachineQuery;
|
|
|
+import cn.reghao.jutil.jdk.result.Result;
|
|
|
+import cn.reghao.jutil.web.WebResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
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.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -31,12 +35,14 @@ public class AppDeployConfigPageController {
|
|
|
private final AppDeployQuery appDeployQuery;
|
|
|
private final AppBuildQuery appBuildQuery;
|
|
|
private final MachineQuery machineQuery;
|
|
|
+ private final AppDeployService appDeployService;
|
|
|
|
|
|
public AppDeployConfigPageController(AppDeployQuery appDeployQuery, AppBuildQuery appBuildQuery,
|
|
|
- MachineQuery machineQuery) {
|
|
|
+ MachineQuery machineQuery, AppDeployService appDeployService) {
|
|
|
this.appDeployQuery = appDeployQuery;
|
|
|
this.appBuildQuery = appBuildQuery;
|
|
|
this.machineQuery = machineQuery;
|
|
|
+ this.appDeployService = appDeployService;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "部署配置列表页面", notes = "N")
|
|
|
@@ -73,12 +79,27 @@ public class AppDeployConfigPageController {
|
|
|
return "/devops/app/deploy/edit";
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "部署配置详情页面", notes = "N")
|
|
|
- @GetMapping("/detail/{appId}/{machineId}")
|
|
|
- public String appConfigPage(@PathVariable("appId") String appId, @PathVariable("machineId") String machineId,
|
|
|
- Model model) {
|
|
|
- AppDeployConfig appDeployConfig = appDeployQuery.getByAppIdAndMachineId(appId, machineId);
|
|
|
- model.addAttribute("deployConfigVO", new AppDeployConfigVO(appDeployConfig));
|
|
|
- return "/devops/app/deploy/detail";
|
|
|
+ @ApiOperation(value = "添加应用部署配置", notes = "N")
|
|
|
+ @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ResponseBody
|
|
|
+ public String add(@Validated DeployConfigDto deployConfigDto) {
|
|
|
+ Result result = appDeployService.addDeployConfig(deployConfigDto);
|
|
|
+ return WebResult.result(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改应用部署配置", notes = "N")
|
|
|
+ @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ResponseBody
|
|
|
+ public String update(@Validated DeployConfigDto deployConfigDto) {
|
|
|
+ Result result = appDeployService.updateStartScript(deployConfigDto);
|
|
|
+ return WebResult.result(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除应用部署配置", notes = "N")
|
|
|
+ @DeleteMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @ResponseBody
|
|
|
+ public String delete(@PathVariable("id") Integer appDeployConfigId) {
|
|
|
+ Result result = appDeployService.deleteDeployConfig(appDeployConfigId);
|
|
|
+ return WebResult.result(result);
|
|
|
}
|
|
|
}
|