fix: do not show system wide git on cloud

This commit is contained in:
Andras Bacsai 2023-09-05 10:03:28 +02:00
parent 31db1db636
commit be1dad03bd
4 changed files with 48 additions and 42 deletions

View File

@ -32,16 +32,19 @@ public function createGitHubApp()
"custom_port" => 'required|int',
"is_system_wide" => 'required|bool',
]);
$github_app = GithubApp::create([
$payload = [
'name' => $this->name,
'organization' => $this->organization,
'api_url' => $this->api_url,
'html_url' => $this->html_url,
'custom_user' => $this->custom_user,
'custom_port' => $this->custom_port,
'is_system_wide' => $this->is_system_wide,
'team_id' => currentTeam()->id,
]);
];
if (isCloud()) {
$payload['is_system_wide'] = $this->is_system_wide;
}
$github_app = GithubApp::create($payload);
if (session('from')) {
session(['from' => session('from') + ['source_id' => $github_app->id]]);
}

View File

@ -43,11 +43,13 @@
Install Repositories on GitHub
</a>
@else
@if (!isCloud())
<div class="w-48">
<x-forms.checkbox label="System Wide?"
helper="If checked, this GitHub App will be available for everyone in this Coolify instance."
instantSave id="is_system_wide" />
</div>
@endif
<div class="flex gap-2">
<x-forms.input id="github_app.name" label="App Name" disabled />
<x-forms.input id="github_app.organization" label="Organization" disabled
@ -76,7 +78,6 @@
<x-forms.input id="github_app.webhook_secret" label="Webhook Secret" type="password" />
</div>
@endif
@else
<div class="mb-10 rounded alert alert-warning">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 stroke-current shrink-0" fill="none"

View File

@ -14,8 +14,10 @@
<x-forms.input id="custom_user" label="Custom Git User" required />
<x-forms.input id="custom_port" label="Custom Git Port" required />
</div>
@if (!isCloud())
<x-forms.checkbox class="pt-2" id="is_system_wide" label="System Wide" />
<x-forms.button type="submit">
@endif
<x-forms.button class="mt-4" type="submit">
Save New Source
</x-forms.button>
</form>

View File

@ -1,8 +1,8 @@
<x-layout>
<h1>New Source</h1>
<div class="subtitle ">Add source providers for your applications.</div>
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : '' }">
<div class="flex justify-center h-full gap-2 pb-6">
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'github' }">
{{-- <div class="flex justify-center h-full gap-2 pb-6">
<a class="flex items-center justify-center w-1/2 p-2 transition-colors rounded-none min-h-12 bg-coolgray-200 hover:bg-coollabs-100 hover:text-white hover:no-underline"
:class="activeTab === 'github' && 'bg-coollabs text-white'"
@click.prevent="activeTab = 'github'; window.location.hash = 'github'" href="#">GitHub
@ -11,12 +11,12 @@
:class="activeTab === 'gitlab' && 'bg-coollabs text-white'"
@click.prevent="activeTab = 'gitlab'; window.location.hash = 'gitlab'" href="#">GitLab
</a>
</div>
</div> --}}
<div x-cloak x-show="activeTab === 'github'" class="h-full">
<livewire:source.github.create />
</div>
<div x-cloak x-show="activeTab === 'gitlab'" class="h-full">
{{-- <div x-cloak x-show="activeTab === 'gitlab'" class="h-full">
WIP
</div>
</div> --}}
</div>
</x-layout>