From e906ada528875177c180dd710c49bf86065354a0 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 26 Aug 2018 14:01:00 -0700 Subject: [PATCH] Better handling when deleting a database --- .../Api/Client/Servers/DatabaseController.php | 4 +- .../{ => database}/CreateDatabaseModal.vue | 2 +- .../components/database/DatabaseRow.vue | 68 ++++++++++++++++ .../database/DeleteDatabaseModal.vue | 81 +++++++++++++++++++ .../components/server/subpages/Databases.vue | 65 +++------------ 5 files changed, 166 insertions(+), 54 deletions(-) rename resources/assets/scripts/components/server/components/{ => database}/CreateDatabaseModal.vue (98%) create mode 100644 resources/assets/scripts/components/server/components/database/DatabaseRow.vue create mode 100644 resources/assets/scripts/components/server/components/database/DeleteDatabaseModal.vue diff --git a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php index bda75a37..d440f321 100644 --- a/app/Http/Controllers/Api/Client/Servers/DatabaseController.php +++ b/app/Http/Controllers/Api/Client/Servers/DatabaseController.php @@ -4,6 +4,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Illuminate\Http\Response; use Pterodactyl\Models\Server; +use Pterodactyl\Models\Database; use Pterodactyl\Transformers\Api\Client\DatabaseTransformer; use Pterodactyl\Services\Databases\DatabaseManagementService; use Pterodactyl\Services\Databases\DeployServerDatabaseService; @@ -88,7 +89,8 @@ class DatabaseController extends ClientApiController */ public function delete(DeleteDatabaseRequest $request): Response { + $this->managementService->delete($request->getModel(Database::class)->id); + return Response::create('', Response::HTTP_NO_CONTENT); -// $this->managementService->delete($request->input('database')); } } diff --git a/resources/assets/scripts/components/server/components/CreateDatabaseModal.vue b/resources/assets/scripts/components/server/components/database/CreateDatabaseModal.vue similarity index 98% rename from resources/assets/scripts/components/server/components/CreateDatabaseModal.vue rename to resources/assets/scripts/components/server/components/database/CreateDatabaseModal.vue index 81cefad1..11072696 100644 --- a/resources/assets/scripts/components/server/components/CreateDatabaseModal.vue +++ b/resources/assets/scripts/components/server/components/database/CreateDatabaseModal.vue @@ -31,7 +31,7 @@ diff --git a/resources/assets/scripts/components/server/components/database/DeleteDatabaseModal.vue b/resources/assets/scripts/components/server/components/database/DeleteDatabaseModal.vue new file mode 100644 index 00000000..aed842d8 --- /dev/null +++ b/resources/assets/scripts/components/server/components/database/DeleteDatabaseModal.vue @@ -0,0 +1,81 @@ + + + + diff --git a/resources/assets/scripts/components/server/subpages/Databases.vue b/resources/assets/scripts/components/server/subpages/Databases.vue index c6c1fa75..8a39a656 100644 --- a/resources/assets/scripts/components/server/subpages/Databases.vue +++ b/resources/assets/scripts/components/server/subpages/Databases.vue @@ -12,39 +12,7 @@
-
-
- -
-

Database Name

-

{{database.name}}

-
-
-

Username

-

{{database.username}}

-
-
-

Password

-

- - - •••••• - - {{database.password}} - -

-
-
-

Server

-

{{database.host.address}}:{{database.host.port}}

-
-
- -
-
-
+
@@ -62,12 +30,14 @@