diff --git a/app/Livewire/Project/EnvironmentEdit.php b/app/Livewire/Project/EnvironmentEdit.php new file mode 100644 index 000000000..a87e2092b --- /dev/null +++ b/app/Livewire/Project/EnvironmentEdit.php @@ -0,0 +1,41 @@ + 'required|min:3|max:255', + 'environment.description' => 'nullable|min:3|max:255', + ]; + public function mount() { + $this->parameters = get_route_parameters(); + + $this->project = Project::ownedByCurrentTeam()->where('uuid', request()->route('project_uuid'))->first(); + $this->environment = $this->project->environments()->where('name', request()->route('environment_name'))->first(); + } + + public function submit() + { + $this->validate(); + try { + $this->environment->save(); + return redirect()->route('project.environment.edit', ['project_uuid' => $this->project->uuid, 'environment_name' => $this->environment->name]); + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function render() + { + return view('livewire.project.environment-edit'); + } +} diff --git a/database/migrations/2023_12_30_134507_add_description_to_environments.php b/database/migrations/2023_12_30_134507_add_description_to_environments.php new file mode 100644 index 000000000..0e8f4fec3 --- /dev/null +++ b/database/migrations/2023_12_30_134507_add_description_to_environments.php @@ -0,0 +1,28 @@ +string('description')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('environments', function (Blueprint $table) { + $table->dropColumn('description'); + }); + } +}; diff --git a/resources/views/livewire/project/environment-edit.blade.php b/resources/views/livewire/project/environment-edit.blade.php new file mode 100644 index 000000000..f88bbdb05 --- /dev/null +++ b/resources/views/livewire/project/environment-edit.blade.php @@ -0,0 +1,44 @@ +
+
+
+

Environment: {{ data_get($environment, 'name') }}

+ Save +
+ +
+ + +
+
+
diff --git a/resources/views/project/resources.blade.php b/resources/views/project/resources.blade.php index 2b93f5377..8e97bf324 100644 --- a/resources/views/project/resources.blade.php +++ b/resources/views/project/resources.blade.php @@ -3,13 +3,13 @@

Resources

@if ($environment->isEmpty()) - Clone @else - + New request()->route('project_uuid'), 'environment_name' => request()->route('environment_name')]) }} " + + Add New Resource @endif
@foreach ($environment->applications->sortBy('name') as $application) -
{{ $application->name }}
@@ -62,7 +62,7 @@ class="items-center justify-center box">+ Add New Resource
@endforeach @foreach ($environment->databases()->sortBy('name') as $database) -
{{ $database->name }}
@@ -78,7 +78,7 @@ class="items-center justify-center box">+ Add New Resource
@endforeach @foreach ($environment->services->sortBy('name') as $service) -
{{ $service->name }}
diff --git a/resources/views/project/show.blade.php b/resources/views/project/show.blade.php index db3abb069..98da15b32 100644 --- a/resources/views/project/show.blade.php +++ b/resources/views/project/show.blade.php @@ -10,12 +10,35 @@
{{ $project->name }}
@forelse ($project->environments as $environment) - - {{ $environment->name }} - + @empty

No environments found.

@endforelse +
diff --git a/routes/web.php b/routes/web.php index e27bca3d2..ffd907344 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,6 +13,7 @@ use App\Livewire\Dev\Compose as Compose; use App\Livewire\Dashboard; use App\Livewire\Project\CloneProject; +use App\Livewire\Project\EnvironmentEdit; use App\Livewire\Project\Shared\ExecuteContainerCommand; use App\Livewire\Project\Shared\Logs; use App\Livewire\Security\ApiTokens; @@ -113,6 +114,7 @@ Route::get('/project/{project_uuid}/{environment_name}/new', [ProjectController::class, 'new'])->name('project.resources.new'); Route::get('/project/{project_uuid}/{environment_name}', [ProjectController::class, 'resources'])->name('project.resources'); + Route::get('/project/{project_uuid}/{environment_name}/edit', EnvironmentEdit::class)->name('project.environment.edit'); // Applications Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}', ApplicationConfiguration::class)->name('project.application.configuration');