diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 31c429113..8f66c12cf 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -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; diff --git a/app/Livewire/Images/Images/Create.php b/app/Livewire/Images/Images/Create.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/Livewire/Images/Images/Index.php b/app/Livewire/Images/Images/Index.php index 4126ebddf..a04e28ec1 100644 --- a/app/Livewire/Images/Images/Index.php +++ b/app/Livewire/Images/Images/Index.php @@ -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'); diff --git a/resources/views/livewire/images/images/index.blade.php b/resources/views/livewire/images/images/index.blade.php index c97d65a2a..4fc5fef47 100644 --- a/resources/views/livewire/images/images/index.blade.php +++ b/resources/views/livewire/images/images/index.blade.php @@ -1,16 +1,75 @@
- -
-

Images

- - - +
+ -
- {{-- Images Tab Content --}} -
-
- Image management coming soon... +
+
+

Docker Images

+
+ + @foreach ($servers as $server) + @if ($loop->first) + + @endif + + @endforeach + + + Refresh + Loading... + +
+
+
+ +
+
+ +
+ +
+ @if ($selected_uuid !== 'default') +
+ + + + + + + + + + + {{-- TODO: Implement image listing logic --}} + {{-- Example row structure: + + + + + + + --}} + +
+ Repository + Tag + Image ID + Actions
repository_nametagimage_id +
+ Details +
+
+
+ @else +
+ Please select a server to view images +
+ @endif +