mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-14 08:42:38 -04:00
- 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
59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Service;
|
|
|
|
use App\Models\Service;
|
|
use App\Models\ServiceApplication;
|
|
use App\Models\ServiceDatabase;
|
|
use App\Traits\ListensToTeamChannel;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Livewire\Component;
|
|
|
|
class ResourceCard extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
use ListensToTeamChannel;
|
|
|
|
public Service $service;
|
|
|
|
public ServiceApplication|ServiceDatabase $resource;
|
|
|
|
public array $parameters = [];
|
|
|
|
public function getListeners(): array
|
|
{
|
|
return $this->teamChannelListeners([
|
|
'ServiceStatusChanged' => 'refreshResource',
|
|
'ServiceChecked' => 'refreshResource',
|
|
]);
|
|
}
|
|
|
|
public function refreshResource(): void
|
|
{
|
|
$this->resource->refresh();
|
|
}
|
|
|
|
public function restart(): void
|
|
{
|
|
try {
|
|
$this->authorize('update', $this->service);
|
|
$this->resource->restart();
|
|
$message = $this->resource instanceof ServiceApplication
|
|
? 'Service application restarted successfully.'
|
|
: 'Service database restarted successfully.';
|
|
$this->dispatch('success', $message);
|
|
} catch (\Throwable $e) {
|
|
handleError($e, $this);
|
|
}
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.project.service.resource-card', [
|
|
'isApplication' => $this->resource instanceof ServiceApplication,
|
|
'isDatabase' => $this->resource instanceof ServiceDatabase,
|
|
]);
|
|
}
|
|
}
|