Fix allocation behavior, closes #712
This commit is contained in:
parent
036bea2b94
commit
22511c8e24
5 changed files with 34 additions and 5 deletions
|
@ -11,10 +11,14 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
|||
* `[beta.3]` — Fixes error handling of the settings service provider when no migrations have been run.
|
||||
* `[beta.3]` — Fixes validation error when trying to use 'None' as the 'Copy Script From' option for an egg script.
|
||||
* Fixes a design bug in the database that prevented the storage of negative numbers, thus preventing a server from being assigned unlimited swap.
|
||||
* Fixes a bug where the 'Assign New Allocations' box would only show IPs that were present in the current pagination block.
|
||||
|
||||
### Added
|
||||
* Nest and Egg listings now show the associated ID in order to make API requests easier.
|
||||
|
||||
### Changed
|
||||
* Changed behavior of allocation IP Address/Ports box to automatically store the value entered if a user unfocuses the field without hitting space.
|
||||
|
||||
## v0.7.0-beta.3 (Derelict Dermodactylus)
|
||||
### Fixed
|
||||
* `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances.
|
||||
|
|
|
@ -22,4 +22,12 @@ interface AllocationRepositoryInterface extends RepositoryInterface
|
|||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getAllocationsForNode(int $node): Collection;
|
||||
|
||||
/**
|
||||
* Return all of the unique IPs that exist for a given node.
|
||||
*
|
||||
* @param int $node
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getUniqueAllocationIpsForNode(int $node): Collection;
|
||||
}
|
||||
|
|
|
@ -210,15 +210,16 @@ class NodesController extends Controller
|
|||
*
|
||||
* @param \Pterodactyl\Models\Node $node
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function viewAllocation(Node $node)
|
||||
{
|
||||
$this->repository->loadNodeAllocations($node);
|
||||
Javascript::put(['node' => collect($node)->only(['id'])]);
|
||||
|
||||
return view('admin.nodes.view.allocation', ['node' => $node]);
|
||||
return view('admin.nodes.view.allocation', [
|
||||
'allocations' => $this->allocationRepository->setColumns(['ip'])->getUniqueAllocationIpsForNode($node->id),
|
||||
'node' => $node,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,4 +40,18 @@ class AllocationRepository extends EloquentRepository implements AllocationRepos
|
|||
{
|
||||
return $this->getBuilder()->where('node_id', $node)->get($this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all of the unique IPs that exist for a given node.
|
||||
*
|
||||
* @param int $node
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getUniqueAllocationIpsForNode(int $node): Collection
|
||||
{
|
||||
return $this->getBuilder()->where('node_id', $node)
|
||||
->groupBy('ip')
|
||||
->orderByRaw('INET_ATON(ip) ASC')
|
||||
->get($this->getColumns());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
<label for="pAllocationIP" class="control-label">IP Address</label>
|
||||
<div>
|
||||
<select class="form-control" name="allocation_ip" id="pAllocationIP" multiple>
|
||||
@foreach($node->allocations->unique('ip')->values()->all() as $allocation)
|
||||
@foreach($allocations as $allocation)
|
||||
<option value="{{ $allocation->ip }}">{{ $allocation->ip }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
@ -132,7 +132,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<select class="form-control" name="ip">
|
||||
@foreach($node->allocations->unique('ip')->values()->all() as $allocation)
|
||||
@foreach($allocations as $allocation)
|
||||
<option value="{{ $allocation->ip }}">{{ $allocation->ip }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
@ -156,10 +156,12 @@
|
|||
$('#pAllocationIP').select2({
|
||||
tags: true,
|
||||
maximumSelectionLength: 1,
|
||||
selectOnClose: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
});
|
||||
$('#pAllocationPorts').select2({
|
||||
tags: true,
|
||||
selectOnClose: true,
|
||||
tokenSeparators: [',', ' '],
|
||||
});
|
||||
$('button[data-action="deallocate"]').click(function (event) {
|
||||
|
|
Loading…
Reference in a new issue