From 201e30e84952d6bdd10ca702c632944a4971c364 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 7 Oct 2025 17:17:31 +0200 Subject: [PATCH] feat(project): enhance project index with resource creation capabilities - Added logic to determine if the user can create resources for each project and generate the corresponding route for adding resources based on the project's first environment. - Updated the project index view to display the new resource creation option alongside existing project settings. - Adjusted various views to include a margin-top adjustment for better layout consistency. --- app/Livewire/Project/Index.php | 8 ++++ resources/views/livewire/dashboard.blade.php | 2 +- .../livewire/destination/index.blade.php | 2 +- .../views/livewire/profile/index.blade.php | 2 +- .../views/livewire/project/index.blade.php | 48 ++++++------------- .../views/livewire/server/index.blade.php | 2 +- .../livewire/shared-variables/index.blade.php | 2 +- .../views/livewire/storage/index.blade.php | 2 +- resources/views/source/all.blade.php | 2 +- 9 files changed, 29 insertions(+), 41 deletions(-) diff --git a/app/Livewire/Project/Index.php b/app/Livewire/Project/Index.php index 5381fa78d..a27a3652f 100644 --- a/app/Livewire/Project/Index.php +++ b/app/Livewire/Project/Index.php @@ -21,6 +21,14 @@ public function mount() $this->projects = Project::ownedByCurrentTeam()->get()->map(function ($project) { $project->settingsRoute = route('project.edit', ['project_uuid' => $project->uuid]); $project->canUpdate = auth()->user()->can('update', $project); + $project->canCreateResource = auth()->user()->can('createAnyResource'); + $firstEnvironment = $project->environments->first(); + $project->addResourceRoute = $firstEnvironment + ? route('project.resource.create', [ + 'project_uuid' => $project->uuid, + 'environment_uuid' => $firstEnvironment->uuid, + ]) + : null; return $project; }); diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index 7a0cbec4a..bc3071c19 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -14,7 +14,7 @@ @endif -
+

Projects

@if ($projects->count() > 0)
diff --git a/resources/views/livewire/destination/index.blade.php b/resources/views/livewire/destination/index.blade.php index d0a21c1f0..0e6f3a005 100644 --- a/resources/views/livewire/destination/index.blade.php +++ b/resources/views/livewire/destination/index.blade.php @@ -13,7 +13,7 @@ @endif
Network endpoints to deploy your resources.
-
+
@forelse ($servers as $server) @forelse ($server->destinations() as $destination) @if ($destination->getMorphClass() === 'App\Models\StandaloneDocker') diff --git a/resources/views/livewire/profile/index.blade.php b/resources/views/livewire/profile/index.blade.php index 2888b82a8..11031b7f2 100644 --- a/resources/views/livewire/profile/index.blade.php +++ b/resources/views/livewire/profile/index.blade.php @@ -3,7 +3,7 @@ Profile | Coolify

Profile

-
Your user profile settings.
+
Your user profile settings.

General

diff --git a/resources/views/livewire/project/index.blade.php b/resources/views/livewire/project/index.blade.php index ceace9587..fd6e4c422 100644 --- a/resources/views/livewire/project/index.blade.php +++ b/resources/views/livewire/project/index.blade.php @@ -11,49 +11,29 @@ @endcan
All your projects are here.
-
- -
- - -
- -
diff --git a/resources/views/livewire/server/index.blade.php b/resources/views/livewire/server/index.blade.php index c244b3d40..3e258c2da 100644 --- a/resources/views/livewire/server/index.blade.php +++ b/resources/views/livewire/server/index.blade.php @@ -11,7 +11,7 @@ @endcan
All your servers are here.
-