From 4667f96b40998e7b73bd09ce8198d12c2f717676 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sun, 9 Jun 2024 21:33:17 +0200 Subject: [PATCH] feat: db proxy logs --- .../Project/Database/Clickhouse/General.php | 5 +++- .../Project/Database/Dragonfly/General.php | 5 +++- .../Project/Database/Keydb/General.php | 6 ++++- .../Project/Database/Mariadb/General.php | 6 ++++- .../Project/Database/Mongodb/General.php | 6 ++++- .../Project/Database/Mysql/General.php | 5 +++- .../Project/Database/Postgresql/General.php | 5 +++- .../Project/Database/Redis/General.php | 6 ++++- .../{migrations => seeders}/new_services.php | 0 .../database/clickhouse/general.blade.php | 24 +++++++++++++---- .../database/dragonfly/general.blade.php | 20 +++++++++++--- .../project/database/keydb/general.blade.php | 20 +++++++++++--- .../database/mariadb/general.blade.php | 20 +++++++++++--- .../database/mongodb/general.blade.php | 26 +++++++++++++++---- .../project/database/mysql/general.blade.php | 20 +++++++++++--- .../database/postgresql/general.blade.php | 24 ++++++++++++++--- .../project/database/redis/general.blade.php | 22 +++++++++++++--- .../project/shared/get-logs.blade.php | 2 +- 18 files changed, 183 insertions(+), 39 deletions(-) rename database/{migrations => seeders}/new_services.php (100%) diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.php index 7fe9c1ce0..33a339e84 100644 --- a/app/Livewire/Project/Database/Clickhouse/General.php +++ b/app/Livewire/Project/Database/Clickhouse/General.php @@ -4,12 +4,14 @@ namespace App\Livewire\Project\Database\Clickhouse; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneClickhouse; use Exception; use Livewire\Component; class General extends Component { + public Server $server; public StandaloneClickhouse $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,11 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php index 0a4adf269..d9f1290bc 100644 --- a/app/Livewire/Project/Database/Dragonfly/General.php +++ b/app/Livewire/Project/Database/Dragonfly/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Dragonfly; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneDragonfly; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneDragonfly $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -41,10 +43,11 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php index 536f743f2..222b8a2fc 100644 --- a/app/Livewire/Project/Database/Keydb/General.php +++ b/app/Livewire/Project/Database/Keydb/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Keydb; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneKeydb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneKeydb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,12 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php index c0c67898f..f0a7deb82 100644 --- a/app/Livewire/Project/Database/Mariadb/General.php +++ b/app/Livewire/Project/Database/Mariadb/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Mariadb; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMariadb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneMariadb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -50,10 +52,12 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php index 3c1271065..3cce20baf 100644 --- a/app/Livewire/Project/Database/Mongodb/General.php +++ b/app/Livewire/Project/Database/Mongodb/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Mongodb; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMongodb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneMongodb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -48,11 +50,13 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php index a1fb9201a..d7d5ae89f 100644 --- a/app/Livewire/Project/Database/Mysql/General.php +++ b/app/Livewire/Project/Database/Mysql/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Mysql; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMysql; use Exception; use Livewire\Component; @@ -13,6 +14,7 @@ class General extends Component protected $listeners = ['refresh']; public StandaloneMysql $database; + public Server $server; public ?string $db_url = null; public ?string $db_url_public = null; @@ -50,11 +52,12 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php index 79d91e7aa..4d5d918de 100644 --- a/app/Livewire/Project/Database/Postgresql/General.php +++ b/app/Livewire/Project/Database/Postgresql/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Postgresql; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandalonePostgresql; use Exception; use Livewire\Component; @@ -13,6 +14,7 @@ use function Aws\filter; class General extends Component { public StandalonePostgresql $database; + public Server $server; public string $new_filename; public string $new_content; public ?string $db_url = null; @@ -57,11 +59,12 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php index a894626b0..aafd8495c 100644 --- a/app/Livewire/Project/Database/Redis/General.php +++ b/app/Livewire/Project/Database/Redis/General.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Database\Redis; use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneRedis; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneRedis $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,12 @@ class General extends Component if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/database/migrations/new_services.php b/database/seeders/new_services.php similarity index 100% rename from database/migrations/new_services.php rename to database/seeders/new_services.php diff --git a/resources/views/livewire/project/database/clickhouse/general.blade.php b/resources/views/livewire/project/database/clickhouse/general.blade.php index 91f12a94b..78a2c4952 100644 --- a/resources/views/livewire/project/database/clickhouse/general.blade.php +++ b/resources/views/livewire/project/database/clickhouse/general.blade.php @@ -15,8 +15,8 @@ @if ($database->started_at)
- +
@@ -34,9 +34,6 @@
- -
@endif +
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/database/dragonfly/general.blade.php b/resources/views/livewire/project/database/dragonfly/general.blade.php index f9552f037..c6ee13fa3 100644 --- a/resources/views/livewire/project/database/dragonfly/general.blade.php +++ b/resources/views/livewire/project/database/dragonfly/general.blade.php @@ -16,9 +16,6 @@
- -
@endif
+
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+
{{-- --}} diff --git a/resources/views/livewire/project/database/keydb/general.blade.php b/resources/views/livewire/project/database/keydb/general.blade.php index 152b3c6cd..d1134d73d 100644 --- a/resources/views/livewire/project/database/keydb/general.blade.php +++ b/resources/views/livewire/project/database/keydb/general.blade.php @@ -17,9 +17,6 @@
- -
@endif +
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+
diff --git a/resources/views/livewire/project/database/mariadb/general.blade.php b/resources/views/livewire/project/database/mariadb/general.blade.php index 7f0596b5c..ddb35a6bc 100644 --- a/resources/views/livewire/project/database/mariadb/general.blade.php +++ b/resources/views/livewire/project/database/mariadb/general.blade.php @@ -45,9 +45,6 @@
- -
@endif +
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/database/mongodb/general.blade.php b/resources/views/livewire/project/database/mongodb/general.blade.php index b405985a8..a5017b21f 100644 --- a/resources/views/livewire/project/database/mongodb/general.blade.php +++ b/resources/views/livewire/project/database/mongodb/general.blade.php @@ -18,9 +18,11 @@ @if ($database->started_at)
+ placeholder="If empty: postgres" + helper="If you change this in the database, please sync it here, otherwise automations (like backups) won't work." /> + required + helper="If you change this in the database, please sync it here, otherwise automations (like backups) won't work." /> @@ -39,9 +41,6 @@
- -
@endif
+
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/database/mysql/general.blade.php b/resources/views/livewire/project/database/mysql/general.blade.php index 539948b2e..85cbef0dd 100644 --- a/resources/views/livewire/project/database/mysql/general.blade.php +++ b/resources/views/livewire/project/database/mysql/general.blade.php @@ -45,9 +45,6 @@
- -
@endif
+
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/database/postgresql/general.blade.php b/resources/views/livewire/project/database/postgresql/general.blade.php index e0ce81d8e..718c44f97 100644 --- a/resources/views/livewire/project/database/postgresql/general.blade.php +++ b/resources/views/livewire/project/database/postgresql/general.blade.php @@ -26,7 +26,8 @@
-
If you change the values in the database, please sync it here, otherwise automations (like backups) won't work. +
If you change the values in the database, please sync it here, otherwise + automations (like backups) won't work.
@if ($database->started_at)
@@ -57,10 +58,8 @@
- -
+ @@ -70,6 +69,23 @@ type="password" readonly wire:model="db_url_public" /> @endif
+
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/database/redis/general.blade.php b/resources/views/livewire/project/database/redis/general.blade.php index 48d3eadd4..ceb12a802 100644 --- a/resources/views/livewire/project/database/redis/general.blade.php +++ b/resources/views/livewire/project/database/redis/general.blade.php @@ -17,9 +17,6 @@
- -
@endif
+
+

Proxy

+
+ + + Proxy Logs + + + + Proxy Logs + + +
+

Advanced

diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php index e55847338..b8e10890d 100644 --- a/resources/views/livewire/project/shared/get-logs.blade.php +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -34,7 +34,7 @@ } }">
- @if ($resource?->type() === 'application') + @if ($resource?->type() === 'application' || str($resource?->type())->startsWith('standalone'))

{{ $container }}

@else

{{ str($container)->beforeLast('-')->headline() }}