mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-28 09:34:36 +08:00
Add a /dashboard/canvas page that renders every team server with its resources and their running or queued deployments, backed by a new ServerCanvasController::dashboard endpoint and a per-server usage endpoint for zone headers. The dashboard remembers the list/canvas choice and each section (projects, servers) its own table/grid view. - Show Deploying/Queued pills on canvas cards and a foldable recent deployments panel; add shared CanvasControls component - Allow backup downloads from the server host via the S3 download storage (PrepareFileDownloadJob accepts a null container) - Extract backup toggle/run actions into ManagesDatabaseBackup and surface them in backup execution headers; merge S3 and retention sections into the general backup settings - Move deployments indicator to the top bar and add a main nav resource menu with submenus; simplify breadcrumbs and settings layouts - Add shared variables overview canvas and scheduled task modals - Add feature tests for dashboard canvas, view modes, navbar submenus, backup S3 downloads and scheduled task modals
95 lines
2.5 KiB
PHP
95 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Shared\ScheduledTask;
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Support\Collection;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Attributes\On;
|
|
use Livewire\Attributes\Url;
|
|
use Livewire\Component;
|
|
|
|
class All extends Component
|
|
{
|
|
use AuthorizesRequests;
|
|
|
|
#[Locked]
|
|
public $resource;
|
|
|
|
#[Locked]
|
|
public array $parameters;
|
|
|
|
public Collection $containerNames;
|
|
|
|
public ?string $variables = null;
|
|
|
|
#[Url(as: 'task_uuid', except: '')]
|
|
public string $taskUuid = '';
|
|
|
|
public bool $taskModalOpen = false;
|
|
|
|
public function getListeners(): array
|
|
{
|
|
return [
|
|
'modalClosed' => 'closeTask',
|
|
];
|
|
}
|
|
|
|
public function mount()
|
|
{
|
|
$this->parameters = get_route_parameters();
|
|
if ($this->resource->type() === 'service') {
|
|
$this->containerNames = $this->resource->applications()->pluck('name');
|
|
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
|
} elseif ($this->resource->type() === 'application') {
|
|
if ($this->resource->build_pack === 'dockercompose') {
|
|
$parsed = $this->resource->parse();
|
|
$containers = collect(data_get($parsed, 'services'))->keys();
|
|
$this->containerNames = $containers;
|
|
} else {
|
|
$this->containerNames = collect([]);
|
|
}
|
|
}
|
|
|
|
if ($this->taskUuid !== '') {
|
|
$this->openTask($this->taskUuid);
|
|
}
|
|
}
|
|
|
|
public function openTask(string $taskUuid): void
|
|
{
|
|
$this->authorize('view', $this->resource);
|
|
$this->taskUuid = $this->resource->scheduled_tasks()->where('uuid', $taskUuid)->firstOrFail()->uuid;
|
|
$this->taskModalOpen = true;
|
|
}
|
|
|
|
public function closeTask(): void
|
|
{
|
|
$this->taskUuid = '';
|
|
$this->taskModalOpen = false;
|
|
$this->resource->refresh();
|
|
}
|
|
|
|
#[On('scheduledTaskDeleted')]
|
|
public function taskDeleted(): void
|
|
{
|
|
$this->closeTask();
|
|
}
|
|
|
|
#[On('refreshTasks')]
|
|
public function refreshTasks()
|
|
{
|
|
$this->resource->refresh();
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.project.shared.scheduled-task.all', [
|
|
'selectedTask' => $this->taskUuid === ''
|
|
? null
|
|
: $this->resource->scheduled_tasks()->where('uuid', $this->taskUuid)->first(),
|
|
]);
|
|
}
|
|
}
|