[Breaking] Return all server allocations in API response
This commit is contained in:
parent
d3c749ac56
commit
7b5139b2b1
2 changed files with 15 additions and 10 deletions
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Transformers\Api\Client;
|
||||||
use Pterodactyl\Models\Egg;
|
use Pterodactyl\Models\Egg;
|
||||||
use Pterodactyl\Models\Server;
|
use Pterodactyl\Models\Server;
|
||||||
use Pterodactyl\Models\Subuser;
|
use Pterodactyl\Models\Subuser;
|
||||||
|
use Pterodactyl\Models\Allocation;
|
||||||
|
|
||||||
class ServerTransformer extends BaseClientTransformer
|
class ServerTransformer extends BaseClientTransformer
|
||||||
{
|
{
|
||||||
|
@ -41,10 +42,14 @@ class ServerTransformer extends BaseClientTransformer
|
||||||
'port' => $server->node->daemonSFTP,
|
'port' => $server->node->daemonSFTP,
|
||||||
],
|
],
|
||||||
'description' => $server->description,
|
'description' => $server->description,
|
||||||
'allocation' => [
|
'allocations' => $server->allocations->map(function (Allocation $allocation) use ($server) {
|
||||||
'ip' => $server->allocation->alias,
|
return [
|
||||||
'port' => $server->allocation->port,
|
'ip' => $allocation->ip,
|
||||||
],
|
'ip_alias' => $allocation->ip_alias,
|
||||||
|
'port' => $allocation->port,
|
||||||
|
'is_default' => $allocation->id === $server->allocation_id,
|
||||||
|
];
|
||||||
|
}),
|
||||||
'limits' => [
|
'limits' => [
|
||||||
'memory' => $server->memory,
|
'memory' => $server->memory,
|
||||||
'swap' => $server->swap,
|
'swap' => $server->swap,
|
||||||
|
|
|
@ -45,12 +45,12 @@ export const rawDataToServerObject = (data: any): Server => ({
|
||||||
port: data.sftp_details.port,
|
port: data.sftp_details.port,
|
||||||
},
|
},
|
||||||
description: data.description ? ((data.description.length > 0) ? data.description : null) : null,
|
description: data.description ? ((data.description.length > 0) ? data.description : null) : null,
|
||||||
allocations: [ {
|
allocations: (data.allocations || []).map((datum: any) => ({
|
||||||
ip: data.allocation.ip,
|
ip: datum.ip,
|
||||||
alias: null,
|
alias: datum.ip_alias,
|
||||||
port: data.allocation.port,
|
port: datum.port,
|
||||||
default: true,
|
default: datum.is_default,
|
||||||
} ],
|
})),
|
||||||
limits: { ...data.limits },
|
limits: { ...data.limits },
|
||||||
featureLimits: { ...data.feature_limits },
|
featureLimits: { ...data.feature_limits },
|
||||||
isSuspended: data.is_suspended,
|
isSuspended: data.is_suspended,
|
||||||
|
|
Loading…
Reference in a new issue