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 @@