Ver Fonte

删除 webssh 相关接口

reghao há 6 meses atrás
pai
commit
f556ef884a

+ 0 - 10
mgr/src/main/java/cn/reghao/devops/mgr/machine/controller/MachineHostController.java

@@ -4,7 +4,6 @@ import cn.reghao.devops.mgr.machine.db.query.MachineQuery;
 import cn.reghao.devops.mgr.machine.service.MachineService;
 import cn.reghao.jutil.jdk.result.Result;
 import cn.reghao.jutil.jdk.result.WebResult;
-import cn.reghao.devops.mgr.machine.model.po.SshAuth;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +12,6 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -42,14 +40,6 @@ public class MachineHostController {
         return ResponseEntity.ok().body(WebResult.success());
     }
 
-    @ApiOperation(value = "编辑 SSH 认证信息", notes = "N")
-    @PreAuthorize("hasRole('ROLE_ADMIN')")
-    @PostMapping(value = "/sshauth/{machineId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public ResponseEntity<String> editSshAuth(@PathVariable("machineId") String machineId, @Valid SshAuth sshAuth) {
-        machineService.setMachineSshAuth(machineId, sshAuth);
-        return ResponseEntity.ok().body(WebResult.success());
-    }
-
     @ApiOperation(value = "删除机器", notes = "N")
     @PreAuthorize("hasRole('ROLE_ADMIN')")
     @DeleteMapping(value = "/{machineId}", produces = MediaType.APPLICATION_JSON_VALUE)

+ 1 - 52
mgr/src/main/java/cn/reghao/devops/mgr/machine/controller/page/MachineHostPageController.java → mgr/src/main/java/cn/reghao/devops/mgr/machine/controller/MachineHostPageController.java

@@ -1,4 +1,4 @@
-package cn.reghao.devops.mgr.machine.controller.page;
+package cn.reghao.devops.mgr.machine.controller;
 
 import cn.reghao.devops.common.util.KeyValue;
 import cn.reghao.devops.mgr.machine.db.query.MachineQuery;
@@ -6,13 +6,9 @@ import cn.reghao.devops.mgr.machine.model.po.MachineInfo;
 import cn.reghao.devops.mgr.util.DefaultSetting;
 import cn.reghao.devops.mgr.util.PageSort;
 import cn.reghao.devops.mgr.builder.model.constant.EnvType;
-import cn.reghao.devops.mgr.machine.model.SshConnData;
 import cn.reghao.devops.mgr.machine.model.po.MachineHost;
-import cn.reghao.devops.mgr.machine.model.po.SshAuth;
 import cn.reghao.devops.mgr.machine.model.vo.MachineHostVO;
 import cn.reghao.devops.mgr.machine.model.vo.MachineInfoVO;
-import cn.reghao.devops.mgr.machine.model.vo.MachineSshAuth;
-import cn.reghao.devops.mgr.machine.util.Keys;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -27,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * @author reghao
@@ -94,52 +89,6 @@ public class MachineHostPageController {
         return "/devops/machine/host/env";
     }
 
-    @ApiOperation(value = "SSH 认证设置页面", notes = "N")
-    @PreAuthorize("hasRole('ROLE_ADMIN')")
-    @GetMapping("/sshauth/{machineId}")
-    public String sshAuthPage(@PathVariable("machineId") String machineId, Model model) {
-        MachineSshAuth machineSshAuth = machineQuery.getMachineSshAuth(machineId);
-        List<KeyValue> ipv4List = machineSshAuth.getIpv4List().stream()
-                .map(ipv4 -> new KeyValue(ipv4, ipv4)).collect(Collectors.toList());
-
-        String machineIpv4;
-        SshAuth sshAuth = machineSshAuth.getSshAuth();
-        if (sshAuth != null) {
-            machineIpv4 = sshAuth.getIpv4();
-        } else {
-            machineIpv4 = ipv4List.get(0).getValue();
-        }
-
-        model.addAttribute("machineId", machineId);
-        model.addAttribute("machineIpv4", machineIpv4);
-        model.addAttribute("ipv4List", ipv4List);
-        model.addAttribute("sshAuth", machineSshAuth.getSshAuth());
-        return "/devops/machine/host/sshauth";
-    }
-
-    @ApiOperation(value = "SSH 控制台页面", notes = "N")
-    @PreAuthorize("hasRole('ROLE_ADMIN')")
-    @GetMapping("/webssh/{machineId}")
-    public String webSshPage(@PathVariable("machineId") String machineId, Model model) {
-        MachineHost machineHost = machineQuery.getMachineHost(machineId);
-        SshAuth sshAuth = machineHost.getSshAuth();
-        if (sshAuth == null) {
-            String errMsg = "先设置 SSH 认证";
-            model.addAttribute("errMsg", errMsg);
-            return "/error";
-        }
-
-        SshConnData sshConnData = new SshConnData();
-        sshConnData.setOps(Keys.OPS_CONNECT);
-        sshConnData.setHost(sshAuth.getIpv4());
-        sshConnData.setPort(sshAuth.getPort());
-        sshConnData.setUsername(sshAuth.getUsername());
-        sshConnData.setPassword(sshAuth.getPassword());
-
-        model.addAttribute("sshConnData", sshConnData);
-        return "/devops/machine/host/webssh";
-    }
-
     @ApiOperation(value = "机器信息详情页面", notes = "N")
     @PreAuthorize("hasRole('ROLE_ADMIN')")
     @GetMapping("/detail/{machineId}")

+ 0 - 9
mgr/src/main/resources/templates/devops/machine/host/index.html

@@ -62,7 +62,6 @@
                     <th data-field="agentVersion">Agent 版本</th>
                     <th data-field="used">使用量</th>
                     <th>所属环境</th>
-                    <th>SSH 认证</th>
                     <th>操作</th>
                 </tr>
                 </thead>
@@ -87,14 +86,6 @@
                            th:attr="data-url=@{'/machine/host/env/'+${item.machineId}}" href="#">设置</a>
                     </td>
                     <td>
-                        <a class="open-popup" data-title="设置 SSH 帐号"
-                           th:attr="data-url=@{'/machine/host/sshauth/'+${item.machineId}}" href="#">设置</a>
-                    </td>
-                    <td>
-                        <!--<a class="open-popup" data-title="机器管理" th:attr="data-url=@{'/machine/stat'}"
-                           data-size="max" href="#">管理</a>-->
-                        <a class="open-popup" data-title="WebTerminal" th:attr="data-url=@{'/machine/host/webssh/'+${item.machineId}}"
-                           data-size="max">SSH</a>
                         <a class="open-popup" data-title="机器详细信息" th:attr="data-url=@{'/machine/host/detail/'+${item.machineId}}"
                            data-size="960,480" href="#">详细</a>
                         <a class="ajax-delete" th:attr="data-msg='确定要删除 '+ ${item.machineId} + ' 机器?'"