simplified dashboard

This commit is contained in:
Arthur Wambst 2025-08-22 08:24:53 +02:00
parent fb80b381f6
commit de92fbe778
No known key found for this signature in database

View File

@ -15,26 +15,19 @@ import jakarta.ws.rs.core.Response;
@Path("api")
public class Endpoints {
@Inject
SecurityIdentity identity;
@Inject SecurityIdentity identity;
@Inject
InstanceService instanceService;
@Inject InstanceService instanceService;
@Inject
SujetService sujetService;
@Inject SujetService sujetService;
@GET
@Path("dashboard")
public Response getDashboard() {
String username = identity.getPrincipal().getName();
DashboardResponse dashboard = new DashboardResponse();
if (identity.getRoles().contains("root")) {
dashboard.tps = sujetService.getAllSujetsAdmin();
} else {
dashboard.tps = sujetService.getAllSujetsRespo(identity.getPrincipal().getName());
}
dashboard.tps =
sujetService.getAllSujetsRespo(identity.getPrincipal().getName());
dashboard.instances = instanceService.getAllInstances(username);
return Response.ok(dashboard).build();
}