diff --git a/app/Actions/Service/StopService.php b/app/Actions/Service/StopService.php index b2516eefb..f7de50165 100644 --- a/app/Actions/Service/StopService.php +++ b/app/Actions/Service/StopService.php @@ -4,7 +4,6 @@ namespace App\Actions\Service; use Lorisleiva\Actions\Concerns\AsAction; use App\Models\Service; -use App\Notifications\Application\StatusChanged; class StopService { diff --git a/app/Http/Livewire/Project/Service/Index.php b/app/Http/Livewire/Project/Service/Index.php index 2cc0d6404..79d933369 100644 --- a/app/Http/Livewire/Project/Service/Index.php +++ b/app/Http/Livewire/Project/Service/Index.php @@ -13,7 +13,7 @@ class Index extends Component public $databases; public array $parameters; public array $query; - protected $listeners = ["refreshStacks"]; + protected $listeners = ["refreshStacks", "checkStatus"]; public function render() { return view('livewire.project.service.index'); diff --git a/app/Http/Livewire/Project/Service/Navbar.php b/app/Http/Livewire/Project/Service/Navbar.php index 8c17c3307..23ad062a5 100644 --- a/app/Http/Livewire/Project/Service/Navbar.php +++ b/app/Http/Livewire/Project/Service/Navbar.php @@ -4,7 +4,6 @@ namespace App\Http\Livewire\Project\Service; use App\Actions\Service\StartService; use App\Actions\Service\StopService; -use App\Jobs\ContainerStatusJob; use App\Models\Service; use Livewire\Component; @@ -13,12 +12,15 @@ class Navbar extends Component public Service $service; public array $parameters; public array $query; + protected $listeners = ["checkStatus"]; public function render() { return view('livewire.project.service.navbar'); } - + public function checkStatus() { + $this->service->refresh(); + } public function deploy() { $this->service->parse(); @@ -30,6 +32,6 @@ class Navbar extends Component StopService::run($this->service); $this->service->refresh(); $this->emit('success', 'Service stopped successfully.'); - $this->checkStatus(); + $this->emit('checkStatus'); } } diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 163f4449d..22c337dbd 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -25,6 +25,9 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted public function __construct(public Server $server) { + if (isDev()) { + $this->handle(); + } } public function middleware(): array { diff --git a/app/Jobs/StopResourceJob.php b/app/Jobs/StopResourceJob.php index 76c5588b8..984dc0904 100644 --- a/app/Jobs/StopResourceJob.php +++ b/app/Jobs/StopResourceJob.php @@ -57,11 +57,10 @@ class StopResourceJob implements ShouldQueue, ShouldBeEncrypted StopService::run($this->resource); break; } + $this->resource->delete(); } catch (\Throwable $e) { send_internal_notification('ContainerStoppingJob failed with: ' . $e->getMessage()); throw $e; - } finally { - $this->resource->delete(); } } } diff --git a/app/Models/Service.php b/app/Models/Service.php index 09aa88a3e..f4db5de72 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -40,7 +40,6 @@ class Service extends BaseModel instant_remote_process(["docker volume rm -f $storage->name"], $service->server, false); }); } - instant_remote_process(["docker network rm {$service->uuid}"], $service->server, false); }); } public function type()