From dff7e8f73437469ae62ae231c10fe52e29695149 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 2 Mar 2018 23:11:30 -0600 Subject: [PATCH] Fix server creation in UI and API --- CHANGELOG.md | 4 +++ .../Servers/StoreServerRequest.php | 7 +++++ .../Servers/ServerCreationService.php | 2 ++ .../pterodactyl/admin/servers/new.blade.php | 26 +++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 947098b6a..31c1cef28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa This project follows [Semantic Versioning](http://semver.org) guidelines. +## v0.7.4-h1 (Derelict Dermodactylus) +### Fixed +* Being able to create servers is kind of a core aspect of the software, pushing releases late at night is not a great idea. + ## v0.7.4 (Derelict Dermodactylus) ### Fixed * Fixes a bug when reinstalling a server that would not mark the server as installing, resulting in some UI issues. diff --git a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php index d12b738e6..e504d7549 100644 --- a/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php +++ b/app/Http/Requests/Api/Application/Servers/StoreServerRequest.php @@ -50,6 +50,11 @@ class StoreServerRequest extends ApplicationApiRequest 'limits.io' => $rules['io'], 'limits.cpu' => $rules['cpu'], + // Application Resource Limits + 'feature_limits' => 'required|array', + 'feature_limits.databases' => $rules['database_limit'], + 'feature_limits.allocations' => $rules['allocation_limit'], + // Placeholders for rules added in withValidator() function. 'allocation.default' => '', 'allocation.additional.*' => '', @@ -94,6 +99,8 @@ class StoreServerRequest extends ApplicationApiRequest 'allocation_id' => array_get($data, 'allocation.default'), 'allocation_additional' => array_get($data, 'allocation.additional'), 'start_on_completion' => array_get($data, 'start_on_completion', false), + 'database_limit' => array_get($data, 'feature_limits.databases'), + 'allocation_limit' => array_get($data, 'feature_limits.allocations'), ]; } diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 0c5ecd0d4..36144241f 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -233,6 +233,8 @@ class ServerCreationService 'startup' => array_get($data, 'startup'), 'daemonSecret' => str_random(Node::DAEMON_SECRET_LENGTH), 'image' => array_get($data, 'image'), + 'database_limit' => array_get($data, 'database_limit'), + 'allocation_limit' => array_get($data, 'allocation_limit'), ]); } diff --git a/resources/themes/pterodactyl/admin/servers/new.blade.php b/resources/themes/pterodactyl/admin/servers/new.blade.php index bad452312..50d67d59d 100644 --- a/resources/themes/pterodactyl/admin/servers/new.blade.php +++ b/resources/themes/pterodactyl/admin/servers/new.blade.php @@ -94,6 +94,32 @@ +
+
+
+ +
+

Application Feature Limits

+
+
+
+ +
+ +
+

The total number of databases a user is allowed to create for this server. Leave blank to allow unlimmited.

+
+
+ +
+ +
+

The total number of allocations a user is allowed to create for this server. Leave blank to allow unlimited.

+
+
+
+
+