From cfe9aed42a89bc66d715e8408ee6fb1726718ade Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 22 Jun 2023 09:33:26 +0200 Subject: [PATCH] wip --- app/Http/Controllers/ProjectController.php | 10 ++++++++ app/Http/Livewire/Project/Edit.php | 25 +++++++++++++++++++ .../views/livewire/project/edit.blade.php | 9 +++++++ ...ub-private-repository-deploy-key.blade.php | 2 +- resources/views/project/edit.blade.php | 3 +++ resources/views/projects.blade.php | 25 +++++++++++++++++-- routes/web.php | 1 + 7 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 app/Http/Livewire/Project/Edit.php create mode 100644 resources/views/livewire/project/edit.blade.php create mode 100644 resources/views/project/edit.blade.php diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 79202a65a..432e72f39 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -14,6 +14,16 @@ public function all() return view('projects', ['projects' => $projects]); } + public function edit() + { + $projectUuid = request()->route('project_uuid'); + $teamId = session('currentTeam')->id; + $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first(); + if (!$project) { + return redirect()->route('dashboard'); + } + return view('project.edit', ['project' => $project]); + } public function show() { $projectUuid = request()->route('project_uuid'); diff --git a/app/Http/Livewire/Project/Edit.php b/app/Http/Livewire/Project/Edit.php new file mode 100644 index 000000000..aa759e05e --- /dev/null +++ b/app/Http/Livewire/Project/Edit.php @@ -0,0 +1,25 @@ + 'required|min:3|max:255', + 'project.description' => 'nullable|string|max:255', + ]; + public function submit() + { + $this->validate(); + try { + $this->project->save(); + $this->emit('saved'); + } catch (\Exception $e) { + return general_error_handler($e, $this); + } + } +} diff --git a/resources/views/livewire/project/edit.blade.php b/resources/views/livewire/project/edit.blade.php new file mode 100644 index 000000000..a7ff0f68f --- /dev/null +++ b/resources/views/livewire/project/edit.blade.php @@ -0,0 +1,9 @@ +
+

{{ data_get($project, 'name') }}

+
Edit project details
+
+ + + Save + +
diff --git a/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php b/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php index d3564a37f..b82055dc7 100644 --- a/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php +++ b/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php @@ -1,6 +1,6 @@

Create a new Application

-
Deploy any public or private GIT repositories through a Deploy Key.
+
Deploy any public or private GIT repositories through a Deploy Key.

Select a Private Key

@foreach ($private_keys as $key) @if ($private_key_id == $key->id) diff --git a/resources/views/project/edit.blade.php b/resources/views/project/edit.blade.php new file mode 100644 index 000000000..14746275f --- /dev/null +++ b/resources/views/project/edit.blade.php @@ -0,0 +1,3 @@ + + + diff --git a/resources/views/projects.blade.php b/resources/views/projects.blade.php index 933644505..0218e2e4b 100644 --- a/resources/views/projects.blade.php +++ b/resources/views/projects.blade.php @@ -3,13 +3,34 @@
All Projects
@forelse ($projects as $project) - {{ $project->name }} + @empty
No project found.
@endforelse +
diff --git a/routes/web.php b/routes/web.php index e3a8f0b00..73e858d64 100644 --- a/routes/web.php +++ b/routes/web.php @@ -47,6 +47,7 @@ Route::middleware(['auth'])->group(function () { Route::get('/projects', [ProjectController::class, 'all'])->name('projects'); + Route::get('/project/{project_uuid}/edit', [ProjectController::class, 'edit'])->name('project.edit'); Route::get('/project/{project_uuid}', [ProjectController::class, 'show'])->name('project.show'); 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');