mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 00:16:42 +00:00
feat(shared-variables): display project icons in project views
Add project icon images with fallback icons and cache-busting URLs, plus coverage for both shared-variable views.
This commit is contained in:
1 parent
96f55e3e31
commit
c6a12d7078
2 files changed
+30
-2
No files matched your search
@@ -23,7 +23,13 @@
|
||||
href="{{ route('shared-variables.project.show', ['project_uuid' => $project->uuid]) }}" {{ wireNavigate() }}>
|
||||
<div class="flex items-start gap-3">
|
||||
<div class="flex size-8 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 text-neutral-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-fg-dim">
|
||||
<x-reicon name="projects" class="size-4" />
|
||||
@if ($project->icon_path)
|
||||
<img src="{{ route('project.icon', ['project_uuid' => $project->uuid, 'v' => $project->updated_at->timestamp]) }}"
|
||||
alt="{{ $project->name }} icon"
|
||||
class="h-full w-full rounded-lg object-cover">
|
||||
@else
|
||||
<x-reicon name="projects" class="size-4" />
|
||||
@endif
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<h2 class="truncate text-[13px]! leading-4! font-semibold! text-black dark:text-fg">{{ $project->name }}</h2>
|
||||
@@ -42,7 +48,12 @@
|
||||
<a x-show="matches(@js([$project->name, $project->description]))"
|
||||
href="{{ route('shared-variables.project.show', ['project_uuid' => $project->uuid]) }}" {{ wireNavigate() }}
|
||||
class="flex min-h-14 items-center gap-3 border-b border-neutral-200 px-4 py-2.5 last:border-b-0 hover:bg-neutral-50 hover:no-underline dark:border-white/[0.07] dark:hover:bg-white/[0.025]">
|
||||
<x-reicon name="projects" class="size-4 shrink-0 text-neutral-500 dark:text-fg-dim" />
|
||||
@if ($project->icon_path)
|
||||
<img src="{{ route('project.icon', ['project_uuid' => $project->uuid, 'v' => $project->updated_at->timestamp]) }}"
|
||||
alt="{{ $project->name }} icon" class="size-4 shrink-0 rounded object-cover">
|
||||
@else
|
||||
<x-reicon name="projects" class="size-4 shrink-0 text-neutral-500 dark:text-fg-dim" />
|
||||
@endif
|
||||
<div class="min-w-0 flex-1"><div class="truncate text-[13px] font-medium">{{ $project->name }}</div><div class="truncate text-[11px] text-neutral-500 dark:text-fg-faint">{{ $project->description ?: 'No description' }}</div></div>
|
||||
<span class="shrink-0 text-[11px] text-neutral-500 dark:text-fg-dim">{{ $project->environment_variables()->count() }} {{ Str::plural('variable', $project->environment_variables()->count()) }}</span>
|
||||
</a>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use App\Livewire\Dashboard;
|
||||
use App\Livewire\Project\Edit;
|
||||
use App\Livewire\Project\Index;
|
||||
use App\Livewire\SharedVariables\Project\Index as SharedVariablesProjectIndex;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Models\Project;
|
||||
use App\Models\Team;
|
||||
@@ -113,3 +114,19 @@ it('displays the project icon on the dashboard', function () {
|
||||
'v' => $this->project->updated_at->timestamp,
|
||||
]).'"');
|
||||
});
|
||||
|
||||
it('displays the project icon in shared variables project views', function () {
|
||||
$this->project->forceFill([
|
||||
'icon_path' => "project-icons/{$this->project->uuid}/icon.jpg",
|
||||
'icon_storage_type' => 'local',
|
||||
])->save();
|
||||
|
||||
$iconUrl = route('project.icon', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'v' => $this->project->updated_at->timestamp,
|
||||
]);
|
||||
|
||||
$component = Livewire::test(SharedVariablesProjectIndex::class);
|
||||
|
||||
expect(substr_count($component->html(), 'src="'.$iconUrl.'"'))->toBe(2);
|
||||
});
|
||||
Reference in new issue
Block a user