diff --git a/app/Livewire/Project/Application/Source.php b/app/Livewire/Project/Application/Source.php index 3afdbe075..013d8b8fe 100644 --- a/app/Livewire/Project/Application/Source.php +++ b/app/Livewire/Project/Application/Source.php @@ -75,7 +75,7 @@ class Source extends Component // filter the current source out $this->sources = currentTeam()->sources()->whereNotNull('app_id')->reject(function ($source) { return $source->id === $this->application->source_id; - }); + })->sortBy('name'); } public function setPrivateKey(int $privateKeyId) @@ -113,6 +113,7 @@ class Source extends Component 'source_type' => $sourceType, ]); $this->application->refresh(); + $this->getSources(); $this->dispatch('success', 'Source updated!'); } catch (\Throwable $e) { return handleError($e, $this); diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.php index 81f8ff18a..0de2f2fd9 100644 --- a/bootstrap/helpers/github.php +++ b/bootstrap/helpers/github.php @@ -52,6 +52,9 @@ function generateGithubToken(GithubApp $source, string $type) if (! $response->successful()) { $error = data_get($response->json(), 'message', 'no error message found'); + if ($error === 'Not Found') { + $error = 'Repository not found. Is it moved or deleted?'; + } throw new RuntimeException("Failed to get installation token for {$source->name} with error: ".$error); } diff --git a/resources/views/livewire/project/application/source.blade.php b/resources/views/livewire/project/application/source.blade.php index a32742a01..29c5c6142 100644 --- a/resources/views/livewire/project/application/source.blade.php +++ b/resources/views/livewire/project/application/source.blade.php @@ -38,33 +38,37 @@ - @if (filled($sources) && $sources->count() > 0) -
-

Change Git Source

-
- @foreach ($sources as $source) +
+

Change Git Source

+
+ @forelse ($sources as $source) +
-
- {{ $source->name }} - @if ($application->source_id === $source->id) - (current) - @endif -
-
- {{ $source->organization_name ?? 'Personal Account' }} +
+
+ {{ $source->name }} + @if ($application->source_id === $source->id) + (current) + @endif +
+
+ {{ $source->organization ?? 'Personal Account' }} +
- @endforeach -
+
+ @empty +
No sources found
+ @endforelse
- @endif +
@if ($privateKeyId)

Deploy Key