testing php storm code cleanup and styling

This commit is contained in:
Andras Bacsai
2023-08-08 11:51:36 +02:00
parent a8ee779b31
commit f2228cec7b
368 changed files with 23834 additions and 2623 deletions

View File

@@ -1,10 +1,10 @@
<div class="pt-4">
<livewire:project.application.deployment-navbar :application_deployment_queue="$application_deployment_queue" />
<livewire:project.application.deployment-navbar :application_deployment_queue="$application_deployment_queue"/>
@if (data_get($application_deployment_queue, 'status') === 'in_progress')
<div class="flex items-center gap-1 pt-2 ">Deployment is
<div class="text-warning"> {{ Str::headline(data_get($this->application_deployment_queue, 'status')) }}.
</div>
<x-loading class="loading-ring" />
<x-loading class="loading-ring"/>
</div>
<div class="">Logs will be updated automatically.</div>
@else
@@ -13,7 +13,7 @@
</div>
@endif
<div @if ($isKeepAliveOn) wire:poll.2000ms="polling" @endif
class="scrollbar flex flex-col-reverse w-full overflow-y-auto border border-dotted rounded border-coolgray-400 max-h-[32rem] p-2 px-4 mt-4 text-xs">
class="scrollbar flex flex-col-reverse w-full overflow-y-auto border border-dotted rounded border-coolgray-400 max-h-[32rem] p-2 px-4 mt-4 text-xs">
<span class="flex flex-col">
@if (decode_remote_command_output($application_deployment_queue)->count() > 0)
@foreach (decode_remote_command_output($application_deployment_queue) as $line)
@@ -22,7 +22,9 @@
'text-neutral-400' => $line['type'] == 'stdout',
'text-error' => $line['type'] == 'stderr',
'text-warning' => $line['hidden'],
])>[{{ $line['timestamp'] }}] @if ($line['hidden'])<br>Command: {{ $line['command'] }} <br>Output: @endif{{ $line['output'] }}@if ($line['hidden']) @endif</div>
])>[{{ $line['timestamp'] }}] @if ($line['hidden'])
<br>Command: {{ $line['command'] }} <br>Output:
@endif{{ $line['output'] }}@if ($line['hidden']) @endif</div>
@endforeach
@else
<span class="font-mono text-neutral-400">No logs yet.</span>

View File

