This commit is contained in:
Andras Bacsai 2023-06-14 11:03:54 +02:00
parent f43ca07f33
commit 767824f2f7
6 changed files with 21 additions and 10 deletions

View File

@ -14,7 +14,6 @@ class Change extends Component
public string|null $fqdn;
public $parameters;
public GithubApp $github_app;
public string $installation_url;
public string $name;
public bool $is_system_wide;

View File

@ -2,7 +2,7 @@
use App\Models\GithubApp;
use App\Models\GitlabApp;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Http;
use Lcobucci\JWT\Encoding\ChainedFormatter;
use Lcobucci\JWT\Encoding\JoseEncoder;
@ -71,3 +71,10 @@ function git_api(GithubApp|GitlabApp $source, string $endpoint, string $method =
'data' => collect($json)
];
}
function get_installation_path(GithubApp $source)
{
$github = GithubApp::where('uuid', $source->uuid)->first();
$name = Str::of(Str::kebab($github->name));
$installation_path = $github->html_url === 'https://github.com' ? 'apps' : 'github-apps';
return "$github->html_url/$installation_path/$name/installations/new";
}

View File

@ -5,15 +5,23 @@
<x-forms.button type="submit">Save</x-forms.button>
<a target="_blank" class="hover:no-underline" href="{{ $application?->gitBranchLocation }}">
<x-forms.button>
<x-git-icon git="{{ $application->source?->getMorphClass() }}" />Open Repository on Git
Open Repository
<x-external-link />
</x-forms.button>
</a>
@if (!$application->source->is_public)
<a target="_blank" class="hover:no-underline" href="{{ get_installation_path($application->source) }}">
<x-forms.button>
Open Git App
<x-external-link />
</x-forms.button>
</a>
@endif
</div>
<div class="text-sm">Code source of your application.</div>
<x-forms.input placeholder="coollabsio/coolify-example" id="application.git_repository" label="Repository" />
<x-forms.input placeholder="main" id="application.git_branch" label="Branch" />
<div class="flex items-end gap-2 w-96">
<div class="flex items-end gap-2">
<x-forms.input placeholder="HEAD" id="application.git_commit_sha" placeholder="HEAD" label="Commit SHA" />
<a target="_blank" class="flex hover:no-underline" href="{{ $application?->gitCommits }}">
<x-forms.button><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"

View File

@ -9,7 +9,7 @@
<x-forms.button x-on:click.prevent="deleteSource = true">
Delete
</x-forms.button>
<a href="{{ $installation_url }}">
<a href="{{ get_installation_path($github_app) }}">
<x-forms.button>
@if ($github_app->installation_id)
Update Repositories

View File

@ -1,4 +1,4 @@
<x-layout>
<livewire:source.github.change :github_app="$github_app" :installation_url="$installation_url" :name="$name" :ipv4="$ipv4"
:ipv6="$ipv6" :fqdn="$fqdn" />
<livewire:source.github.change :github_app="$github_app" :name="$name" :ipv4="$ipv4" :ipv6="$ipv6"
:fqdn="$fqdn" />
</x-layout>

View File

@ -103,8 +103,6 @@
$github_app = GithubApp::where('uuid', request()->github_app_uuid)->first();
$settings = InstanceSettings::get();
$name = Str::of(Str::kebab($github_app->name));
$installation_path = $github_app->html_url === 'https://github.com' ? 'apps' : 'github-apps';
$installation_url = "$github_app->html_url/$installation_path/$name/installations/new";
if ($settings->public_ipv4) {
$ipv4 = 'http://' . $settings->public_ipv4 . ':' . config('app.port');
}
@ -117,7 +115,6 @@
'ipv4' => $ipv4 ?? null,
'ipv6' => $ipv6 ?? null,
'fqdn' => $settings->fqdn,
'installation_url' => $installation_url,
]);
})->name('source.github.show');