diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.php index 61c4ffcda..b7acb30a7 100644 --- a/app/Livewire/Source/Github/Change.php +++ b/app/Livewire/Source/Github/Change.php @@ -24,6 +24,8 @@ class Change extends Component public string $name; public bool $is_system_wide; + public $applications; + protected $rules = [ 'github_app.name' => 'required|string', 'github_app.organization' => 'nullable|string', @@ -90,6 +92,7 @@ class Change extends Component if (!$this->github_app) { return redirect()->route('source.all'); } + $this->applications = $this->github_app->applications; $settings = InstanceSettings::get(); $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); @@ -170,6 +173,11 @@ class Change extends Component public function delete() { try { + if ($this->github_app->applications->isNotEmpty()) { + $this->dispatch('error', 'This source is being used by an application. Please delete all applications first.'); + $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); + return; + } $this->github_app->delete(); return redirect()->route('source.all'); } catch (\Throwable $e) { diff --git a/resources/views/livewire/server/resources.blade.php b/resources/views/livewire/server/resources.blade.php index 807b3172b..0b9f9d854 100644 --- a/resources/views/livewire/server/resources.blade.php +++ b/resources/views/livewire/server/resources.blade.php @@ -45,7 +45,8 @@ {{ data_get($resource, 'environment.name') }}
| Project + | ++ Environment | +Name | +Type | +
|---|---|---|---|
| + {{ data_get($resource->project(), 'name') }} + | ++ {{ data_get($resource, 'environment.name') }} + | +{{ $resource->name }}
+ |
+ + {{ str($resource->type())->headline() }} | +