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') }} {{ $resource->name }} + href="{{ $resource->link() }}">{{ $resource->name }} + {{ str($resource->type())->headline() }} @@ -138,6 +139,4 @@ - - diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php index 2eae0a8bd..c369d2f42 100644 --- a/resources/views/livewire/source/github/change.blade.php +++ b/resources/views/livewire/source/github/change.blade.php @@ -69,7 +69,7 @@
-

Permissions

+

Permissions

Refetch @@ -93,6 +93,57 @@
@endif +
+
+
+
+

Resources

+
+
Here you can find all resources that are used by this source.
+
+
+
+
+
+
+ + + + + + + + + + + @forelse ($applications->sortBy('name',SORT_NATURAL) as $resource) + + + + + + + @empty + @endforelse + +
Project + + EnvironmentNameType
+ {{ data_get($resource->project(), 'name') }} + + {{ data_get($resource, 'environment.name') }} + {{ $resource->name }} + + + {{ str($resource->type())->headline() }}
+
+
+
+
+
+
+
@else

GitHub App