mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
clean up node allocation
This commit is contained in:
parent
16222d1bd7
commit
bd7fd836ff
@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
### Fixed
|
||||
* Team Fortress named 'Insurgency' in panel in database seeder. ([#96](https://github.com/Pterodactyl/Panel/issues/96), PR by [@MeltedLux](https://github.com/MeltedLux))
|
||||
* Server allocation listing display now showing the connection IP unless an alias was assigned.
|
||||
* Fixed bug where node allocation would appear to be successful but actual encounter an error. Made it cleared how to enter ports.
|
||||
|
||||
### Deprecated
|
||||
### Removed
|
||||
|
@ -27,6 +27,7 @@ use Alert;
|
||||
use Debugbar;
|
||||
use Log;
|
||||
use DB;
|
||||
use Validator;
|
||||
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Repositories\NodeRepository;
|
||||
@ -116,6 +117,10 @@ class NodesController extends Controller
|
||||
->orderBy('allocations.ip', 'asc')
|
||||
->orderBy('allocations.port', 'asc')
|
||||
->paginate(20, ['*'], 'allocations'),
|
||||
'allocation_ips' => Models\Allocation::select('id', 'ip')
|
||||
->where('node', $node->id)
|
||||
->groupBy('ip')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -169,7 +174,7 @@ class NodesController extends Controller
|
||||
Alert::success('Deleted all unallocated ports for <code>' . $request->input('ip') . '</code>.')->flash();
|
||||
return redirect()->route('admin.nodes.view', [
|
||||
'id' => $node,
|
||||
'tab' => 'tab_allocations'
|
||||
'tab' => 'tab_allocation'
|
||||
]);
|
||||
}
|
||||
|
||||
@ -198,6 +203,19 @@ class NodesController extends Controller
|
||||
|
||||
public function postAllocations(Request $request, $id)
|
||||
{
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'allocate_ip.*' => 'required|string',
|
||||
'allocate_port.*' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('admin.nodes.view', [
|
||||
'id' => $id,
|
||||
'tab' => 'tab_allocation'
|
||||
])->withErrors($validator->errors())->withInput();
|
||||
}
|
||||
|
||||
$processedData = [];
|
||||
foreach($request->input('allocate_ip') as $ip) {
|
||||
if (!array_key_exists($ip, $processedData)) {
|
||||
@ -217,9 +235,6 @@ class NodesController extends Controller
|
||||
}
|
||||
|
||||
try {
|
||||
if(empty($processedData)) {
|
||||
throw new DisplayException('It seems that no data was passed to this function.');
|
||||
}
|
||||
$node = new NodeRepository;
|
||||
$node->addAllocations($id, $processedData);
|
||||
Alert::success('Successfully added new allocations to this node.')->flash();
|
||||
|
@ -275,7 +275,7 @@
|
||||
},
|
||||
"docker": {
|
||||
"socket": "/var/run/docker.sock",
|
||||
"autoupdate_images": false
|
||||
"autoupdate_images": true
|
||||
},
|
||||
"sftp": {
|
||||
"path": "{{ $node->daemonBase }}",
|
||||
@ -318,8 +318,8 @@
|
||||
<div class="input-group-btn">
|
||||
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
@foreach($allocations as $ip => $ports)
|
||||
<li data-action="alloc_dropdown_val" data-value="{{ $ip }}"><a href="#">{{ $ip }}</a></li>
|
||||
@foreach($allocation_ips as $allocation)
|
||||
<li data-action="alloc_dropdown_val" data-value="{{ $allocation->ip }}"><a href="#">{{ $allocation->ip }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@ -334,7 +334,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p class="text-muted"><small>Please enter a comma (<code>,</code>) after each port or port range.</small></p>
|
||||
<p class="text-muted"><small>You <strong>must</strong> enter a comma (<code>,</code>) or press the enter key after each port or range that you enter. They should appear in a blue box.</small></p>
|
||||
<input name="allocate_port[]" type="hidden" class="pillboxMain"/>
|
||||
</div>
|
||||
<div class="form-group col-md-1 col-xs-2" style="margin-left: -10px;">
|
||||
@ -468,12 +468,8 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<select class="form-control" name="ip">
|
||||
<?php $displayed = []; ?>
|
||||
@foreach($allocations as $allocation)
|
||||
@if(!array_key_exists($allocation->ip, $displayed))
|
||||
@foreach($allocation_ips as $allocation)
|
||||
<option value="{{ $allocation->ip }}">{{ $allocation->ip }}</option>
|
||||
<?php $displayed[$allocation->ip] = true; ?>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user