Add migration for 'threads' column, fix errors on some admin pages, add validation rule for 'threads' column

This commit is contained in:
Matthew Penner 2020-04-03 18:50:07 -06:00
parent 85e3945cd7
commit 829f05a2c7
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 $disk
* @property int $io * @property int $io
* @property int $cpu * @property int $cpu
* @property string $threads
* @property bool $oom_disabled * @property bool $oom_disabled
* @property int $allocation_id * @property int $allocation_id
* @property int $nest_id * @property int $nest_id
@ -109,6 +110,7 @@ class Server extends Validable
'swap' => 'required|numeric|min:-1', 'swap' => 'required|numeric|min:-1',
'io' => 'required|numeric|between:10,1000', 'io' => 'required|numeric|between:10,1000',
'cpu' => 'required|numeric|min:0', 'cpu' => 'required|numeric|min:0',
'threads' => 'sometimes|regex:/^[0-9-,]+$/',
'oom_disabled' => 'sometimes|boolean', 'oom_disabled' => 'sometimes|boolean',
'disk' => 'required|numeric|min:0', 'disk' => 'required|numeric|min:0',
'allocation_id' => 'required|bail|unique:servers|exists:allocations,id', 'allocation_id' => 'required|bail|unique:servers|exists:allocations,id',

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
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"> <div class="box-header with-border">
<h3 class="box-title">{{ $variable->name }}</h3> <h3 class="box-title">{{ $variable->name }}</h3>
</div> </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="box-body">
<div class="form-group"> <div class="form-group">
<label class="form-label">Name</label> <label class="form-label">Name</label>

View file

@ -160,7 +160,7 @@
<div class="box-footer"> <div class="box-footer">
{!! csrf_field() !!} {!! csrf_field() !!}
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Save</button> <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"> <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> <i class="fa fa-trash-o"></i>
</button> </button>

View file

@ -138,7 +138,7 @@
{!! csrf_field() !!} {!! csrf_field() !!}
<button type="submit" class="btn btn-sm btn-success pull-right">Export</button> <button type="submit" class="btn btn-sm btn-success pull-right">Export</button>
</form> </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() !!} {!! csrf_field() !!}
<button type="submit" class="btn btn-sm pull-right muted muted-hover" style="margin-right:10px;">Export with Archive</button> <button type="submit" class="btn btn-sm pull-right muted muted-hover" style="margin-right:10px;">Export with Archive</button>
</form> </form>

View file

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