@@ -1,11 +1,11 @@
<div class="flex flex-col gap-2" @if ($skip == 0) wire:poll.5000ms='reload_deployments' @endif>
<h2 class="pt-4">Deployments <span class="text-xs">({{ $deployments_count }})</span></h2>
@if ($show_next)
<x-forms.button wire:click="load_deployments({{ $default_take }})">Show More
</x-forms.button>
@endif
@foreach ($deployments as $deployment)
<a @class([
<div class="flex flex-col gap-2" @if ($skip == 0) wire:poll.5000ms='reload_deployments' @endif>
<h2 class="pt-4">Deployments <span class="text-xs">({{ $deployments_count }})</span></h2>
@if ($show_next)
<x-forms.button wire:click="load_deployments({{ $default_take }})">Show More
</x-forms.button>
@endif
@foreach ($deployments as $deployment)
<a @class([
'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',
'cursor-not-allowed hover:bg-coolgray-200' =>
data_get($deployment, 'status') === 'queued' ||
@@ -17,78 +17,79 @@
'border-success hover:bg-success' =>
data_get($deployment, 'status') === 'finished',
]) @if (data_get($deployment, 'status') !== 'cancelled by system' && data_get($deployment, 'status') !== 'queued')
href="{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}"
@endif
class="hover:no-underline">
<div class="flex flex-col justify-start">
<div>
{{ $deployment->id }} <span class=" text-warning">></span> {{ $deployment->deployment_uuid }}
<span class=" text-warning">></span>
{{ $deployment->status }}
</div>
@if (data_get($deployment, 'pull_request_id'))
<div>
Pull Request #{{ data_get($deployment, 'pull_request_id') }}
@if (data_get($deployment, 'is_webhook'))
(Webhook)
@endif
</div>
@elseif (data_get($deployment, 'is_webhook'))
<div>Webhook (sha
@if (data_get($deployment, 'commit'))
{{ data_get($deployment, 'commit') }})
@else
HEAD)
@endif
</div>
@endif
<div class="flex flex-col" x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">
<div>
@if ($deployment->status !== 'in_progress')
Finished <span x-text="measure_since_started()">0s</span> in
@else
Running for
@endif
<span class="font-bold" x-text="measure_finished_time()">0s</span>
</div>
</div>
</div>
</a>
@endforeach
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/utc.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.js"></script>
<script>
document.addEventListener('alpine:init', () => {
let timers = {};
href="{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}"
@endif
class="hover:no-underline">
<div class="flex flex-col justify-start">
<div>
{{ $deployment->id }} <span class=" text-warning">></span> {{ $deployment->deployment_uuid }}
<span class=" text-warning">></span>
{{ $deployment->status }}
</div>
@if (data_get($deployment, 'pull_request_id'))
<div>
Pull Request #{{ data_get($deployment, 'pull_request_id') }}
@if (data_get($deployment, 'is_webhook'))
(Webhook)
@endif
</div>
@elseif (data_get($deployment, 'is_webhook'))
<div>Webhook (sha
@if (data_get($deployment, 'commit'))
{{ data_get($deployment, 'commit') }})
@else
HEAD)
@endif
</div>
@endif
<div class="flex flex-col"
x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">
<div>
@if ($deployment->status !== 'in_progress')
Finished <span x-text="measure_since_started()">0s</span> in
@else
Running for
@endif
<span class="font-bold" x-text="measure_finished_time()">0s</span>
</div>
</div>
</div>
</a>
@endforeach
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/utc.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.js"></script>
<script>
document.addEventListener('alpine:init', () => {
let timers = {};
dayjs.extend(window.dayjs_plugin_utc);
dayjs.extend(window.dayjs_plugin_relativeTime);
dayjs.extend(window.dayjs_plugin_utc);
dayjs.extend(window.dayjs_plugin_relativeTime);
Alpine.data('elapsedTime', (uuid, status, created_at, updated_at) => ({
finished_time: 'calculating...',
started_time: 'calculating...',
init() {
if (timers[uuid]) {
clearInterval(timers[uuid]);
}
if (status === 'in_progress') {
timers[uuid] = setInterval(() => {
this.finished_time = dayjs().diff(dayjs.utc(created_at),
'second') + 's'
}, 1000);
} else {
let seconds = dayjs.utc(updated_at).diff(dayjs.utc(created_at), 'second')
this.finished_time = seconds + 's';
}
},
measure_finished_time() {
return this.finished_time;
},
measure_since_started() {
return dayjs.utc(created_at).fromNow();
}
}))
})
</script>
</div>
Alpine.data('elapsedTime', (uuid, status, created_at, updated_at) => ({
finished_time: 'calculating...',
started_time: 'calculating...',
init() {
if (timers[uuid]) {
clearInterval(timers[uuid]);
}
if (status === 'in_progress') {
timers[uuid] = setInterval(() => {
this.finished_time = dayjs().diff(dayjs.utc(created_at),
'second') + 's'
}, 1000);
} else {
let seconds = dayjs.utc(updated_at).diff(dayjs.utc(created_at), 'second')
this.finished_time = seconds + 's';
}
},
measure_finished_time() {
return this.finished_time;
},
measure_since_started() {
return dayjs.utc(created_at).fromNow();
}
}))
})
</script>
</div>

View File

