Include resource total allocations; closes #1518
This commit is contained in:
parent
f420cd1354
commit
c9883b5caf
1 changed files with 7 additions and 0 deletions
|
@ -44,6 +44,13 @@ class NodeTransformer extends BaseTransformer
|
||||||
$response[$node->getUpdatedAtColumn()] = $this->formatTimestamp($node->updated_at);
|
$response[$node->getUpdatedAtColumn()] = $this->formatTimestamp($node->updated_at);
|
||||||
$response[$node->getCreatedAtColumn()] = $this->formatTimestamp($node->created_at);
|
$response[$node->getCreatedAtColumn()] = $this->formatTimestamp($node->created_at);
|
||||||
|
|
||||||
|
$resources = $node->servers()->select(['memory', 'disk'])->get();
|
||||||
|
|
||||||
|
$response['allocated_resources'] = [
|
||||||
|
'memory' => $resources->sum('memory'),
|
||||||
|
'disk' => $resources->sum('disk'),
|
||||||
|
];
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue