This commit is contained in:
Andras Bacsai 2023-11-05 09:49:23 +01:00
parent 0a5a101ef4
commit 6f673d7a07
6 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,6 @@
use Lorisleiva\Actions\Concerns\AsAction;
use App\Models\Service;
use App\Notifications\Application\StatusChanged;
class StopService
{

View File

@ -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');

View File

@ -4,7 +4,6 @@
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 @@ public function stop()
StopService::run($this->service);
$this->service->refresh();
$this->emit('success', 'Service stopped successfully.');
$this->checkStatus();
$this->emit('checkStatus');
}
}

View File

@ -25,6 +25,9 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
public function __construct(public Server $server)
{
if (isDev()) {
$this->handle();
}
}
public function middleware(): array
{

View File

@ -57,11 +57,10 @@ public function handle()
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();
}
}
}

View File

@ -40,7 +40,6 @@ protected static function booted()
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()