Merge pull request #1887 from matthewpi/feature/server-transfers

Add migration and validation rules for 'threads' column, fixes other errors on nest/egg pages
This commit is contained in:
Dane Everitt 2020-04-03 22:54:29 -07:00 committed by GitHub
commit 6d1226a0c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 4 deletions

View file

@ -23,6 +23,7 @@ use Znck\Eloquent\Traits\BelongsToThrough;
* @property int $disk
* @property int $io
* @property int $cpu
* @property string $threads
* @property bool $oom_disabled
* @property int $allocation_id
* @property int $nest_id
@ -109,6 +110,7 @@ class Server extends Validable
'swap' => 'required|numeric|min:-1',
'io' => 'required|numeric|between:10,1000',
'cpu' => 'required|numeric|min:0',
'threads' => 'nullable|regex:/^[0-9-,]+$/',
'oom_disabled' => 'sometimes|boolean',
'disk' => 'required|numeric|min:0',
'allocation_id' => 'required|bail|unique:servers|exists:allocations,id',

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddThreadsColumnToServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->string('threads')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('threads');
});
}
}

View file

@ -48,7 +48,7 @@
<div class="box-header with-border">
<h3 class="box-title">{{ $variable->name }}</h3>
</div>
<form action="{{ route('admin.nests.egg.variables.edit', ['id' => $egg->id, 'variable' => $variable->id]) }}" method="POST">
<form action="{{ route('admin.nests.egg.variables.edit', ['egg' => $egg->id, 'variable' => $variable->id]) }}" method="POST">
<div class="box-body">
<div class="form-group">
<label class="form-label">Name</label>

View file

@ -160,7 +160,7 @@
<div class="box-footer">
{!! csrf_field() !!}
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button>
<a href="{{ route('admin.nests.egg.export', ['option' => $egg->id]) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
<a href="{{ route('admin.nests.egg.export', $egg->id) }}" class="btn btn-sm btn-info pull-right" style="margin-right:10px;">Export</a>
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-danger btn-sm muted muted-hover">
<i class="fa fa-trash-o"></i>
</button>

View file

@ -138,7 +138,7 @@
{!! csrf_field() !!}
<button type="submit" class="btn btn-sm btn-success pull-right">Export</button>
</form>
<form action="{{ route('admin.packs.view.export', ['id' => $pack->id, 'files' => 'with-files']) }}" method="POST">
<form action="{{ route('admin.packs.view.export', ['pack' => $pack->id, 'files' => 'with-files']) }}" method="POST">
{!! csrf_field() !!}
<button type="submit" class="btn btn-sm pull-right muted muted-hover" style="margin-right:10px;">Export with Archive</button>
</form>

View file

@ -75,7 +75,13 @@
</tr>
<tr>
<td>CPU Threads</td>
<td><code>{{ $server->threads }}</code></td>
<td>
@if($server->threads != null)
<code>{{ $server->threads }}</code>
@else
<code>n/a</code>
@endif
</td>
</tr>
<tr>
<td>Default Connection</td>