feat: installation/update github apps
This commit is contained in:
@@ -35,7 +35,7 @@ class Change extends Component
|
||||
$this->private_key->save();
|
||||
session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class All extends Component
|
||||
$this->application->refresh();
|
||||
$this->emit('clearAddEnv');
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class All extends Component
|
||||
$this->application->refresh();
|
||||
$this->emit('clearAddStorage');
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
app/Http/Livewire/Project/Delete.php
Normal file
25
app/Http/Livewire/Project/Delete.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Project;
|
||||
|
||||
use App\Models\Project;
|
||||
use Livewire\Component;
|
||||
|
||||
class Delete extends Component
|
||||
{
|
||||
public int $project_id;
|
||||
public int $resource_count = 0;
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->validate([
|
||||
'project_id' => 'required|int',
|
||||
]);
|
||||
$project = Project::findOrFail($this->project_id);
|
||||
if ($project->applications->count() > 0) {
|
||||
return $this->emit('error', 'Project has applications, please delete them first.');
|
||||
}
|
||||
$project->delete();
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class GithubPrivateRepository extends Component
|
||||
public $github_apps;
|
||||
public GithubApp $github_app;
|
||||
public $parameters;
|
||||
public $type;
|
||||
|
||||
public int $selected_repository_id;
|
||||
public string $selected_repository_owner;
|
||||
@@ -110,8 +111,16 @@ class GithubPrivateRepository extends Component
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
if ($this->type === 'project') {
|
||||
$project = Project::create([
|
||||
'name' => generateRandomName(),
|
||||
'team_id' => session('currentTeam')->id
|
||||
]);
|
||||
$environment = $project->load(['environments'])->environments->first();
|
||||
} else {
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
}
|
||||
$application = Application::create([
|
||||
'name' => "{$this->selected_repository_owner}/{$this->selected_repository_repo}:{$this->selected_branch_name}",
|
||||
'git_repository' => "{$this->selected_repository_owner}/{$this->selected_repository_repo}",
|
||||
@@ -130,7 +139,7 @@ class GithubPrivateRepository extends Component
|
||||
'environment_name' => $environment->name
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
public function mount()
|
||||
|
||||
@@ -54,7 +54,7 @@ class Form extends Component
|
||||
$this->dockerComposeVersion = 'Not installed.';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
public function delete()
|
||||
|
||||
@@ -31,7 +31,7 @@ class Create extends Component
|
||||
"custom_port" => 'required|int',
|
||||
"is_system_wide" => 'required|bool',
|
||||
]);
|
||||
GithubApp::create([
|
||||
$github_app = GithubApp::create([
|
||||
'name' => $this->name,
|
||||
'organization' => $this->organization,
|
||||
'api_url' => $this->api_url,
|
||||
@@ -41,8 +41,9 @@ class Create extends Component
|
||||
'is_system_wide' => $this->is_system_wide,
|
||||
'team_id' => session('currentTeam')->id,
|
||||
]);
|
||||
redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]);
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class Change extends Component
|
||||
$this->validate();
|
||||
$this->github_app->save();
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
public function instantSave()
|
||||
@@ -46,7 +46,7 @@ class Change extends Component
|
||||
$this->github_app->save();
|
||||
$this->emit('saved', 'GitHub settings updated!');
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
public function mount()
|
||||
@@ -64,7 +64,7 @@ class Change extends Component
|
||||
$this->github_app->delete();
|
||||
redirect()->route('dashboard');
|
||||
} catch (\Exception $e) {
|
||||
return generalErrorHandlerLivewire($e, $this);
|
||||
return generalErrorHandler($e, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ class RouteServiceProvider extends ServiceProvider
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::prefix('webhooks')
|
||||
->group(base_path('routes/webhooks.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user