ui(admin): add search and sort to ServersContainer
This commit is contained in:
parent
ae88a01bea
commit
bca2338863
16 changed files with 1097 additions and 1381 deletions
|
@ -48,7 +48,7 @@ class ServerController extends ApplicationApiController
|
|||
|
||||
$servers = QueryBuilder::for(Server::query())
|
||||
->allowedFilters(['uuid', 'name', 'image', 'external_id'])
|
||||
->allowedSorts(['id', 'uuid'])
|
||||
->allowedSorts(['id', 'uuid', 'owner_id', 'node_id', 'status'])
|
||||
->paginate($perPage);
|
||||
|
||||
return $this->fractal->collection($servers)
|
||||
|
@ -72,7 +72,7 @@ class ServerController extends ApplicationApiController
|
|||
|
||||
return $this->fractal->item($server)
|
||||
->transformWith($this->getTransformer(ServerTransformer::class))
|
||||
->respond(201);
|
||||
->respond(Response::HTTP_CREATED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,7 +125,9 @@ class ServerTransferController extends Controller
|
|||
$server = $this->connection->transaction(function () use ($server, $transfer) {
|
||||
$allocations = [$transfer->old_allocation];
|
||||
if (!empty($transfer->old_additional_allocations)) {
|
||||
array_push($allocations, $transfer->old_additional_allocations);
|
||||
foreach ($transfer->old_additional_allocations as $allocation) {
|
||||
$allocations[] = $allocation;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the old allocations for the server and re-assign the server to the new
|
||||
|
@ -169,7 +171,9 @@ class ServerTransferController extends Controller
|
|||
|
||||
$allocations = [$transfer->new_allocation];
|
||||
if (!empty($transfer->new_additional_allocations)) {
|
||||
array_push($allocations, $transfer->new_additional_allocations);
|
||||
foreach ($transfer->new_additional_allocations as $allocation) {
|
||||
$allocations[] = $allocation;
|
||||
}
|
||||
}
|
||||
|
||||
Allocation::query()->whereIn('id', $allocations)->update(['server_id' => null]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue