From 829f05a2c75218d69b24b3678a542410710635ea Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 3 Apr 2020 18:50:07 -0600 Subject: [PATCH] Add migration for 'threads' column, fix errors on some admin pages, add validation rule for 'threads' column --- app/Models/Server.php | 2 ++ ...24_add_threads_column_to_servers_table.php | 32 +++++++++++++++++++ .../views/admin/eggs/variables.blade.php | 2 +- resources/views/admin/eggs/view.blade.php | 2 +- resources/views/admin/packs/view.blade.php | 2 +- .../views/admin/servers/view/index.blade.php | 8 ++++- 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 database/migrations/2020_04_03_203624_add_threads_column_to_servers_table.php diff --git a/app/Models/Server.php b/app/Models/Server.php index ebe6d2ee7..6ad7b9f05 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -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' => 'sometimes|regex:/^[0-9-,]+$/', 'oom_disabled' => 'sometimes|boolean', 'disk' => 'required|numeric|min:0', 'allocation_id' => 'required|bail|unique:servers|exists:allocations,id', diff --git a/database/migrations/2020_04_03_203624_add_threads_column_to_servers_table.php b/database/migrations/2020_04_03_203624_add_threads_column_to_servers_table.php new file mode 100644 index 000000000..5440d0c58 --- /dev/null +++ b/database/migrations/2020_04_03_203624_add_threads_column_to_servers_table.php @@ -0,0 +1,32 @@ +string('threads')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('servers', function (Blueprint $table) { + $table->dropColumn('threads'); + }); + } +} diff --git a/resources/views/admin/eggs/variables.blade.php b/resources/views/admin/eggs/variables.blade.php index f8463f4bd..2441c725f 100644 --- a/resources/views/admin/eggs/variables.blade.php +++ b/resources/views/admin/eggs/variables.blade.php @@ -48,7 +48,7 @@

{{ $variable->name }}

-
+
diff --git a/resources/views/admin/eggs/view.blade.php b/resources/views/admin/eggs/view.blade.php index 64c3183e9..d483f049f 100644 --- a/resources/views/admin/eggs/view.blade.php +++ b/resources/views/admin/eggs/view.blade.php @@ -160,7 +160,7 @@