Search in sources :

Example 6 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class CreateDeploymentController method queryModuleServer.

/**
 * 查询模块在某个环境的服务器列表
 *
 * @param moduleId 模块ID
 * @param envId    环境ID,必定大于0
 * @return
 */
@RequestMapping("queryModuleServer")
@ResponseBody
@MenuResource("查询模块服务器列表")
public RestResult<Map<String, Object>> queryModuleServer(int moduleId, int envId) {
    Assert.isTrue(moduleId > 0);
    Assert.isTrue(envId > 0);
    List<ServerGroup> groups = serverGroupService.getByModuleAndEnv(moduleId, envId);
    List<Integer> groupIds = new ArrayList<>(groups.size());
    for (ServerGroup group : groups) {
        groupIds.add(group.getGroupId());
    }
    List<Server> servers = serverService.getByGroupIds(groupIds);
    Map<String, Object> result = new HashMap<>(4);
    result.put("servers", servers);
    result.put("groups", groups);
    return new RestResult<>(result);
}
Also used : ServerGroup(com.ibeiliao.deployment.admin.vo.server.ServerGroup) RestResult(com.ibeiliao.deployment.admin.common.RestResult) Server(com.ibeiliao.deployment.admin.vo.server.Server) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class DeployController method index.

/**
 * 发布中主页,xhtml 仅用于展示页面,ajax 调用 .do 接口获取参数
 * @return
 */
@MenuResource("发布主页")
@RequestMapping("deploy.xhtml")
public String index(HttpServletRequest request) throws Exception {
    Integer historyId = ServletRequestUtils.getIntParameter(request, "historyId");
    if (historyId != null) {
        DeployHistory history = deployHistoryService.getByHistoryId(historyId);
        request.setAttribute("history", history);
        request.setAttribute("canDeploy", AdminContext.getAccountId() == history.getAccountId() && history.getDeployStatus() == DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
    }
    return ("/deploy/deploy");
}
Also used : DeployHistory(com.ibeiliao.deployment.admin.vo.deploy.DeployHistory) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class EditAccountController method getAdmin.

/**
 * 读取管理员信息
 * @param uid 管理员ID
 * @return 返回管理员信息
 */
@RequestMapping("getAdmin")
@MenuResource("读取管理员信息")
@ResponseBody
public RestResult<AdminAccount> getAdmin(long uid) {
    AdminAccount account = adminAccountService.getById(uid);
    RestResult<AdminAccount> result;
    if (account == null) {
        result = new RestResult<>(ApiCode.FAILURE, "管理员不存在:uid=" + uid);
    } else {
        List<AccountRoleRelation> list = adminAccountService.listAccountRoles(uid);
        if (list.size() == 1) {
            account.setRoleId(list.get(0).getRoleId());
        }
        account.setPassword(aesPropertiesEncoder.decode(account.getPassword()));
        result = new RestResult<>(account);
    }
    return result;
}
Also used : AccountRoleRelation(com.ibeiliao.deployment.admin.vo.account.AccountRoleRelation) AdminAccount(com.ibeiliao.deployment.admin.vo.account.AdminAccount) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class ViewProjectController method stopServer.

/**
 * 停止服务
 */
@RequestMapping("stopServer.do")
@ResponseBody
@MenuResource("停止服务")
public RestResult<Object> stopServer(int serverId) {
    TransferRequest request;
    try {
        request = createTransferRequest(serverId, false);
        Assert.isTrue(request.getModuleType() != ModuleType.STATIC.getValue(), "静态项目不能stop");
        JavaTransferService javaTransferService = new JavaTransferService(request, DeployType.STOP);
        return transfer(request.getHistoryId(), javaTransferService);
    } catch (Exception e) {
        logger.info("停止失败,{}", e);
        return new RestResult<>(ApiCode.FAILURE, "停止失败");
    }
}
Also used : TransferRequest(com.ibeiliao.deployment.transfer.vo.TransferRequest) JavaTransferService(com.ibeiliao.deployment.transfer.service.JavaTransferService) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 10 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class ViewProjectController method getProject.

/**
 * 获取项目
 */
@RequestMapping("getProject")
@ResponseBody
@MenuResource("获取项目")
public RestResult getProject(int projectId) {
    Project project = new Project();
    if (projectId > 0) {
        project = projectService.getProject(projectId);
    }
    List<AdminAccount> adminAccounts = adminAccountService.listAll();
    GlobalSetting globalSetting = globalSettingService.getGlobalSetting();
    ProjectDetailInfo projectDetailInfo = new ProjectDetailInfo();
    projectDetailInfo.setProject(project);
    projectDetailInfo.setAllAccounts(adminAccounts);
    projectDetailInfo.setGlobalSetting(globalSetting);
    List<ProjectAccountRelation> accountRelations = projectAccountRelationService.getByProjectId(projectId);
    projectDetailInfo.setProjectAccountRelations(accountRelations);
    return new RestResult<>(projectDetailInfo);
}
Also used : RestResult(com.ibeiliao.deployment.admin.common.RestResult) GlobalSetting(com.ibeiliao.deployment.admin.vo.global.GlobalSetting) AdminAccount(com.ibeiliao.deployment.admin.vo.account.AdminAccount) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)17 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)14 RestResult (com.ibeiliao.deployment.admin.common.RestResult)8 AdminAccount (com.ibeiliao.deployment.admin.vo.account.AdminAccount)5 Role (com.ibeiliao.deployment.admin.vo.account.Role)3 AdminLog (com.ibeiliao.deployment.admin.annotation.log.AdminLog)2 AccountRoleRelation (com.ibeiliao.deployment.admin.vo.account.AccountRoleRelation)2 DeployHistory (com.ibeiliao.deployment.admin.vo.deploy.DeployHistory)2 GlobalSetting (com.ibeiliao.deployment.admin.vo.global.GlobalSetting)2 ProjectEnv (com.ibeiliao.deployment.admin.vo.global.ProjectEnv)2 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)2 JavaTransferService (com.ibeiliao.deployment.transfer.service.JavaTransferService)2 TransferRequest (com.ibeiliao.deployment.transfer.vo.TransferRequest)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AllowAnonymous (com.ibeiliao.deployment.admin.annotation.authority.AllowAnonymous)1 PageResult (com.ibeiliao.deployment.admin.common.PageResult)1 AdminLoginUser (com.ibeiliao.deployment.admin.context.AdminLoginUser)1