@@ -9,11 +9,11 @@
<div class="">General configuration for your application.</div>
<div class="flex flex-col gap-2 py-4">
<div class="flex flex-col items-end gap-2 xl:flex-row">
<x-forms.input id="application.name" label="Name" required />
<x-forms.input id="application.description" label="Description" />
<x-forms.input id="application.name" label="Name" required/>
<x-forms.input id="application.description" label="Description"/>
</div>
<x-forms.input placeholder="https://coolify.io" id="application.fqdn" label="Domains"
helper="You can specify one domain with path or more with comma.<br><span class='text-helper'>Example</span>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3" />
helper="You can specify one domain with path or more with comma.<br><span class='text-helper'>Example</span>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3"/>
@if ($wildcard_domain)
<div class="flex flex-row gap-2">
@if ($global_wildcard_domain)
@@ -39,48 +39,48 @@
@endif
<h3>Build</h3>
<div class="flex flex-col gap-2 xl:flex-row">
<x-forms.input placeholder="pnpm install" id="application.install_command" label="Install Command" />
<x-forms.input placeholder="pnpm build" id="application.build_command" label="Build Command" />
<x-forms.input placeholder="pnpm start" id="application.start_command" label="Start Command" />
<x-forms.input placeholder="pnpm install" id="application.install_command" label="Install Command"/>
<x-forms.input placeholder="pnpm build" id="application.build_command" label="Build Command"/>
<x-forms.input placeholder="pnpm start" id="application.start_command" label="Start Command"/>
</div>
<div class="flex flex-col gap-2 xl:flex-row">
<x-forms.input placeholder="/" id="application.base_directory" label="Base Directory"
helper="Directory to use as root. Useful for monorepos. WIP" disabled />
helper="Directory to use as root. Useful for monorepos. WIP" disabled/>
@if ($application->settings->is_static)
<x-forms.input placeholder="/dist" id="application.publish_directory" label="Publish Directory"
required />
required/>
@else
<x-forms.input placeholder="/" id="application.publish_directory" label="Publish Directory" />
<x-forms.input placeholder="/" id="application.publish_directory" label="Publish Directory"/>
@endif
</div>
<h3>Network</h3>
<div class="flex flex-col gap-2 xl:flex-row">
@if ($application->settings->is_static)
<x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly />
<x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly/>
@else
<x-forms.input placeholder="3000,3001" id="application.ports_exposes" label="Ports Exposes" required
helper="A comma separated list of ports you would like to expose for the proxy." />
helper="A comma separated list of ports you would like to expose for the proxy."/>
@endif
<x-forms.input placeholder="3000:3000" id="application.ports_mappings" label="Ports Mappings"
helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.<br><span class='inline-block font-bold text-warning'>Example</span>3000:3000,3002:3002" />
helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.<br><span class='inline-block font-bold text-warning'>Example</span>3000:3000,3002:3002"/>
</div>
</div>
<h3>Advanced</h3>
<div class="flex flex-col">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
helper="If your application is a static site or the final build assets should be served as a static site, enable this."/>
<x-forms.checkbox
helper="Your application will be available only on https if your domain starts with https://..."
instantSave id="is_force_https_enabled" label="Force Https" />
instantSave id="is_force_https_enabled" label="Force Https"/>
<x-forms.checkbox helper="Automatically deploy new commits based on Git webhooks." instantSave
id="is_auto_deploy_enabled" label="Auto Deploy" />
id="is_auto_deploy_enabled" label="Auto Deploy"/>
<x-forms.checkbox
helper="Allow to automatically deploy Preview Deployments for all opened PR's.<br><br>Closing a PR will delete Preview Deployments."
instantSave id="is_preview_deployments_enabled" label="Previews Deployments" />
instantSave id="is_preview_deployments_enabled" label="Previews Deployments"/>
<x-forms.checkbox instantSave id="is_git_submodules_enabled" label="Git Submodules"
helper="Allow Git Submodules during build process." />
helper="Allow Git Submodules during build process."/>
<x-forms.checkbox instantSave id="is_git_lfs_enabled" label="Git LFS"
helper="Allow Git LFS during build process." />
helper="Allow Git LFS during build process."/>
{{-- <x-forms.checkbox disabled instantSave id="is_dual_cert" label="Dual Certs?" />
<x-forms.checkbox disabled instantSave id="is_custom_ssl" label="Is Custom SSL?" />
<x-forms.checkbox disabled instantSave id="is_http2" label="Is Http2?" /> --}}

View File

@@ -1,4 +1,4 @@
<nav x-init="$wire.check_status" wire:poll.10000ms="check_status">
<x-resources.breadcrumbs :resource="$application" :parameters="$parameters" />
<x-applications.navbar :application="$application" :parameters="$parameters" />
<x-resources.breadcrumbs :resource="$application" :parameters="$parameters"/>
<x-applications.navbar :application="$application" :parameters="$parameters"/>
</nav>

View File

@@ -7,7 +7,7 @@
<div class="pb-4 ">Preview Deployments based on pull requests are here.</div>
<div class="flex flex-col gap-2 pb-4">
<x-forms.input id="application.preview_url_template" label="Preview URL Template"
helper="Templates:<span class='text-helper'>@@{{ random }}</span> to generate random sub-domain each time a PR is deployed, <span class='text-helper'>@@{{ pr_id }}</span> to use pull request ID as sub-domain or <span class='text-helper'>@@{{ domain }}</span> to replace the domain name with the application's domain name." />
helper="Templates:<span class='text-helper'>@@{{ random }}</span> to generate random sub-domain each time a PR is deployed, <span class='text-helper'>@@{{ pr_id }}</span> to use pull request ID as sub-domain or <span class='text-helper'>@@{{ domain }}</span> to replace the domain name with the application's domain name."/>
<div class="">Domain Preview: {{ $preview_url_template }}</div>
</div>
</form>

