mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
chore: Images
This commit is contained in:
parent
0e2820f190
commit
4f7631c976
4 changed files with 127 additions and 12 deletions
|
|
@ -174,7 +174,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||
$this->build_pack = data_get($this->application, 'build_pack');
|
||||
$this->build_args = collect([]);
|
||||
|
||||
$this->dockerRegistry = DockerRegistry::find($this->application->docker_registry_id);
|
||||
if ($this->application->docker_registry_id) {
|
||||
$this->dockerRegistry = DockerRegistry::find($this->application->docker_registry_id);
|
||||
}
|
||||
|
||||
$this->application_deployment_queue_id = $application_deployment_queue_id;
|
||||
$this->deployment_uuid = $this->application_deployment_queue->deployment_uuid;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,64 @@
|
|||
|
||||
namespace App\Livewire\Images\Images;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class Index extends Component
|
||||
{
|
||||
public string $selected_uuid = 'default';
|
||||
public array $serverImages = [];
|
||||
public Collection $servers;
|
||||
public bool $isLoadingImages = false;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (!auth()->user()->isAdmin()) {
|
||||
abort(403);
|
||||
}
|
||||
$this->servers = Server::isReachable()->get();
|
||||
}
|
||||
|
||||
//Zove se automatski kad se na fronti selecta server
|
||||
public function updatedSelectedUuid()
|
||||
{
|
||||
$this->loadServerImages();
|
||||
}
|
||||
|
||||
public function loadServerImages()
|
||||
{
|
||||
$this->isLoadingImages = true;
|
||||
|
||||
try {
|
||||
if ($this->selected_uuid === 'default') {
|
||||
dd('Please select a server.');
|
||||
return;
|
||||
}
|
||||
|
||||
$server = $this->servers->firstWhere('uuid', $this->selected_uuid);
|
||||
if (!$server) {
|
||||
dd('Server not found');
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. Koristi instant_remote_process "docker images"
|
||||
// 2. Parse output u $serverImages array
|
||||
// 3. repository, tag, id, size, created_at
|
||||
|
||||
} catch (\Exception $e) {
|
||||
dd("Error loading docker images: " . $e->getMessage());
|
||||
} finally {
|
||||
$this->isLoadingImages = false;
|
||||
}
|
||||
}
|
||||
public function getImageDetails($imageId) {}
|
||||
|
||||
public function deleteImage($imageId) {}
|
||||
|
||||
public function pruneUnused() {}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.images.images.index');
|
||||
|
|
|
|||
|
|
@ -1,16 +1,75 @@
|
|||
<div>
|
||||
<x-images.navbar />
|
||||
<div class="flex gap-2">
|
||||
<h2 class="pb-4">Images</h2>
|
||||
<x-modal-input buttonTitle="+ Add" disabled title="New Image">
|
||||
<livewire:security.private-key.create />
|
||||
</x-modal-input>
|
||||
<div class="space-y-4">
|
||||
<x-images.navbar />
|
||||
|
||||
</div>
|
||||
{{-- Images Tab Content --}}
|
||||
<div x-show="$wire.activeTab === 'images'" x-cloak>
|
||||
<div class="text-gray-500">
|
||||
Image management coming soon...
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="flex items-center gap-2">
|
||||
<h2>Docker Images</h2>
|
||||
<form class="flex items-center gap-2" wire:submit="loadServerImages">
|
||||
<x-forms.select id="server" required wire:model.live="selected_uuid">
|
||||
@foreach ($servers as $server)
|
||||
@if ($loop->first)
|
||||
<option disabled value="default">Select a server</option>
|
||||
@endif
|
||||
<option value="{{ $server->uuid }}">{{ $server->name }}</option>
|
||||
@endforeach
|
||||
</x-forms.select>
|
||||
<x-forms.button type="submit" wire:loading.attr="disabled">
|
||||
<span wire:loading.remove wire:target="loadServerImages">Refresh</span>
|
||||
<span wire:loading wire:target="loadServerImages">Loading...</span>
|
||||
</x-forms.button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div wire:loading.block wire:target="loadServerImages" class="text-center py-4">
|
||||
<x-loading text="Loading images..." />
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="loadServerImages">
|
||||
@if ($selected_uuid !== 'default')
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
||||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Repository</th>
|
||||
<th
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Tag</th>
|
||||
<th
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Image ID</th>
|
||||
<th
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
|
||||
{{-- TODO: Implement image listing logic --}}
|
||||
{{-- Example row structure:
|
||||
<tr class="hover:bg-gray-50 dark:hover:bg-gray-800">
|
||||
<td class="px-6 py-4 whitespace-nowrap">repository_name</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">tag</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap font-mono text-sm">image_id</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex gap-2">
|
||||
<x-forms.button>Details</x-forms.button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
--}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<div class="text-center py-4 text-gray-500">
|
||||
Please select a server to view images
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue