"live" headerActions

So i have a SimplePage used to display the console problem is actions are not live

I want to "live" disable/enable the start button once the server is 'starting' / 'running'; change stop to kill once the server's is 'stopping' and disable stop if server is 'offline'

protected function getHeaderActions(): array
    {
        /** @var Server $server */
        $server = Filament::getTenant();

        return [
            Action::make('start')
                ->color('primary')
                ->action(fn () => $this->dispatch('setServerState', state: 'start'))
                ->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() === 'starting' || $server->retrieveStatus() === 'running'),
            Action::make('restart')
                ->color('gray')
                ->action(fn () => $this->dispatch('setServerState', state: 'restart'))
                ->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() === 'offline'),
            Action::make('stop')
                ->label(fn () => $server->retrieveStatus() === 'stopping' ? 'kill' : 'stop')
                ->color('danger')
                ->action(fn () => $this->dispatch('setServerState', state: $server->retrieveStatus() === 'stopping' ? 'kill' : 'stop'))
                ->disabled(fn () => $server->isInConflictState() || $server->retrieveStatus() === 'offline'),
        ];
    }

Also tried with two different actions & hidden/visible without much success either
image.png
Was this page helpful?