From 4cfb8941d5fd6f42ed399f7a2472cde4dc64ab83 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 25 Feb 2018 16:08:01 -0600 Subject: [PATCH 1/4] Fix broken users table in database causing validation errors. --- CHANGELOG.md | 1 + app/Models/User.php | 1 + ...152_remove_default_null_value_on_table.php | 38 +++++++++++++++++++ ...fine_unique_index_on_users_external_id.php | 32 ++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php create mode 100644 database/migrations/2018_02_25_160604_define_unique_index_on_users_external_id.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 706af0715..c7d1fc6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ## v0.7.3 (Derelict Dermodactylus) ### Fixed * Fixes server creation API endpoint not passing the provided `external_id` to the creation service. +* Fixes a bug causing users to be un-editable on new installations once more than one user exists. ### Added * Adds ability to modify the external ID for a server through the API. diff --git a/app/Models/User.php b/app/Models/User.php index 10c710f19..aff4f3287 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -121,6 +121,7 @@ class User extends Model implements * @var array */ protected $attributes = [ + 'external_id' => null, 'root_admin' => false, 'language' => 'en', 'use_totp' => false, diff --git a/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php new file mode 100644 index 000000000..e9414f230 --- /dev/null +++ b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php @@ -0,0 +1,38 @@ +string('external_id')->default(null)->change(); + }); + + DB::transaction(function () { + DB::table('users')->where('external_id', '=' , 'NULL')->update([ + 'external_id' => null, + ]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // This should not be rolled back. + } +} diff --git a/database/migrations/2018_02_25_160604_define_unique_index_on_users_external_id.php b/database/migrations/2018_02_25_160604_define_unique_index_on_users_external_id.php new file mode 100644 index 000000000..0a9b8afe2 --- /dev/null +++ b/database/migrations/2018_02_25_160604_define_unique_index_on_users_external_id.php @@ -0,0 +1,32 @@ +index(['external_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['external_id']); + }); + } +} From aa08498d51e38967ff240ffbb1fde2390a67ce1a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 25 Feb 2018 16:10:28 -0600 Subject: [PATCH 2/4] Formatting fix --- .../2018_02_25_160152_remove_default_null_value_on_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php index e9414f230..6469867f2 100644 --- a/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php +++ b/database/migrations/2018_02_25_160152_remove_default_null_value_on_table.php @@ -20,7 +20,7 @@ class RemoveDefaultNullValueOnTable extends Migration }); DB::transaction(function () { - DB::table('users')->where('external_id', '=' , 'NULL')->update([ + DB::table('users')->where('external_id', '=', 'NULL')->update([ 'external_id' => null, ]); }); From fa997b9e0db7beb38975418171ad3286d5e80ffb Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 25 Feb 2018 16:21:50 -0600 Subject: [PATCH 3/4] Change default enter behavior on forms to not be delete --- CHANGELOG.md | 1 + .../themes/pterodactyl/admin/databases/view.blade.php | 2 +- .../themes/pterodactyl/admin/eggs/variables.blade.php | 2 +- .../themes/pterodactyl/admin/eggs/view.blade.php | 11 ++++++++--- .../themes/pterodactyl/admin/locations/view.blade.php | 2 +- .../themes/pterodactyl/admin/packs/modal.blade.php | 2 +- .../themes/pterodactyl/admin/packs/view.blade.php | 2 +- .../pterodactyl/server/schedules/view.blade.php | 6 +++--- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d1fc6d3..3c69c8776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Fixed * Fixes server creation API endpoint not passing the provided `external_id` to the creation service. * Fixes a bug causing users to be un-editable on new installations once more than one user exists. +* Fixes default order of buttons in certain parts of the panel that would default to 'Delete' rather than 'Save' when pressing enter. ### Added * Adds ability to modify the external ID for a server through the API. diff --git a/resources/themes/pterodactyl/admin/databases/view.blade.php b/resources/themes/pterodactyl/admin/databases/view.blade.php index db7db1c48..41a2d7901 100644 --- a/resources/themes/pterodactyl/admin/databases/view.blade.php +++ b/resources/themes/pterodactyl/admin/databases/view.blade.php @@ -79,8 +79,8 @@ diff --git a/resources/themes/pterodactyl/admin/eggs/variables.blade.php b/resources/themes/pterodactyl/admin/eggs/variables.blade.php index bd18e05cf..40ee82c8b 100644 --- a/resources/themes/pterodactyl/admin/eggs/variables.blade.php +++ b/resources/themes/pterodactyl/admin/eggs/variables.blade.php @@ -86,8 +86,8 @@ diff --git a/resources/themes/pterodactyl/admin/eggs/view.blade.php b/resources/themes/pterodactyl/admin/eggs/view.blade.php index 2e0fdcc83..c2f687799 100644 --- a/resources/themes/pterodactyl/admin/eggs/view.blade.php +++ b/resources/themes/pterodactyl/admin/eggs/view.blade.php @@ -31,7 +31,7 @@
-
+
Notice: Editing an Egg or any of the Process Management fields requires that each Daemon be rebooted in order to apply the changes.
@@ -159,14 +159,19 @@
+
+
+ Notice: Editing an Egg or any of the Process Management fields requires that each Daemon be rebooted in order to apply the changes. +
+
@endsection diff --git a/resources/themes/pterodactyl/admin/locations/view.blade.php b/resources/themes/pterodactyl/admin/locations/view.blade.php index fdb791754..2264ee694 100644 --- a/resources/themes/pterodactyl/admin/locations/view.blade.php +++ b/resources/themes/pterodactyl/admin/locations/view.blade.php @@ -39,8 +39,8 @@ diff --git a/resources/themes/pterodactyl/admin/packs/modal.blade.php b/resources/themes/pterodactyl/admin/packs/modal.blade.php index 2ce57f2b1..dbf2044e0 100644 --- a/resources/themes/pterodactyl/admin/packs/modal.blade.php +++ b/resources/themes/pterodactyl/admin/packs/modal.blade.php @@ -38,8 +38,8 @@ diff --git a/resources/themes/pterodactyl/admin/packs/view.blade.php b/resources/themes/pterodactyl/admin/packs/view.blade.php index 0f4a38e7b..e530bc9c4 100644 --- a/resources/themes/pterodactyl/admin/packs/view.blade.php +++ b/resources/themes/pterodactyl/admin/packs/view.blade.php @@ -98,8 +98,8 @@ diff --git a/resources/themes/pterodactyl/server/schedules/view.blade.php b/resources/themes/pterodactyl/server/schedules/view.blade.php index 87b15ad5f..370b4f0b0 100644 --- a/resources/themes/pterodactyl/server/schedules/view.blade.php +++ b/resources/themes/pterodactyl/server/schedules/view.blade.php @@ -122,14 +122,14 @@

