diff --git a/app/Livewire/Project/Service/Configuration.php b/app/Livewire/Project/Service/Configuration.php index eb72c803c..cdedb3f8e 100644 --- a/app/Livewire/Project/Service/Configuration.php +++ b/app/Livewire/Project/Service/Configuration.php @@ -36,6 +36,30 @@ public function mount() $this->applications = $this->service->applications->sort(); $this->databases = $this->service->databases->sort(); } + public function restartApplication($id) + { + try { + $application = $this->service->applications->find($id); + if ($application) { + $application->restart(); + $this->dispatch('success', 'Application restarted successfully.'); + } + } catch (\Exception $e) { + return handleError($e, $this); + } + } + public function restartDatabase($id) + { + try { + $database = $this->service->databases->find($id); + if ($database) { + $database->restart(); + $this->dispatch('success', 'Database restarted successfully.'); + } + } catch (\Exception $e) { + return handleError($e, $this); + } + } public function check_status() { try { diff --git a/app/Models/ServiceApplication.php b/app/Models/ServiceApplication.php index 37f7d9c9c..820ef6fee 100644 --- a/app/Models/ServiceApplication.php +++ b/app/Models/ServiceApplication.php @@ -19,6 +19,11 @@ protected static function booted() $service->fileStorages()->delete(); }); } + public function restart() + { + $container_id = $this->name . '-' . $this->service->uuid; + instant_remote_process(["docker restart {$container_id}"], $this->service->server); + } public function isLogDrainEnabled() { return data_get($this, 'is_log_drain_enabled', false); diff --git a/app/Models/ServiceDatabase.php b/app/Models/ServiceDatabase.php index 9375fe807..9e9e9d202 100644 --- a/app/Models/ServiceDatabase.php +++ b/app/Models/ServiceDatabase.php @@ -17,6 +17,11 @@ protected static function booted() $service->fileStorages()->delete(); }); } + public function restart() + { + $container_id = $this->name . '-' . $this->service->uuid; + remote_process(["docker restart {$container_id}"], $this->service->server); + } public function isLogDrainEnabled() { return data_get($this, 'is_log_drain_enabled', false); diff --git a/resources/css/app.css b/resources/css/app.css index efeb4af7c..f03e7e850 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -41,7 +41,7 @@ option { } .button { - @apply flex items-center justify-center gap-2 px-3 py-1 text-sm font-normal normal-case rounded cursor-pointer bg-neutral-200 hover:bg-neutral-300 dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100 dark:hover:dark:text-white dark:disabled:bg-coolgray-100/40 dark:disabled:text-neutral-800 min-w-fit hover:dark:text-white focus-visible:outline-none; + @apply flex items-center justify-center gap-2 px-3 py-1 text-sm font-normal normal-case rounded cursor-pointer bg-neutral-200 hover:bg-neutral-300 dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100 dark:hover:dark:text-white dark:disabled:bg-coolgray-100/40 dark:disabled:text-neutral-800 disabled:bg-neutral-100 disabled:text-neutral-200 disabled:cursor-not-allowed min-w-fit hover:dark:text-white focus:outline-1 ; } button[isError]:not(:disabled) { @@ -195,7 +195,7 @@ .on-box { } .box-without-bg { - @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem] dark:border-black border-neutral-200; + @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem]; } .box-title { diff --git a/resources/views/components/helper.blade.php b/resources/views/components/helper.blade.php index 378892b85..43c49491d 100644 --- a/resources/views/components/helper.blade.php +++ b/resources/views/components/helper.blade.php @@ -1,4 +1,4 @@ -