Exemplo n.º 1
0
 @RequestMapping(value = "script", method = RequestMethod.GET)
 @ResponseStatus(HttpStatus.OK)
 @ResponseBody
 public Response getScript(
     @RequestParam(defaultValue = "") String clusterName,
     @RequestParam(defaultValue = "") String identifier,
     @RequestParam(defaultValue = "") String taskId) {
   Response response = new Response();
   EngineService engineService = getEngineService(clusterName);
   TaskHistoryRemoteService taskHistoryRemoteService = engineService.getTaskHistoryRemoteService();
   String script = taskHistoryRemoteService.getScript(identifier, taskId);
   response.setObject(script);
   response.setSuccess(true);
   return response;
 }
Exemplo n.º 2
0
  @RequestMapping(value = "logs", method = RequestMethod.GET)
  @ResponseStatus(HttpStatus.OK)
  @ResponseBody
  public Response getLogs(
      @RequestParam(defaultValue = "") String clusterName,
      @RequestParam(defaultValue = "") String identifier,
      @RequestParam(defaultValue = "") String taskId,
      @RequestParam(defaultValue = "") String tabConditionKey) {
    Response response = new Response();
    EngineService engineService = getEngineService(clusterName);
    TaskHistoryRemoteService taskHistoryRemoteService = engineService.getTaskHistoryRemoteService();

    String log;
    String script;
    String command;
    String error;
    Map<String, Object> map = new HashMap<>();

    switch (tabConditionKey) {
      case "log":
        log = taskHistoryRemoteService.getTaskLog(identifier, taskId);
        map.put("log", log);
        break;
      case "script":
        script = taskHistoryRemoteService.getScript(identifier, taskId);
        map.put("script", script);
        break;
      case "command":
        command = taskHistoryRemoteService.getCommand(identifier, taskId);
        map.put("command", command);
        break;
      case "error":
        error = taskHistoryRemoteService.getError(identifier, taskId);
        map.put("error", error);
        break;
    }

    response.getMap().putAll(map);
    response.setSuccess(true);
    return response;
  }