@lang('server.schedule.task_help')

-
- -
{!! csrf_field() !!}
+
+ +
From a765e0dbb6f728caf84c93f5f87c22a86dca4e63 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Tue, 27 Feb 2018 19:43:47 -0600 Subject: [PATCH 4/4] closes #991 --- CHANGELOG.md | 4 +++ .../Servers/ReinstallServerService.php | 2 +- .../Servers/ReinstallServerServiceTest.php | 28 ++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c69c8776..bbed28aac 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 (Derelict Dermodactylus) +### Fixed +* Fixes a bug when reinstalling a server that would not mark the server as installing, resulting in some UI issues. + ## v0.7.3 (Derelict Dermodactylus) ### Fixed * Fixes server creation API endpoint not passing the provided `external_id` to the creation service. diff --git a/app/Services/Servers/ReinstallServerService.php b/app/Services/Servers/ReinstallServerService.php index 682813e36..85800473f 100644 --- a/app/Services/Servers/ReinstallServerService.php +++ b/app/Services/Servers/ReinstallServerService.php @@ -66,7 +66,7 @@ class ReinstallServerService $this->database->beginTransaction(); $this->repository->withoutFreshModel()->update($server->id, [ 'installed' => 0, - ]); + ], true, true); try { $this->daemonServerRepository->setServer($server)->reinstall(); diff --git a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php index 349aa571a..f00614f77 100644 --- a/tests/Unit/Services/Servers/ReinstallServerServiceTest.php +++ b/tests/Unit/Services/Servers/ReinstallServerServiceTest.php @@ -81,10 +81,9 @@ class ReinstallServerServiceTest extends TestCase $this->repository->shouldNotReceive('find'); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf() ->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response); @@ -101,10 +100,9 @@ class ReinstallServerServiceTest extends TestCase $this->repository->shouldReceive('find')->with($this->server->id)->once()->andReturn($this->server); $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andReturnSelf() ->shouldReceive('reinstall')->withNoArgs()->once()->andReturn(new Response); @@ -121,10 +119,9 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionThrownByGuzzleShouldBeReRenderedAsDisplayable() { $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow($this->exception); @@ -139,10 +136,9 @@ class ReinstallServerServiceTest extends TestCase public function testExceptionNotThrownByGuzzleShouldNotBeTransformedToDisplayable() { $this->database->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); - $this->repository->shouldReceive('withoutFreshModel')->withNoArgs()->once()->andReturnSelf() - ->shouldReceive('update')->with($this->server->id, [ - 'installed' => 0, - ])->once()->andReturnNull(); + $this->repository->shouldReceive('withoutFreshModel->update')->with($this->server->id, [ + 'installed' => 0, + ], true, true)->once()->andReturnNull(); $this->daemonServerRepository->shouldReceive('setServer')->with($this->server)->once()->andThrow(new Exception());