Skip to content

Commit 6d1226a

Browse files
authored
Merge pull request pterodactyl#1887 from matthewpi/feature/server-transfers
Add migration and validation rules for 'threads' column, fixes other errors on nest/egg pages
2 parents 0dbf6b5 + 9d0262e commit 6d1226a

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

app/Models/Server.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* @property int $disk
2424
* @property int $io
2525
* @property int $cpu
26+
* @property string $threads
2627
* @property bool $oom_disabled
2728
* @property int $allocation_id
2829
* @property int $nest_id
@@ -109,6 +110,7 @@ class Server extends Validable
109110
'swap' => 'required|numeric|min:-1',
110111
'io' => 'required|numeric|between:10,1000',
111112
'cpu' => 'required|numeric|min:0',
113+
'threads' => 'nullable|regex:/^[0-9-,]+$/',
112114
'oom_disabled' => 'sometimes|boolean',
113115
'disk' => 'required|numeric|min:0',
114116
'allocation_id' => 'required|bail|unique:servers|exists:allocations,id',
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class AddThreadsColumnToServersTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('servers', function (Blueprint $table) {
17+
$table->string('threads')->nullable();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('servers', function (Blueprint $table) {
29+
$table->dropColumn('threads');
30+
});
31+
}
32+
}

resources/views/admin/eggs/variables.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<div class="box-header with-border">
4949
<h3 class="box-title">{{ $variable->name }}</h3>
5050
</div>
51-
<form action="{{ route('admin.nests.egg.variables.edit', ['id' => $egg->id, 'variable' => $variable->id]) }}" method="POST">
51+
<form action="{{ route('admin.nests.egg.variables.edit', ['egg' => $egg->id, 'variable' => $variable->id]) }}" method="POST">
5252
<div class="box-body">
5353
<div class="form-group">
5454
<label class="form-label">Name</label>

resources/views/admin/eggs/view.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
<div class="box-footer">
161161
{!! csrf_field() !!}
162162
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
163-
<a href="{{ route('admin.nests.egg.export', ['option' => $egg->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
163+
<a href="{{ route('admin.nests.egg.export', $egg->id) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
164164
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-danger btn-sm muted muted-hover">
165165
<i class="fa fa-trash-o"></i>
166166
</button>

resources/views/admin/packs/view.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
{!! csrf_field() !!}
139139
<button type="submit" class="btn btn-sm btn-success pull-right">Export</button>
140140
</form>
141-
<form action="{{ route('admin.packs.view.export', ['id' => $pack->id, 'files' => 'with-files']) }}" method="POST">
141+
<form action="{{ route('admin.packs.view.export', ['pack' => $pack->id, 'files' => 'with-files']) }}" method="POST">
142142
{!! csrf_field() !!}
143143
<button type="submit" class="btn btn-sm pull-right muted muted-hover" style="margin-right:10px;">Export with Archive</button>
144144
</form>

resources/views/admin/servers/view/index.blade.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@
7575
</tr>
7676
<tr>
7777
<td>CPU Threads</td>
78-
<td><code>{{ $server->threads }}</code></td>
78+
<td>
79+
@if($server->threads != null)
80+
<code>{{ $server->threads }}</code>
81+
@else
82+
<code>n/a</code>
83+
@endif
84+
</td>
7985
</tr>
8086
<tr>
8187
<td>Default Connection</td>

0 commit comments

Comments
 (0)