Skip to content

Commit

Permalink
[#9317] Change api url
Browse files Browse the repository at this point in the history
  • Loading branch information
intr3p1d committed Nov 11, 2022
1 parent e421457 commit 358807e
Showing 1 changed file with 11 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ public AgentListController(AgentInfoService agentInfoService) {
this.agentInfoService = Objects.requireNonNull(agentInfoService, "agentInfoService");
}

@GetMapping(value = "/all")
@GetMapping()
public TreeView<InstancesList<AgentAndStatus>> getAllAgentsList() {
long timestamp = System.currentTimeMillis();
return getAllAgentsList(timestamp);
AgentsMapByApplication allAgentsList = this.agentInfoService.getAllAgentsList(AgentInfoFilter::accept, timestamp);
return treeView(allAgentsList);
}

@GetMapping(value = "/all", params = {"from", "to"})
@GetMapping(params = {"from", "to"})
public TreeView<InstancesList<AgentAndStatus>> getAllAgentsList(
@RequestParam("from") long from,
@RequestParam("to") long to) {
Expand All @@ -48,28 +49,25 @@ public TreeView<InstancesList<AgentAndStatus>> getAllAgentsList(
return treeView(allAgentsList);
}

@GetMapping(value = "/all", params = {"timestamp"})
public TreeView<InstancesList<AgentAndStatus>> getAllAgentsList(
@RequestParam("timestamp") long timestamp) {
AgentsMapByApplication allAgentsList = this.agentInfoService.getAllAgentsList(AgentInfoFilter::accept, timestamp);
return treeView(allAgentsList);
}

private static TreeView<InstancesList<AgentAndStatus>> treeView(AgentsMapByApplication agentsListsList) {
List<InstancesList<AgentAndStatus>> list = agentsListsList.getAgentsListsList();
return new StaticTreeView<>(list);
}


@GetMapping(value = "/v1", params = {"application", "sortBy"})
@GetMapping(params = {"application", "sortBy"})
public TreeView<InstancesList<AgentStatusAndLink>> getAgentsList(
@RequestParam("application") String applicationName,
@RequestParam("sortBy") SortByAgentInfo.Rules sortBy) {
long timestamp = System.currentTimeMillis();
return getAgentsList(applicationName, timestamp, sortBy);
AgentInfoFilter runningAgentFilter = new AgentInfoFilterChain(
AgentInfoFilter::filterRunning
);
AgentsMapByHost list = this.agentInfoService.getAgentsListByApplicationName(runningAgentFilter, applicationName, timestamp, sortBy);
return treeView(list);
}

@GetMapping(value = "/v1", params = {"application", "from", "to", "sortBy"})
@GetMapping(params = {"application", "from", "to", "sortBy"})
public TreeView<InstancesList<AgentStatusAndLink>> getAgentsList(
@RequestParam("application") String applicationName,
@RequestParam("from") long from,
Expand All @@ -83,18 +81,6 @@ public TreeView<InstancesList<AgentStatusAndLink>> getAgentsList(
return treeView(list);
}

@GetMapping(value = "/v1", params = {"application", "timestamp", "sortBy"})
public TreeView<InstancesList<AgentStatusAndLink>> getAgentsList(
@RequestParam("application") String applicationName,
@RequestParam("timestamp") long timestamp,
@RequestParam("sortBy") SortByAgentInfo.Rules sortBy) {
AgentInfoFilter runningAgentFilter = new AgentInfoFilterChain(
AgentInfoFilter::filterRunning
);
AgentsMapByHost list = this.agentInfoService.getAgentsListByApplicationName(runningAgentFilter, applicationName, timestamp, sortBy);
return treeView(list);
}

private static TreeView<InstancesList<AgentStatusAndLink>> treeView(AgentsMapByHost agentsMapByHost) {
List<InstancesList<AgentStatusAndLink>> list = agentsMapByHost.getAgentsListsList();
return new StaticTreeView<>(list);
Expand Down

0 comments on commit 358807e

Please sign in to comment.