fix
This commit is contained in:
parent
4698ab9722
commit
2c9c9a86f4
@ -12,6 +12,10 @@ class Change extends Component
|
|||||||
public string|null $ipv4;
|
public string|null $ipv4;
|
||||||
public string|null $ipv6;
|
public string|null $ipv6;
|
||||||
public string|null $fqdn;
|
public string|null $fqdn;
|
||||||
|
|
||||||
|
public bool|null $default_permissions = true;
|
||||||
|
public bool|null $preview_deployment_permissions = true;
|
||||||
|
|
||||||
public $parameters;
|
public $parameters;
|
||||||
public GithubApp $github_app;
|
public GithubApp $github_app;
|
||||||
public string $name;
|
public string $name;
|
||||||
@ -48,13 +52,6 @@ class Change extends Component
|
|||||||
}
|
}
|
||||||
public function instantSave()
|
public function instantSave()
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$this->github_app->is_system_wide = $this->is_system_wide;
|
|
||||||
$this->github_app->save();
|
|
||||||
$this->emit('saved', 'GitHub settings updated!');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return general_error_handler(err: $e, that: $this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
'noDirty' => $attributes->has('noDirty'),
|
'noDirty' => $attributes->has('noDirty'),
|
||||||
'disabled' => null,
|
'disabled' => null,
|
||||||
])
|
])
|
||||||
<label {{ $attributes->merge(['class' => 'flex cursor-pointer w-64 label']) }}>
|
<div {{ $attributes->merge(['class' => 'flex cursor-pointer w-96 label']) }}>
|
||||||
<div class="flex gap-1 label-text">
|
<div class="flex gap-1 label-text">
|
||||||
@if ($label)
|
@if ($label)
|
||||||
{{ $label }}
|
{{ $label }}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
{{ $id }}
|
{{ $id }}
|
||||||
@endif
|
@endif
|
||||||
@if ($helper)
|
@if ($helper)
|
||||||
<div class="group">
|
<div class="group w-fit">
|
||||||
<div class="cursor-pointer text-warning">
|
<div class="cursor-pointer text-warning">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||||
class="w-4 h-4 stroke-current">
|
class="w-4 h-4 stroke-current">
|
||||||
@ -36,4 +36,4 @@
|
|||||||
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
|
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
|
||||||
@if (!$noDirty) wire:dirty.class="input-warning" @endif
|
@if (!$noDirty) wire:dirty.class="input-warning" @endif
|
||||||
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
|
||||||
</label>
|
</div>
|
||||||
|
@ -62,26 +62,43 @@
|
|||||||
helper="If checked, this GitHub App will be available for everyone in this Coolify instance."
|
helper="If checked, this GitHub App will be available for everyone in this Coolify instance."
|
||||||
instantSave id="is_system_wide" />
|
instantSave id="is_system_wide" />
|
||||||
@else
|
@else
|
||||||
<div class="text-sm ">You need to register a GitHub App before using this source.</div>
|
<form class="flex gap-4">
|
||||||
<div class="flex items-end gap-4 pt-2 pb-10">
|
<div class="flex items-end gap-2">
|
||||||
<form class="flex gap-2">
|
<h3>Register a GitHub App</h3>
|
||||||
<x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint"
|
<x-forms.button
|
||||||
helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu.">
|
x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}','{{ $preview_deployment_permissions }}')">
|
||||||
@if ($ipv4)
|
Register a
|
||||||
<option value="{{ $ipv4 }}">Use {{ $ipv4 }}</option>
|
GitHub
|
||||||
@endif
|
|
||||||
@if ($ipv6)
|
|
||||||
<option value="{{ $ipv6 }}">Use {{ $ipv6 }}</option>
|
|
||||||
@endif
|
|
||||||
@if ($fqdn)
|
|
||||||
<option value="{{ $fqdn }}">Use {{ $fqdn }}</option>
|
|
||||||
@endif
|
|
||||||
</x-forms.select>
|
|
||||||
<x-forms.button x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}')">Register a GitHub
|
|
||||||
Application
|
Application
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
</form>
|
</div>
|
||||||
</div>
|
<div class="pt-1 pb-2 text-sm">You need to register a GitHub App before using this source.</div>
|
||||||
|
<div class="pt-2 pb-10">
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint"
|
||||||
|
helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu.">
|
||||||
|
@if ($ipv4)
|
||||||
|
<option value="{{ $ipv4 }}">Use {{ $ipv4 }}</option>
|
||||||
|
@endif
|
||||||
|
@if ($ipv6)
|
||||||
|
<option value="{{ $ipv6 }}">Use {{ $ipv6 }}</option>
|
||||||
|
@endif
|
||||||
|
@if ($fqdn)
|
||||||
|
<option value="{{ $fqdn }}">Use {{ $fqdn }}</option>
|
||||||
|
@endif
|
||||||
|
</x-forms.select>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-2 pt-4">
|
||||||
|
<x-forms.checkbox disabled instantSave id="default_permissions" label="Default Permissions"
|
||||||
|
helper="Contents: read<br>Metadata: read<br>Email: read" />
|
||||||
|
<x-forms.checkbox instantSave id="preview_deployment_permissions"
|
||||||
|
label="Preview Deployments Permission"
|
||||||
|
helper="Necessary for updating pull requests with useful comments (deployment status, links, etc.)<br><br>Pull Request: read & write" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<x-forms.input id="github_app.name" label="App Name" disabled />
|
<x-forms.input id="github_app.name" label="App Name" disabled />
|
||||||
<x-forms.input id="github_app.organization" label="Organization"
|
<x-forms.input id="github_app.organization" label="Organization"
|
||||||
@ -102,9 +119,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<x-forms.checkbox
|
<x-forms.checkbox
|
||||||
helper="If checked, this GitHub App will be available for everyone in this Coolify instance." noDirty
|
helper="If checked, this GitHub App will be available for everyone in this Coolify instance." noDirty
|
||||||
label="System Wide?" instantSave disabled id="is_system_wide" />
|
label="System Wide?" disabled id="is_system_wide" />
|
||||||
<script>
|
<script>
|
||||||
function createGithubApp(webhook_endpoint) {
|
function createGithubApp(webhook_endpoint, preview_deployment_permissions) {
|
||||||
const {
|
const {
|
||||||
organization,
|
organization,
|
||||||
uuid,
|
uuid,
|
||||||
@ -119,6 +136,14 @@
|
|||||||
}
|
}
|
||||||
const webhookBaseUrl = `${baseUrl}/webhooks`;
|
const webhookBaseUrl = `${baseUrl}/webhooks`;
|
||||||
const path = organization ? `organizations/${organization}/settings/apps/new` : 'settings/apps/new';
|
const path = organization ? `organizations/${organization}/settings/apps/new` : 'settings/apps/new';
|
||||||
|
const default_permissions = {
|
||||||
|
contents: 'read',
|
||||||
|
metadata: 'read',
|
||||||
|
emails: 'read'
|
||||||
|
};
|
||||||
|
if (preview_deployment_permissions) {
|
||||||
|
default_permissions.pull_requests = 'write';
|
||||||
|
}
|
||||||
const data = {
|
const data = {
|
||||||
name,
|
name,
|
||||||
url: baseUrl,
|
url: baseUrl,
|
||||||
@ -132,12 +157,7 @@
|
|||||||
request_oauth_on_install: false,
|
request_oauth_on_install: false,
|
||||||
setup_url: `${webhookBaseUrl}/source/github/install?source=${uuid}`,
|
setup_url: `${webhookBaseUrl}/source/github/install?source=${uuid}`,
|
||||||
setup_on_update: true,
|
setup_on_update: true,
|
||||||
default_permissions: {
|
default_permissions,
|
||||||
contents: 'read',
|
|
||||||
metadata: 'read',
|
|
||||||
pull_requests: 'write',
|
|
||||||
emails: 'read'
|
|
||||||
},
|
|
||||||
default_events: ['pull_request', 'push']
|
default_events: ['pull_request', 'push']
|
||||||
};
|
};
|
||||||
const form = document.createElement('form');
|
const form = document.createElement('form');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user