Fixed sync error
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
testing/ogcore-api/pipeline/head There was a failure building this commit
Details
parent
f6e4234150
commit
6fec472091
|
|
@ -81,6 +81,51 @@ class RemotePcController extends AbstractController
|
|||
], Response::HTTP_OK);
|
||||
}
|
||||
|
||||
#[Route('/opengnsys/rest/ous/{ouid}/labs/{labId}/clients/{clientId}/status', methods: ['GET'])]
|
||||
#[Route('/opengnsys/rest//ous/{ouid}/labs/{labId}/clients/{clientId}/status', methods: ['GET'])]
|
||||
public function status(int $ouid, int $labId, int $clientId): JsonResponse
|
||||
{
|
||||
$client = $this->findClientInLabAndOu($ouid, $labId, $clientId);
|
||||
if (!$client) {
|
||||
return new JsonResponse(['message' => 'Client not found'], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
$statusMap = [
|
||||
ClientStatus::OFF => 'off',
|
||||
ClientStatus::INITIALIZING => 'initializing',
|
||||
ClientStatus::DISCONNECTED => 'off',
|
||||
ClientStatus::TURNING_OFF => 'off',
|
||||
ClientStatus::OG_LIVE => 'oglive',
|
||||
ClientStatus::BUSY => 'busy',
|
||||
ClientStatus::LINUX => 'linux',
|
||||
ClientStatus::LINUX_SESSION => 'linux',
|
||||
ClientStatus::MACOS => 'macos',
|
||||
ClientStatus::MACOS_SESSION => 'macos',
|
||||
ClientStatus::WINDOWS => 'windows',
|
||||
ClientStatus::WINDOWS_SESSION => 'windows',
|
||||
];
|
||||
|
||||
$clientStatus = $client->getStatus();
|
||||
$apiStatus = $statusMap[$clientStatus] ?? 'unknown';
|
||||
$loggedIn = in_array($clientStatus, [
|
||||
ClientStatus::LINUX_SESSION,
|
||||
ClientStatus::MACOS_SESSION,
|
||||
ClientStatus::WINDOWS_SESSION,
|
||||
], true);
|
||||
|
||||
$response = [
|
||||
'id' => $client->getId(),
|
||||
'ip' => $client->getIp(),
|
||||
'status' => $apiStatus,
|
||||
];
|
||||
|
||||
if ($loggedIn) {
|
||||
$response['loggedin'] = true;
|
||||
}
|
||||
|
||||
return new JsonResponse($response, Response::HTTP_OK);
|
||||
}
|
||||
|
||||
#[Route('/opengnsys/rest/ous/{ouid}/labs/{labId}/clients/{clientId}/unreserve', methods: ['DELETE'])]
|
||||
#[Route('/opengnsys/rest//ous/{ouid}/labs/{labId}/clients/{clientId}/unreserve', methods: ['DELETE'])]
|
||||
public function unreserve(int $ouid, int $labId, int $clientId): JsonResponse
|
||||
|
|
|
|||
Loading…
Reference in New Issue