Files
coolify/app/Livewire/DeploymentsIndicator.php
T
Andras Bacsai 0a567cb8e7 feat(backups): refresh backup views live on team channel events
- Refresh application, database and volume backup lists on BackupCreated
- Refresh backup execution, edit and service resource views on
  ServiceStatusChanged as well as ServiceChecked
- Hide the deployments counter when only the current page's application
  is deploying, since its heading already shows "Deploying…"
- Show storage section shortcuts in the service configuration sidebar
- Drive server sidebar Sentinel/Security active state from activeMenu
  and activeSubMenu instead of route matching
- Start the app sidebar expanded for new users
- Drop a column from the backup executions table grid and adjust the
  responsive breakpoints
- Update the related feature tests
2026-10-15 14:10:14 +02:00

71 lines
1.9 KiB
PHP

<?php
namespace App\Livewire;
use App\Models\ApplicationDeploymentQueue;
use App\Models\Server;
use Livewire\Attributes\Computed;
use Livewire\Attributes\Locked;
use Livewire\Component;
class DeploymentsIndicator extends Component
{
/**
* Where the indicator is rendered: 'topbar' (desktop top bar) or 'mobile' (mobile top bar).
*/
public string $variant = 'topbar';
/**
* The application on the current page. Its heading has its own "Deploying…" indicator.
*/
#[Locked]
public ?string $currentApplicationUuid = null;
public function mount(): void
{
$this->currentApplicationUuid = request()->route('application_uuid');
}
#[Computed]
public function deployments()
{
$servers = Server::ownedByCurrentTeamCached();
return ApplicationDeploymentQueue::with(['application.environment.project'])
->whereIn('status', ['in_progress', 'queued'])
->whereIn('server_id', $servers->pluck('id'))
->orderBy('id')
->get([
'id',
'application_id',
'application_name',
'deployment_url',
'pull_request_id',
'server_name',
'server_id',
'status',
]);
}
#[Computed]
public function deploymentCount()
{
return $this->deployments->count();
}
/**
* Hide the counter when it would only repeat the current page's "Deploying…" indicator.
*/
#[Computed]
public function isOnlyCurrentApplicationDeploying(): bool
{
return $this->currentApplicationUuid !== null
&& $this->deployments->every(fn ($deployment) => $deployment->application?->uuid === $this->currentApplicationUuid);
}
public function render()
{
return view('livewire.deployments-indicator');
}
}