diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 65f0bd437..2a1a47b4d 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -45,6 +45,7 @@ public function updatedSearch() unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); } public function mount() @@ -111,6 +112,19 @@ private function searchTerm(): string return trim($this->search); } + public function getHasEnvironmentVariablesProperty(): bool + { + return $this->environmentVariables->isNotEmpty() || + $this->environmentVariablesPreview->isNotEmpty() || + $this->hardcodedEnvironmentVariables->isNotEmpty() || + $this->hardcodedEnvironmentVariablesPreview->isNotEmpty(); + } + + public function getIsSearchActiveProperty(): bool + { + return $this->searchTerm() !== ''; + } + public function getHardcodedEnvironmentVariablesProperty() { return $this->getHardcodedVariables(false); @@ -313,6 +327,7 @@ private function handleSingleSubmit($data) unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); $this->dispatch('success', 'Environment variable added.'); } @@ -446,6 +461,7 @@ public function refreshEnvs() unset($this->environmentVariablesPreview); unset($this->hardcodedEnvironmentVariables); unset($this->hardcodedEnvironmentVariablesPreview); + unset($this->hasEnvironmentVariables); $this->getDevView(); } } diff --git a/resources/views/livewire/project/shared/environment-variable/all.blade.php b/resources/views/livewire/project/shared/environment-variable/all.blade.php index 77ac92ffe..f49765286 100644 --- a/resources/views/livewire/project/shared/environment-variable/all.blade.php +++ b/resources/views/livewire/project/shared/environment-variable/all.blade.php @@ -43,64 +43,66 @@ @endif @if ($view === 'normal') -