View File

@@ -1,5 +1,5 @@
<div>
<livewire:project.application.preview.form :application="$application" />
<livewire:project.application.preview.form :application="$application"/>
<div>
<div class="flex items-center gap-2">
<h3>Pull Requests on Git</h3>
@@ -14,33 +14,33 @@
<div class="overflow-x-auto table-md">
<table>
<thead>
<tr>
<th>PR Number</th>
<th>PR Title</th>
<th>Git</th>
<th>Actions</th>
</tr>
<tr>
<th>PR Number</th>
<th>PR Title</th>
<th>Git</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($pull_requests as $pull_request)
<tr>
<th>{{ data_get($pull_request, 'number') }}</th>
<td>{{ data_get($pull_request, 'title') }}</td>
<td>
<a target="_blank" class="text-xs"
href="{{ data_get($pull_request, 'html_url') }}">Open PR on
Git
<x-external-link />
</a>
</td>
<td>
<x-forms.button
wire:click="deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
Deploy
</x-forms.button>
</td>
</tr>
@endforeach
@foreach ($pull_requests as $pull_request)
<tr>
<th>{{ data_get($pull_request, 'number') }}</th>
<td>{{ data_get($pull_request, 'title') }}</td>
<td>
<a target="_blank" class="text-xs"
href="{{ data_get($pull_request, 'html_url') }}">Open PR on
Git
<x-external-link/>
</a>
</td>
<td>
<x-forms.button
wire:click="deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
Deploy
</x-forms.button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@@ -51,23 +51,24 @@
<h4 class="py-4" wire:poll.10000ms='previewRefresh'>Deployed Previews</h4>
<div class="flex gap-6 ">
@foreach ($application->previews as $preview)
<div class="flex flex-col p-4 bg-coolgray-200 " x-init="$wire.loadStatus('{{ data_get($preview, 'pull_request_id') }}')">
<div class="flex flex-col p-4 bg-coolgray-200 "
x-init="$wire.loadStatus('{{ data_get($preview, 'pull_request_id') }}')">
<div class="flex gap-2">PR #{{ data_get($preview, 'pull_request_id') }} |
@if (data_get($preview, 'status') === 'running')
<x-status.running />
<x-status.running/>
@elseif (data_get($preview, 'status') === 'restarting')
<x-status.restarting />
<x-status.restarting/>
@else
<x-status.stopped />
<x-status.stopped/>
@endif
@if (data_get($preview, 'status') !== 'exited')
| <a target="_blank" href="{{ data_get($preview, 'fqdn') }}">Open Preview
<x-external-link />
<x-external-link/>
</a>
@endif
|
<a target="_blank" href="{{ data_get($preview, 'pull_request_html_url') }}">Open PR on Git
<x-external-link />
<x-external-link/>
</a>
</div>
<div class="flex items-center gap-2 pt-6">

View File

@@ -6,20 +6,20 @@
<a target="_blank" class="hover:no-underline" href="{{ $application?->gitBranchLocation }}">
<x-forms.button>
Open Repository
<x-external-link />
<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-external-link/>
</x-forms.button>
</a>
@endif
<a target="_blank" class="flex hover:no-underline" href="{{ $application?->gitCommits }}">
<x-forms.button>Open Commits on Git
<x-external-link />
<x-external-link/>
</x-forms.button>
</a>
</div>
@@ -27,11 +27,11 @@
<div class="flex gap-2">
<x-forms.input placeholder="coollabsio/coolify-example" id="application.git_repository"
label="Repository" />
<x-forms.input placeholder="main" id="application.git_branch" label="Branch" />
label="Repository"/>
<x-forms.input placeholder="main" id="application.git_branch" label="Branch"/>
</div>
<div class="flex items-end gap-2">
<x-forms.input placeholder="HEAD" id="application.git_commit_sha" placeholder="HEAD" label="Commit SHA" />
<x-forms.input placeholder="HEAD" id="application.git_commit_sha" placeholder="HEAD" label="Commit SHA"/>
</div>
@isset($application->private_key_id)