diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php index 51f8b5a66..ed5c9fd26 100644 --- a/app/Livewire/Project/Database/Dragonfly/General.php +++ b/app/Livewire/Project/Database/Dragonfly/General.php @@ -60,10 +60,12 @@ class General extends Component public function getListeners() { + $userId = Auth::id(); $teamId = Auth::user()->currentTeam()->id; return [ "echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', ]; } diff --git a/app/Livewire/Project/Database/Heading.php b/app/Livewire/Project/Database/Heading.php index c3b57b9f4..9ddb1909c 100644 --- a/app/Livewire/Project/Database/Heading.php +++ b/app/Livewire/Project/Database/Heading.php @@ -31,8 +31,8 @@ class Heading extends Component $this->database->update([ 'started_at' => now(), ]); - $this->dispatch('refresh'); $this->check_status(); + if (is_null($this->database->config_hash) || $this->database->isConfigurationChanged()) { $this->database->isConfigurationChanged(true); $this->dispatch('configurationChanged'); @@ -44,7 +44,7 @@ class Heading extends Component public function check_status($showNotification = false) { if ($this->database->destination->server->isFunctional()) { - GetContainersStatus::dispatch($this->database->destination->server); + GetContainersStatus::run($this->database->destination->server); } if ($showNotification) { @@ -63,6 +63,7 @@ class Heading extends Component $this->database->status = 'exited'; $this->database->save(); $this->check_status(); + $this->dispatch('refresh'); } public function restart() diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php index 213b0d2d3..a7c589f3e 100644 --- a/app/Livewire/Project/Database/Keydb/General.php +++ b/app/Livewire/Project/Database/Keydb/General.php @@ -63,10 +63,13 @@ class General extends Component public function getListeners() { + $userId = Auth::id(); $teamId = Auth::user()->currentTeam()->id; return [ "echo-private:team.{$teamId},DatabaseProxyStopped" => 'databaseProxyStopped', + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', ]; } diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php index 06dffdc22..ceac4bffb 100644 --- a/app/Livewire/Project/Database/Mariadb/General.php +++ b/app/Livewire/Project/Database/Mariadb/General.php @@ -8,6 +8,7 @@ use App\Helpers\SslHelper; use App\Models\Server; use App\Models\SslCertificate; use App\Models\StandaloneMariadb; +use Auth; use Carbon\Carbon; use Exception; use Livewire\Component; @@ -26,6 +27,16 @@ class General extends Component public ?Carbon $certificateValidUntil = null; + public function getListeners() + { + $userId = Auth::id(); + + return [ + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', + ]; + } + protected $rules = [ 'database.name' => 'required', 'database.description' => 'nullable', diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php index 282547283..5d3702d9f 100644 --- a/app/Livewire/Project/Database/Mongodb/General.php +++ b/app/Livewire/Project/Database/Mongodb/General.php @@ -8,6 +8,7 @@ use App\Helpers\SslHelper; use App\Models\Server; use App\Models\SslCertificate; use App\Models\StandaloneMongodb; +use Auth; use Carbon\Carbon; use Exception; use Livewire\Component; @@ -26,6 +27,16 @@ class General extends Component public ?Carbon $certificateValidUntil = null; + public function getListeners() + { + $userId = Auth::id(); + + return [ + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', + ]; + } + protected $rules = [ 'database.name' => 'required', 'database.description' => 'nullable', diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php index c9424b506..bb6964ef6 100644 --- a/app/Livewire/Project/Database/Mysql/General.php +++ b/app/Livewire/Project/Database/Mysql/General.php @@ -8,6 +8,7 @@ use App\Helpers\SslHelper; use App\Models\Server; use App\Models\SslCertificate; use App\Models\StandaloneMysql; +use Auth; use Carbon\Carbon; use Exception; use Livewire\Component; @@ -26,6 +27,16 @@ class General extends Component public ?Carbon $certificateValidUntil = null; + public function getListeners() + { + $userId = Auth::id(); + + return [ + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', + ]; + } + protected $rules = [ 'database.name' => 'required', 'database.description' => 'nullable', diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php index 3057f5316..8440086d9 100644 --- a/app/Livewire/Project/Database/Postgresql/General.php +++ b/app/Livewire/Project/Database/Postgresql/General.php @@ -8,6 +8,7 @@ use App\Helpers\SslHelper; use App\Models\Server; use App\Models\SslCertificate; use App\Models\StandalonePostgresql; +use Auth; use Carbon\Carbon; use Exception; use Livewire\Component; @@ -30,8 +31,11 @@ class General extends Component public function getListeners() { + $userId = Auth::id(); + return [ - 'refresh', + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', 'save_init_script', 'delete_init_script', ]; @@ -204,7 +208,7 @@ class General extends Component $delete_command = "rm -f $old_file_path"; try { instant_remote_process([$delete_command], $this->server); - } catch (\Exception $e) { + } catch (Exception $e) { $this->dispatch('error', 'Failed to remove old init script from server: '.$e->getMessage()); return; @@ -245,7 +249,7 @@ class General extends Component $command = "rm -f $file_path"; try { instant_remote_process([$command], $this->server); - } catch (\Exception $e) { + } catch (Exception $e) { $this->dispatch('error', 'Failed to remove init script from server: '.$e->getMessage()); return; @@ -262,16 +266,11 @@ class General extends Component $this->database->init_scripts = $updatedScripts; $this->database->save(); - $this->refresh(); + $this->dispatch('refresh')->self(); $this->dispatch('success', 'Init script deleted from the database and the server.'); } } - public function refresh(): void - { - $this->database->refresh(); - } - public function save_new_init_script() { $this->validate([ diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php index 16519e287..455367aa0 100644 --- a/app/Livewire/Project/Database/Redis/General.php +++ b/app/Livewire/Project/Database/Redis/General.php @@ -8,6 +8,7 @@ use App\Helpers\SslHelper; use App\Models\Server; use App\Models\SslCertificate; use App\Models\StandaloneRedis; +use Auth; use Carbon\Carbon; use Exception; use Livewire\Component; @@ -35,6 +36,16 @@ class General extends Component public ?Carbon $certificateValidUntil = null; + public function getListeners() + { + $userId = Auth::id(); + + return [ + "echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh', + 'refresh' => '$refresh', + ]; + } + protected $rules = [ 'database.name' => 'required', 'database.description' => 'nullable', diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.php index b75cedaae..feb4bf343 100644 --- a/app/View/Components/Forms/Select.php +++ b/app/View/Components/Forms/Select.php @@ -18,6 +18,7 @@ class Select extends Component public ?string $label = null, public ?string $helper = null, public bool $required = false, + public bool $disabled = false, public string $defaultClass = 'select w-full' ) { // diff --git a/resources/css/app.css b/resources/css/app.css index 175ac3259..815eb2abe 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -46,7 +46,7 @@ body { .input, .select { - @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset; + @apply text-black dark:bg-coolgray-100 dark:text-white ring-neutral-200 dark:ring-coolgray-300 block w-full py-1.5 rounded border-0 text-sm ring-1 ring-inset disabled:dark:bg-coolgray-100/40 disabled:dark:ring-transparent disabled:bg-neutral-200 disabled:text-neutral-500; } .select { @@ -97,6 +97,7 @@ label { @apply dark:text-neutral-400; } + table { @apply min-w-full divide-y dark:divide-coolgray-200 divide-neutral-300; } diff --git a/resources/views/components/forms/select.blade.php b/resources/views/components/forms/select.blade.php index 4da9eca1b..508a85e0c 100644 --- a/resources/views/components/forms/select.blade.php +++ b/resources/views/components/forms/select.blade.php @@ -1,6 +1,7 @@
@if ($label) -
diff --git a/resources/views/livewire/project/database/keydb/general.blade.php b/resources/views/livewire/project/database/keydb/general.blade.php index 58a41c289..065303f75 100644 --- a/resources/views/livewire/project/database/keydb/general.blade.php +++ b/resources/views/livewire/project/database/keydb/general.blade.php @@ -53,34 +53,39 @@

SSL Configuration

- @if($database->enable_ssl && $certificateValidUntil) - + submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" /> @endif
- @if($database->enable_ssl && $certificateValidUntil) - Valid until: - @if(now()->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired - @elseif(now()->addDays(30)->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon - @else - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - @endif + @if ($database->enable_ssl && $certificateValidUntil) + Valid until: + @if (now()->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired + @elseif(now()->addDays(30)->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring + soon + @else + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} + @endif @endif
- +
+ @if (str($database->status)->contains('exited')) + + @else + + @endif +
diff --git a/resources/views/livewire/project/database/mariadb/general.blade.php b/resources/views/livewire/project/database/mariadb/general.blade.php index 96ba3a06a..6186e4a82 100644 --- a/resources/views/livewire/project/database/mariadb/general.blade.php +++ b/resources/views/livewire/project/database/mariadb/general.blade.php @@ -70,36 +70,44 @@

SSL Configuration

- @if($database->enable_ssl && $certificateValidUntil) - + @if ($database->enable_ssl && $certificateValidUntil) + @endif
- @if($database->enable_ssl && $certificateValidUntil) - Valid until: - @if(now()->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired - @elseif(now()->addDays(30)->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon - @else - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - @endif + @if ($database->enable_ssl && $certificateValidUntil) + Valid until: + @if (now()->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired + @elseif(now()->addDays(30)->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring + soon + @else + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} + @endif @endif
- +
+ @if (str($database->status)->contains('exited')) + + @else + + @endif +
- +
diff --git a/resources/views/livewire/project/database/mongodb/general.blade.php b/resources/views/livewire/project/database/mongodb/general.blade.php index 4e353306a..83c7f5304 100644 --- a/resources/views/livewire/project/database/mongodb/general.blade.php +++ b/resources/views/livewire/project/database/mongodb/general.blade.php @@ -85,52 +85,73 @@
- + {{ $database->status }} + +
+ @if (str($database->status)->contains('exited')) + + @else + + @endif +
@if ($database->enable_ssl)
- - - - - - + @if (str($database->status)->contains('exited')) + + + + + + + @else + + + + + + + @endif
@endif
-
-
-
-
-
-

Proxy

- +
+
+
+
+

Proxy

+ +
+ @if (data_get($database, 'is_public')) + + Proxy Logs + + + + Logs + + @endif
- @if (data_get($database, 'is_public')) - - Proxy Logs - - - - Logs - - @endif +
- + +
+ +

Advanced

+
+
- -
- -

Advanced

-
- -
diff --git a/resources/views/livewire/project/database/mysql/general.blade.php b/resources/views/livewire/project/database/mysql/general.blade.php index 2a02dd9cd..c9090a4db 100644 --- a/resources/views/livewire/project/database/mysql/general.blade.php +++ b/resources/views/livewire/project/database/mysql/general.blade.php @@ -95,19 +95,38 @@
- +
+ @if (str($database->status)->contains('exited')) + + @else + + @endif +
@if ($database->enable_ssl)
- - - - - - + @if (str($database->status)->contains('exited')) + + + + + + + @else + + + + + + + @endif
@endif
diff --git a/resources/views/livewire/project/database/postgresql/general.blade.php b/resources/views/livewire/project/database/postgresql/general.blade.php index b90836ce8..92e011622 100644 --- a/resources/views/livewire/project/database/postgresql/general.blade.php +++ b/resources/views/livewire/project/database/postgresql/general.blade.php @@ -102,52 +102,72 @@
- +
+ @if ($database->isExited()) + + @else + + @endif +
@if ($database->enable_ssl)
- - - - - - - + @if ($database->isExited()) + + + + + + + + @else + + + + + + + + @endif
@endif -
-
-
-
-
-

Proxy

- +
+
+
+

Proxy

+ +
+ @if (data_get($database, 'is_public')) + + Proxy Logs + + + + Logs + + @endif +
+
+ + +
- @if (data_get($database, 'is_public')) - - Proxy Logs - - - - Logs - - @endif -
-
- - -
-
-
- -
+
+ +
diff --git a/resources/views/livewire/project/database/redis/general.blade.php b/resources/views/livewire/project/database/redis/general.blade.php index a6cae8e38..20acf52c0 100644 --- a/resources/views/livewire/project/database/redis/general.blade.php +++ b/resources/views/livewire/project/database/redis/general.blade.php @@ -53,34 +53,39 @@

SSL Configuration

- @if($database->enable_ssl && $certificateValidUntil) - + submitAction="regenerateSslCertificate" :confirmWithText="false" :confirmWithPassword="false" /> @endif
- @if($database->enable_ssl && $certificateValidUntil) - Valid until: - @if(now()->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired - @elseif(now()->addDays(30)->gt($certificateValidUntil)) - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring soon - @else - {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - @endif + @if ($database->enable_ssl && $certificateValidUntil) + Valid until: + @if (now()->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expired + @elseif(now()->addDays(30)->gt($certificateValidUntil)) + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} - Expiring + soon + @else + {{ $certificateValidUntil->format('d.m.Y H:i:s') }} + @endif @endif
- +
+ @if (str($database->status)->contains('exited')) + + @else + + @endif +