mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-22 06:23:28 +00:00
feat(terminal): lazy-load targets and polish theme UI
Defer container loading with wire:init and a containersLoaded gate, add autoStart/starting session state, extract a shared theme selector, and restyle terminal headers, pickers, and fullscreen chrome. Cover the new packaging and header behavior in feature tests.
This commit is contained in:
@@ -29,13 +29,15 @@ class ExecuteContainerCommand extends Component
|
||||
|
||||
public bool $isConnecting = false;
|
||||
|
||||
public bool $containersLoaded = false;
|
||||
|
||||
protected $rules = [
|
||||
'server' => 'required',
|
||||
'container' => 'required',
|
||||
'command' => 'required',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
public function mount(): void
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->containers = collect();
|
||||
@@ -52,7 +54,6 @@ class ExecuteContainerCommand extends Component
|
||||
$this->servers = $this->servers->push($server);
|
||||
}
|
||||
}
|
||||
$this->loadContainers();
|
||||
} elseif (data_get($this->parameters, 'database_uuid')) {
|
||||
$this->type = 'database';
|
||||
$resource = getResourceByUuid($this->parameters['database_uuid'], data_get(auth()->user()->currentTeam(), 'id'));
|
||||
@@ -64,7 +65,6 @@ class ExecuteContainerCommand extends Component
|
||||
if ($this->resource->destination->server->isFunctional()) {
|
||||
$this->servers = $this->servers->push($this->resource->destination->server);
|
||||
}
|
||||
$this->loadContainers();
|
||||
} elseif (data_get($this->parameters, 'service_uuid')) {
|
||||
$this->type = 'service';
|
||||
$this->resource = Service::ownedByCurrentTeam()->where('uuid', $this->parameters['service_uuid'])->firstOrFail();
|
||||
@@ -72,18 +72,22 @@ class ExecuteContainerCommand extends Component
|
||||
if ($this->resource->server->isFunctional()) {
|
||||
$this->servers = $this->servers->push($this->resource->server);
|
||||
}
|
||||
$this->loadContainers();
|
||||
} elseif (data_get($this->parameters, 'server_uuid')) {
|
||||
$this->type = 'server';
|
||||
$this->resource = Server::ownedByCurrentTeam()->where('uuid', $this->parameters['server_uuid'])->firstOrFail();
|
||||
$this->authorize('view', $this->resource);
|
||||
$this->servers = $this->servers->push($this->resource);
|
||||
$this->containersLoaded = true;
|
||||
}
|
||||
$this->servers = $this->servers->sortByDesc(fn ($server) => $server->isTerminalEnabled());
|
||||
}
|
||||
|
||||
public function loadContainers()
|
||||
public function loadContainers(): void
|
||||
{
|
||||
if ($this->containersLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->servers as $server) {
|
||||
if (data_get($this->parameters, 'application_uuid')) {
|
||||
if ($server->isSwarm()) {
|
||||
@@ -145,7 +149,10 @@ class ExecuteContainerCommand extends Component
|
||||
|
||||
if ($this->containers->count() === 1) {
|
||||
$this->selected_container = data_get($this->containers->first(), 'container.Names');
|
||||
$this->connectToContainer();
|
||||
}
|
||||
|
||||
$this->containersLoaded = true;
|
||||
}
|
||||
|
||||
public function updatedSelectedContainer()
|
||||
|
||||
Reference in New Issue
Block a user