fix(services): update resource card status together with the heading badge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-11-05 09:51:52 +01:00
co-authored by Claude Opus 5.5
parent 455b22f26c
commit 4d932b3078
3 changed files with 40 additions and 8 deletions
+26
View File
@@ -35,11 +35,18 @@ class Heading extends Component
public $title = 'Configuration';
/**
* The container statuses of the stack resources at the last check.
* The heading polls them, so it tells the resource cards when they change.
*/
public ?string $resourceStatuses = null;
public function mount()
{
$this->authorizeService('view');
$this->checkDeployments();
$this->resourceStatuses = $this->currentResourceStatuses();
if (str($this->service->status)->contains('running') && is_null($this->service->config_hash)) {
$this->service->isConfigurationChanged(true);
@@ -64,6 +71,7 @@ class Heading extends Component
$this->authorizeService('view');
$this->checkDeployments();
$this->dispatchIfResourceStatusesChanged();
if ($this->service->server->isFunctional()) {
GetContainersStatus::dispatch($this->service->server);
@@ -72,6 +80,24 @@ class Heading extends Component
}
}
private function dispatchIfResourceStatusesChanged(): void
{
$statuses = $this->currentResourceStatuses();
if ($statuses === $this->resourceStatuses) {
return;
}
$this->resourceStatuses = $statuses;
$this->dispatch('serviceResourceStatusesChanged');
}
private function currentResourceStatuses(): string
{
return $this->service->applications->pluck('status', 'uuid')
->merge($this->service->databases->pluck('status', 'uuid'))
->toJson();
}
public function manualCheckStatus()
{
$this->checkStatus();
@@ -23,10 +23,13 @@ class ResourceCard extends Component
public function getListeners(): array
{
return $this->teamChannelListeners([
'ServiceStatusChanged' => 'refreshResource',
'ServiceChecked' => 'refreshResource',
]);
return [
'serviceResourceStatusesChanged' => 'refreshResource',
...$this->teamChannelListeners([
'ServiceStatusChanged' => 'refreshResource',
'ServiceChecked' => 'refreshResource',
]),
];
}
public function refreshResource(): void
+7 -4
View File
@@ -22,10 +22,13 @@ class Status extends Component
public function getListeners(): array
{
return $this->teamChannelListeners([
'ServiceStatusChanged' => 'refreshStatus',
'ServiceChecked' => 'refreshStatus',
]);
return [
'serviceResourceStatusesChanged' => 'refreshStatus',
...$this->teamChannelListeners([
'ServiceStatusChanged' => 'refreshStatus',
'ServiceChecked' => 'refreshStatus',
]),
];
}
public function refreshStatus(): void