Search in sources :

Example 21 with SuccessResponseEntity

use of com.vip.saturn.job.console.controller.SuccessResponseEntity in project Saturn by vipshop.

the class DashboardController method top10FailJob.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10FailJob")
public SuccessResponseEntity top10FailJob(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.top10FailureJob(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.top10FailureJobByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 22 with SuccessResponseEntity

use of com.vip.saturn.job.console.controller.SuccessResponseEntity in project Saturn by vipshop.

the class DashboardController method top10FailDomain.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping(value = "/top10FailDomain")
public SuccessResponseEntity top10FailDomain(@RequestParam(required = false) String zkClusterKey) throws SaturnJobConsoleException {
    if (StringUtils.isNotBlank(zkClusterKey)) {
        ZkCluster zkCluster = checkAndGetZkCluster(zkClusterKey);
        SaturnStatistics ss = dashboardService.top10FailureDomain(zkCluster.getZkAddr());
        return ss == null ? new SuccessResponseEntity() : new SuccessResponseEntity(ss.getResult());
    }
    return new SuccessResponseEntity(dashboardService.top10FailureDomainByAllZkCluster());
}
Also used : SaturnStatistics(com.vip.saturn.job.console.mybatis.entity.SaturnStatistics) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) ZkCluster(com.vip.saturn.job.console.domain.ZkCluster) ApiResponses(io.swagger.annotations.ApiResponses)

Example 23 with SuccessResponseEntity

use of com.vip.saturn.job.console.controller.SuccessResponseEntity in project Saturn by vipshop.

the class AuthorizationController method getLoginUser.

@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@GetMapping("/loginUser")
public SuccessResponseEntity getLoginUser(HttpSession httpSession) throws SaturnJobConsoleException {
    String currentLoginUserName = getCurrentLoginUserName();
    User user = authorizationService.getUser(currentLoginUserName);
    return new SuccessResponseEntity(user);
}
Also used : User(com.vip.saturn.job.console.mybatis.entity.User) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiResponses(io.swagger.annotations.ApiResponses)

Example 24 with SuccessResponseEntity

use of com.vip.saturn.job.console.controller.SuccessResponseEntity in project Saturn by vipshop.

the class ConsoleConfigController method createConfig.

/**
 * 创建配置项。
 *
 * @param key 配置key
 * @param value 配置值
 */
@ApiResponses(value = { @ApiResponse(code = 200, message = "Success/Fail", response = RequestResult.class) })
@Audit
@PostMapping("/create")
public SuccessResponseEntity createConfig(@AuditParam(value = "key") @RequestParam String key, @AuditParam(value = "value") @RequestParam String value) throws SaturnJobConsoleException {
    assertIsPermitted(PermissionKeys.systemConfig);
    // 不能更新EXECUTOR_CONFIGS
    if (SystemConfigProperties.EXECUTOR_CONFIGS.equals(key)) {
        throw new SaturnJobConsoleException(String.format("配置项不能为%s", key));
    }
    SystemConfig systemConfig = new SystemConfig();
    systemConfig.setProperty(key);
    systemConfig.setValue(value);
    systemConfigService.createConfig(systemConfig);
    return new SuccessResponseEntity();
}
Also used : SystemConfig(com.vip.saturn.job.console.mybatis.entity.SystemConfig) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) SuccessResponseEntity(com.vip.saturn.job.console.controller.SuccessResponseEntity) Audit(com.vip.saturn.job.console.aop.annotation.Audit) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

SuccessResponseEntity (com.vip.saturn.job.console.controller.SuccessResponseEntity)24 ApiResponses (io.swagger.annotations.ApiResponses)23 ZkCluster (com.vip.saturn.job.console.domain.ZkCluster)11 Audit (com.vip.saturn.job.console.aop.annotation.Audit)10 PostMapping (org.springframework.web.bind.annotation.PostMapping)10 SaturnStatistics (com.vip.saturn.job.console.mybatis.entity.SaturnStatistics)8 UserRole (com.vip.saturn.job.console.mybatis.entity.UserRole)6 SystemConfig (com.vip.saturn.job.console.mybatis.entity.SystemConfig)4 Date (java.util.Date)4 SaturnJobConsoleException (com.vip.saturn.job.console.exception.SaturnJobConsoleException)3 User (com.vip.saturn.job.console.mybatis.entity.User)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 JSONObject (com.alibaba.fastjson.JSONObject)2 ContainerConfig (com.vip.saturn.job.console.domain.container.ContainerConfig)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1