Fixed /api/servers

This commit is contained in:
antony1060 2021-04-02 21:32:30 +02:00
parent 471886dd34
commit b691b8f06f
No known key found for this signature in database
GPG Key ID: FC437A1812A6D8D5

View File

@ -28,7 +28,15 @@ func getSystemInformation(c *gin.Context) {
// Returns all of the servers that are registered and configured correctly on
// this wings instance.
func getAllServers(c *gin.Context) {
c.JSON(http.StatusOK, middleware.ExtractManager(c).All())
servers := middleware.ExtractManager(c).All()
var procData []serverProcData
for _, v := range servers {
procData = append(procData, serverProcData{
ResourceUsage: v.Proc(),
Suspended: v.IsSuspended(),
})
}
c.JSON(http.StatusOK, procData)
}
// Creates a new server on the wings daemon and begins the installation process