From d383344ab91d581e6528a8dea43e07b3fd92977d Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sun, 6 Apr 2025 21:13:11 +0200 Subject: [PATCH] feat(EnvironmentVariable): add handling for Redis credentials in the environment variable component --- .../Shared/EnvironmentVariable/Show.php | 11 +++- .../environment-variable/show.blade.php | 50 ++++++++++--------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php index 3a7d0faa5..f35a38bde 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php @@ -40,6 +40,8 @@ class Show extends Component public bool $is_really_required = false; + public bool $is_redis_credential = false; + protected $listeners = [ 'refreshEnvs' => 'refresh', 'refresh', @@ -65,7 +67,9 @@ class Show extends Component } $this->parameters = get_route_parameters(); $this->checkEnvs(); - + if ($this->type === 'standalone-redis' && ($this->env->key === 'REDIS_PASSWORD' || $this->env->key === 'REDIS_USERNAME')) { + $this->is_redis_credential = true; + } } public function refresh() @@ -171,6 +175,11 @@ class Show extends Component public function delete() { try { + if ($this->is_redis_credential) { + $this->dispatch('error', 'Cannot delete Redis credentials.'); + + return; + } $this->env->delete(); $this->dispatch('environmentVariableDeleted'); $this->dispatch('success', 'Environment variable deleted successfully.'); diff --git a/resources/views/livewire/project/shared/environment-variable/show.blade.php b/resources/views/livewire/project/shared/environment-variable/show.blade.php index e3130e805..4d54df3bd 100644 --- a/resources/views/livewire/project/shared/environment-variable/show.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php @@ -31,46 +31,48 @@ @else
@if ($is_multiline) - - + + @else - - + + @endif @if ($is_shared) - + @endif
@endif
- @if ($type === 'service') - - - - @else - @if ($is_shared) + @if (!$is_redis_credential) + @if ($type === 'service') + @else - @if ($isSharedVariable) - - @else + @if ($is_shared) - - @if ($is_multiline === false) - + + @else + @if ($isSharedVariable) + + @else + + + @if ($is_multiline === false) + + @endif @endif @endif @endif