add labels
This commit is contained in:
parent
1acee2b5b6
commit
6dba5cdd65
|
|
@ -160,4 +160,20 @@ public class AgentController : ControllerBase
|
|||
}
|
||||
return utilities.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderBy(x => x.Name).ToList();
|
||||
}
|
||||
|
||||
[HttpGet("/agent/labels")]
|
||||
public async Task<IEnumerable<string>> GetAgentLabels()
|
||||
{
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var agents = await agentService.GetAgents(new AgentFilter
|
||||
{
|
||||
Pager = new Pagination { Size = 1000 }
|
||||
});
|
||||
|
||||
var labels = agents.Items?.SelectMany(x => x.Labels)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList() ?? [];
|
||||
return labels;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue