Include resource total allocations; closes #1518

This commit is contained in:
Dane Everitt
2020-09-17 20:44:24 -07:00
parent f420cd1354
commit c9883b5caf

View File

@@ -44,6 +44,13 @@ class NodeTransformer extends BaseTransformer
$response[$node->getUpdatedAtColumn()] = $this->formatTimestamp($node->updated_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;
}