fix: if service img not found, use github as a source

This commit is contained in:
Andras Bacsai
2024-11-14 13:04:51 +01:00
parent b0f3f5378f
commit a77ed93695
2 changed files with 9 additions and 3 deletions

View File

@@ -91,9 +91,12 @@ class Select extends Component
{
$services = get_service_templates(true);
$services = collect($services)->map(function ($service, $key) {
$logo = data_get($service, 'logo', 'svgs/coolify.png');
return [
'name' => str($key)->headline(),
'logo' => asset(data_get($service, 'logo', 'svgs/coolify.png')),
'logo' => asset($logo),
'logo_github_url' => 'https://raw.githubusercontent.com/coollabsio/coolify/refs/heads/main/public/'.$logo,
] + (array) $service;
})->all();
$gitBasedApplications = [

View File

@@ -101,7 +101,10 @@
<x-slot:logo>
<template x-if="service.logo">
<img class="w-[4.5rem] aspect-square h-[4.5rem] p-2 transition-all duration-200 opacity-30 grayscale group-hover:grayscale-0 group-hover:opacity-100"
:src='service.logo'>
:src='service.logo'
x-on:error.window="$event.target.src = service.logo_github_url"
onerror="this.onerror=null; this.src=this.getAttribute('data-fallback');"
:data-fallback='service.logo_github_url' />
</template>
</x-slot:logo>
<x-slot:documentation>
@@ -205,7 +208,7 @@
}
}
</script>
@endif
@endif
</div>
@if ($current_step === 'servers')
<h2>Select a server</h2>