Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(source): conditionally display connected source and change source options based on private key presence

Andras Bacsaib71aec35a1de
diff --git a/resources/views/livewire/project/application/source.blade.php b/resources/views/livewire/project/application/source.blade.php
index 29c5c61427..ee217649ab 100644
--- a/resources/views/livewire/project/application/source.blade.php
+++ b/resources/views/livewire/project/application/source.blade.php
@@ -26,9 +26,11 @@
<div class="pb-4">Code source of your application.</div>
<div class="flex flex-col gap-2">
- <div>Currently connected source: <span
- class="font-bold text-warning">{{ $application->source->name }}</span>
- </div>
+ @if (!$privateKeyId)
+ <div>Currently connected source: <span
+ class="font-bold text-warning">{{ $application->source->name }}</span>
+ </div>
+ @endif
<div class="flex gap-2">
<x-forms.input placeholder="coollabsio/coolify-example" id="gitRepository" label="Repository" />
<x-forms.input placeholder="main" id="gitBranch" label="Branch" />
@@ -38,38 +40,6 @@
</div>
</div>
- <div class="pt-4">
- <h3 class="pb-2">Change Git Source</h3>
- <div class="grid grid-cols-1 gap-2">
- @forelse ($sources as $source)
- <div wire:key="{{ $source->name }}">
- <x-modal-confirmation title="Change Git Source" :actions="['Change git source to ' . $source->name]" :buttonFullWidth="true"
- :isHighlightedButton="$application->source_id === $source->id" :disabled="$application->source_id === $source->id"
- submitAction="changeSource({{ $source->id }}, {{ $source->getMorphClass() }})"
- :confirmWithText="true" confirmationText="Change Git Source"
- confirmationLabel="Please confirm changing the git source by entering the text below"
- shortConfirmationLabel="Confirmation Text" :confirmWithPassword="false">
- <x-slot:customButton>
- <div class="flex items-center gap-2">
- <div class="box-title">
- {{ $source->name }}
- @if ($application->source_id === $source->id)
- <span class="text-xs">(current)</span>
- @endif
- </div>
- <div class="box-description">
- {{ $source->organization ?? 'Personal Account' }}
- </div>
- </div>
- </x-slot:customButton>
- </x-modal-confirmation>
- </div>
- @empty
- <div class="text-center">No sources found</div>
- @endforelse
- </div>
- </div>
-
@if ($privateKeyId)
<h3 class="pt-4">Deploy Key</h3>
<div class="py-2 pt-4">Currently attached Private Key: <span
@@ -83,6 +53,38 @@
</x-forms.button>
@endforeach
</div>
+ @else
+ <div class="pt-4">
+ <h3 class="pb-2">Change Git Source</h3>
+ <div class="grid grid-cols-1 gap-2">
+ @forelse ($sources as $source)
+ <div wire:key="{{ $source->name }}">
+ <x-modal-confirmation title="Change Git Source" :actions="['Change git source to ' . $source->name]" :buttonFullWidth="true"
+ :isHighlightedButton="$application->source_id === $source->id" :disabled="$application->source_id === $source->id"
+ submitAction="changeSource({{ $source->id }}, {{ $source->getMorphClass() }})"
+ :confirmWithText="true" confirmationText="Change Git Source"
+ confirmationLabel="Please confirm changing the git source by entering the text below"
+ shortConfirmationLabel="Confirmation Text" :confirmWithPassword="false">
+ <x-slot:customButton>
+ <div class="flex items-center gap-2">
+ <div class="box-title">
+ {{ $source->name }}
+ @if ($application->source_id === $source->id)
+ <span class="text-xs">(current)</span>
+ @endif
+ </div>
+ <div class="box-description">
+ {{ $source->organization ?? 'Personal Account' }}
+ </div>
+ </div>
+ </x-slot:customButton>
+ </x-modal-confirmation>
+ </div>
+ @empty
+ <div class="text-center">No sources found</div>
+ @endforelse
+ </div>
+ </div>
@endif
</form>
</div>