Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: service container status updates

Andras Bacsai5322d446bdc2
diff --git a/app/Livewire/Project/Application/Configuration.php b/app/Livewire/Project/Application/Configuration.php
index b095ab54d2..832f0fcc3d 100644
--- a/app/Livewire/Project/Application/Configuration.php
+++ b/app/Livewire/Project/Application/Configuration.php
@@ -10,7 +10,7 @@ class Configuration extends Component
{
public Application $application;
public $servers;
- protected $listeners = ['build_pack_updated' => '$refresh'];
+ protected $listeners = ['buildPackUpdated' => '$refresh'];
public function mount()
{
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php
index 37b6502813..b3c565fdd0 100644
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@ -182,7 +182,7 @@ class General extends Component
$this->resetDefaultLabels(false);
}
$this->submit();
- $this->dispatch('build_pack_updated');
+ $this->dispatch('buildPackUpdated');
}
public function getWildcardDomain()
{
diff --git a/app/Livewire/Project/Service/Configuration.php b/app/Livewire/Project/Service/Configuration.php
index afbdd47bc7..33aac21d02 100644
--- a/app/Livewire/Project/Service/Configuration.php
+++ b/app/Livewire/Project/Service/Configuration.php
@@ -17,9 +17,7 @@ class Configuration extends Component
{
$userId = auth()->user()->id;
return [
- "echo-private:user.{$userId},ServiceStatusChanged" => 'checkStatus',
- "refreshStacks",
- "checkStatus",
+ "echo-private:user.{$userId},ServiceStatusChanged" => 'check_status',
];
}
public function render()
@@ -37,21 +35,10 @@ class Configuration extends Component
$this->applications = $this->service->applications->sort();
$this->databases = $this->service->databases->sort();
}
- public function checkStatus()
+ public function check_status()
{
dispatch_sync(new ContainerStatusJob($this->service->server));
- $this->refreshStacks();
+ $this->dispatch('refresh')->self();
$this->dispatch('serviceStatusChanged');
}
- public function refreshStacks()
- {
- $this->applications = $this->service->applications->sort();
- $this->applications->each(function ($application) {
- $application->refresh();
- });
- $this->databases = $this->service->databases->sort();
- $this->databases->each(function ($database) {
- $database->refresh();
- });
- }
}
diff --git a/app/Livewire/Project/Service/Navbar.php b/app/Livewire/Project/Service/Navbar.php
index 5640084b94..70c304de04 100644
--- a/app/Livewire/Project/Service/Navbar.php
+++ b/app/Livewire/Project/Service/Navbar.php
@@ -17,17 +17,6 @@ class Navbar extends Component
public array $parameters;
public array $query;
public $isDeploymentProgress = false;
-
- public function checkDeployments()
- {
- $activity = Activity::where('properties->type_uuid', $this->service->uuid)->latest()->first();
- $status = data_get($activity, 'properties.status');
- if ($status === 'queued' || $status === 'in_progress') {
- $this->isDeploymentProgress = true;
- } else {
- $this->isDeploymentProgress = false;
- }
- }
public function getListeners()
{
return [
@@ -36,17 +25,21 @@ class Navbar extends Component
}
public function serviceStatusChanged()
{
- $this->service->refresh();
+ $this->dispatch('refresh')->self();
}
public function render()
{
return view('livewire.project.service.navbar');
}
- public function check_status($showNotification = false)
+ public function checkDeployments()
{
- dispatch_sync(new ContainerStatusJob($this->service->destination->server));
- $this->service->refresh();
- if ($showNotification) $this->dispatch('success', 'Service status updated.');
+ $activity = Activity::where('properties->type_uuid', $this->service->uuid)->latest()->first();
+ $status = data_get($activity, 'properties.status');
+ if ($status === 'queued' || $status === 'in_progress') {
+ $this->isDeploymentProgress = true;
+ } else {
+ $this->isDeploymentProgress = false;
+ }
}
public function deploy()
{
@@ -62,7 +55,6 @@ class Navbar extends Component
public function stop(bool $forceCleanup = false)
{
StopService::run($this->service);
- $this->service->refresh();
if ($forceCleanup) {
$this->dispatch('success', 'Containers cleaned up.');
} else {
diff --git a/resources/views/livewire/project/database/heading.blade.php b/resources/views/livewire/project/database/heading.blade.php
index 0a9734810a..11202c8a83 100644
--- a/resources/views/livewire/project/database/heading.blade.php
+++ b/resources/views/livewire/project/database/heading.blade.php
@@ -1,4 +1,4 @@
-<nav wire:poll.30000ms="check_status">
+<nav wire:poll.5000ms="check_status">
<x-resources.breadcrumbs :resource="$database" :parameters="$parameters" />
<x-databases.navbar :database="$database" :parameters="$parameters" />
</nav>
diff --git a/resources/views/livewire/project/service/configuration.blade.php b/resources/views/livewire/project/service/configuration.blade.php
index 2c197c9f45..d0ecda0a32 100644
--- a/resources/views/livewire/project/service/configuration.blade.php
+++ b/resources/views/livewire/project/service/configuration.blade.php
@@ -1,4 +1,4 @@
-<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }" x-init="$wire.checkStatus">
+<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }" x-init="$wire.check_status" wire:poll.5000ms="check_status">
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
<div class="flex h-full pt-6">
<div class="flex flex-col items-start gap-4 min-w-fit">
diff --git a/resources/views/livewire/project/shared/tags.blade.php b/resources/views/livewire/project/shared/tags.blade.php
index 45e6131ab9..ff56d149c6 100644
--- a/resources/views/livewire/project/shared/tags.blade.php
+++ b/resources/views/livewire/project/shared/tags.blade.php
@@ -11,7 +11,7 @@
</svg>
</div>
@empty
- <div>No tags yet</div>
+ <div class="py-1">No tags yet</div>
@endforelse
</div>
<form wire:submit='submit' class="flex items-end gap-2 pt-4">
@@ -23,8 +23,7 @@
<x-forms.button type="submit">Add</x-forms.button>
</form>
@if ($tags->count() > 0)
- <h3 class="pt-4">Already defined tags</h3>
- <div>Click to quickly add one.</div>
+ <h3 class="pt-4">Quickly Add</h3>
<div class="flex gap-2 pt-4">
@foreach ($tags as $tag)
<x-forms.button wire:click="addTag('{{ $tag->id }}','{{ $tag->name }}')">