An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Refactor gitCommitLink method to handle different git repository formats
Andras Bacsaicd3e2963b305
diff --git a/app/Models/Application.php b/app/Models/Application.phpindex d84c4af392..fd3faa166a 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -189,6 +189,17 @@ class Application extends BaseModel});}+ public function gitCommitLink($link): string+ {+ if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {+ return "{$this->source->html_url}/{$this->git_repository}/commit/{$link}";+ }+ if (strpos($this->git_repository, 'git@') === 0) {+ $git_repository = str_replace(['git@', ':', '.git'], ['', '/', ''], $this->git_repository);+ return "https://{$git_repository}/commit/{$link}";+ }+ return $this->git_repository;+ }public function dockerfileLocation(): Attribute{return Attribute::make(diff --git a/resources/views/livewire/project/application/deployment/index.blade.php b/resources/views/livewire/project/application/deployment/index.blade.phpindex 9c5e440801..65ba941525 100644--- a/resources/views/livewire/project/application/deployment/index.blade.php+++ b/resources/views/livewire/project/application/deployment/index.blade.php@@ -27,18 +27,15 @@</form>@endif@forelse ($deployments as $deployment)- <a @class([- 'dark:bg-coolgray-100 p-2 border-l border-dashed transition-colors hover:no-underline box-without-bg-without-border bg-white flex-col',- 'dark:hover:bg-coolgray-200' =>- data_get($deployment, 'status') === 'queued',- 'border-warning hover:bg-warning hover:text-black' =>+ <div @class([+ 'dark:bg-coolgray-100 p-2 border-l border-dashed transition-colors hover:no-underline box-without-bg-without-border bg-white flex-col cursor-pointer dark:hover:text-neutral-400 dark:hover:bg-coolgray-200',+ 'border-warning' =>data_get($deployment, 'status') === 'in_progress' ||data_get($deployment, 'status') === 'cancelled-by-user',- 'border-error dark:hover:bg-error hover:bg-neutral-200' =>- data_get($deployment, 'status') === 'failed',- 'border-success dark:hover:bg-success hover:bg-neutral-200' =>- data_get($deployment, 'status') === 'finished',- ]) href="{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}">+ 'border-error' => data_get($deployment, 'status') === 'failed',+ 'border-success' => data_get($deployment, 'status') === 'finished',+ ])+ x-on:click.stop="goto('{{ $current_url . '/' . data_get($deployment, 'deployment_uuid') }}')"><div class="flex flex-col justify-start"><div class="flex gap-1">{{ $deployment->created_at }} UTC@@ -64,8 +61,17 @@@endif</div>@else- <div class="flex gap-1">- Manual+ <div class="flex items-center gap-1">+ Manual @if (data_get($deployment, 'rollback') === true)+ <div class="text-xs">rolled back to </div>+ @endif+ @if (data_get($deployment, 'commit'))+ <div class="dark:hover:text-white"+ x-on:click.stop="goto('{{ $application->gitCommitLink(data_get($deployment, 'commit')) }}')">+ <div class="text-xs underline">+ ({{ data_get($deployment, 'commit') }})</div>+ </div>+ @endif</div>@endif@if (data_get($deployment, 'server_name'))@@ -85,15 +91,19 @@<span class="font-bold" x-text="measure_finished_time()">0s</span></div></div>- </a>+ </div>@empty<div class="">No deployments found</div>@endforelse+@if ($deployments_count > 0)<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>+ function goto(url) {+ window.location.href = url;+ };document.addEventListener('alpine:init', () => {let timers = {};