refactor: Update Project/Show component to sort environments by created_at

This commit is contained in:
Andras Bacsai 2024-06-20 14:24:07 +02:00
parent 2421f7c35c
commit 93c890ce41
2 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,8 @@ class Show extends Component
{
public Project $project;
public $environments;
public function mount()
{
$projectUuid = request()->route('project_uuid');
@ -18,7 +20,8 @@ public function mount()
if (! $project) {
return redirect()->route('dashboard');
}
$project->load(['environments']);
$this->environments = $project->environments->sortBy('created_at');
$this->project = $project;
}

View File

@ -11,7 +11,7 @@
</div>
<div class="text-xs truncate subtitle lg:text-sm">{{ $project->name }}.</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($project->environments as $environment)
@forelse ($environments as $environment)
<div class="gap-2 border border-transparent cursor-pointer box group" x-data
x-on:click="goto('{{ $project->uuid }}','{{ $environment->name }}')">
<div class="flex flex-1 mx-6">