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', "custom_port" => 'required|int',
"is_system_wide" => 'required|bool', "is_system_wide" => 'required|bool',
]); ]);
$github_app = GithubApp::create([ $payload = [
'name' => $this->name, 'name' => $this->name,
'organization' => $this->organization, 'organization' => $this->organization,
'api_url' => $this->api_url, 'api_url' => $this->api_url,
'html_url' => $this->html_url, 'html_url' => $this->html_url,
'custom_user' => $this->custom_user, 'custom_user' => $this->custom_user,
'custom_port' => $this->custom_port, 'custom_port' => $this->custom_port,
'is_system_wide' => $this->is_system_wide,
'team_id' => currentTeam()->id, 'team_id' => currentTeam()->id,
]); ];
if (isCloud()) {
$payload['is_system_wide'] = $this->is_system_wide;
}
$github_app = GithubApp::create($payload);
if (session('from')) { if (session('from')) {
session(['from' => session('from') + ['source_id' => $github_app->id]]); session(['from' => session('from') + ['source_id' => $github_app->id]]);
} }

View File

@ -43,40 +43,41 @@
Install Repositories on GitHub Install Repositories on GitHub
</a> </a>
@else @else
<div class="w-48"> @if (!isCloud())
<x-forms.checkbox label="System Wide?" <div class="w-48">
helper="If checked, this GitHub App will be available for everyone in this Coolify instance." <x-forms.checkbox label="System Wide?"
instantSave id="is_system_wide" /> helper="If checked, this GitHub App will be available for everyone in this Coolify instance."
</div> instantSave id="is_system_wide" />
<div class="flex gap-2"> </div>
<x-forms.input id="github_app.name" label="App Name" disabled />
<x-forms.input id="github_app.organization" label="Organization" disabled
placeholder="If empty, personal user will be used" />
</div>
<div class="flex gap-2">
<x-forms.input id="github_app.html_url" label="HTML Url" disabled />
<x-forms.input id="github_app.api_url" label="API Url" disabled />
</div>
<div class="flex gap-2">
@if ($github_app->html_url === 'https://github.com')
<x-forms.input id="github_app.custom_user" label="User" disabled />
<x-forms.input type="number" id="github_app.custom_port" label="Port" disabled />
@else
<x-forms.input id="github_app.custom_user" label="User" required />
<x-forms.input type="number" id="github_app.custom_port" label="Port" required />
@endif @endif
</div> <div class="flex gap-2">
<div class="flex gap-2"> <x-forms.input id="github_app.name" label="App Name" disabled />
<x-forms.input type="number" id="github_app.app_id" label="App Id" disabled /> <x-forms.input id="github_app.organization" label="Organization" disabled
<x-forms.input type="number" id="github_app.installation_id" label="Installation Id" disabled /> placeholder="If empty, personal user will be used" />
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">
<x-forms.input id="github_app.client_id" label="Client Id" type="password" disabled /> <x-forms.input id="github_app.html_url" label="HTML Url" disabled />
<x-forms.input id="github_app.client_secret" label="Client Secret" type="password" /> <x-forms.input id="github_app.api_url" label="API Url" disabled />
<x-forms.input id="github_app.webhook_secret" label="Webhook Secret" type="password" /> </div>
</div> <div class="flex gap-2">
@if ($github_app->html_url === 'https://github.com')
<x-forms.input id="github_app.custom_user" label="User" disabled />
<x-forms.input type="number" id="github_app.custom_port" label="Port" disabled />
@else
<x-forms.input id="github_app.custom_user" label="User" required />
<x-forms.input type="number" id="github_app.custom_port" label="Port" required />
@endif
</div>
<div class="flex gap-2">
<x-forms.input type="number" id="github_app.app_id" label="App Id" disabled />
<x-forms.input type="number" id="github_app.installation_id" label="Installation Id" disabled />
</div>
<div class="flex gap-2">
<x-forms.input id="github_app.client_id" label="Client Id" type="password" disabled />
<x-forms.input id="github_app.client_secret" label="Client Secret" type="password" />
<x-forms.input id="github_app.webhook_secret" label="Webhook Secret" type="password" />
</div>
@endif @endif
@else @else
<div class="mb-10 rounded alert alert-warning"> <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" <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_user" label="Custom Git User" required />
<x-forms.input id="custom_port" label="Custom Git Port" required /> <x-forms.input id="custom_port" label="Custom Git Port" required />
</div> </div>
<x-forms.checkbox class="pt-2" id="is_system_wide" label="System Wide" /> @if (!isCloud())
<x-forms.button type="submit"> <x-forms.checkbox class="pt-2" id="is_system_wide" label="System Wide" />
@endif
<x-forms.button class="mt-4" type="submit">
Save New Source Save New Source
</x-forms.button> </x-forms.button>
</form> </form>

View File

@ -1,8 +1,8 @@
<x-layout> <x-layout>
<h1>New Source</h1> <h1>New Source</h1>
<div class="subtitle ">Add source providers for your applications.</div> <div class="subtitle ">Add source providers for your applications.</div>
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : '' }"> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'github' }">
<div class="flex justify-center h-full gap-2 pb-6"> {{-- <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" <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'" :class="activeTab === 'github' && 'bg-coollabs text-white'"
@click.prevent="activeTab = 'github'; window.location.hash = 'github'" href="#">GitHub @click.prevent="activeTab = 'github'; window.location.hash = 'github'" href="#">GitHub
@ -11,12 +11,12 @@
:class="activeTab === 'gitlab' && 'bg-coollabs text-white'" :class="activeTab === 'gitlab' && 'bg-coollabs text-white'"
@click.prevent="activeTab = 'gitlab'; window.location.hash = 'gitlab'" href="#">GitLab @click.prevent="activeTab = 'gitlab'; window.location.hash = 'gitlab'" href="#">GitLab
</a> </a>
</div> </div> --}}
<div x-cloak x-show="activeTab === 'github'" class="h-full"> <div x-cloak x-show="activeTab === 'github'" class="h-full">
<livewire:source.github.create /> <livewire:source.github.create />
</div> </div>
<div x-cloak x-show="activeTab === 'gitlab'" class="h-full"> {{-- <div x-cloak x-show="activeTab === 'gitlab'" class="h-full">
WIP WIP
</div> </div> --}}
</div> </div>
</x-layout> </x-layout>