Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: filter available scopes based on existing variables in env var input

Andras Bacsai99d22ae7d68b
diff --git a/resources/views/components/forms/env-var-input.blade.php b/resources/views/components/forms/env-var-input.blade.php
index dde535f193..61e308a832 100644
--- a/resources/views/components/forms/env-var-input.blade.php
+++ b/resources/views/components/forms/env-var-input.blade.php
@@ -17,8 +17,15 @@
selectedIndex: 0,
cursorPosition: 0,
currentScope: null,
- availableScopes: ['team', 'project', 'environment', 'server'],
availableVars: @js($availableVars),
+ get availableScopes() {
+ // Only include scopes that have at least one variable
+ const allScopes = ['team', 'project', 'environment', 'server'];
+ return allScopes.filter(scope => {
+ const vars = this.availableVars[scope];
+ return vars && vars.length > 0;
+ });
+ },
scopeUrls: @js($scopeUrls),
handleInput() {
@@ -54,6 +61,11 @@
if (content === '') {
this.currentScope = null;
+ // Only show dropdown if there are available scopes with variables
+ if (this.availableScopes.length === 0) {
+ this.showDropdown = false;
+ return;
+ }
this.suggestions = this.availableScopes.map(scope => ({
type: 'scope',
value: scope,
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 d2195c2afe..4dc46bbbbf 100644
--- a/resources/views/livewire/project/shared/environment-variable/show.blade.php
+++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php
@@ -109,7 +109,7 @@
disabled
type="password"
id="value"
- :availableVars="$this->availableSharedVariables"
+ :availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
:projectUuid="data_get($parameters, 'project_uuid')"
:environmentUuid="data_get($parameters, 'environment_uuid')"
:serverUuid="data_get($parameters, 'server_uuid')" />
@@ -128,7 +128,7 @@
:required="$is_redis_credential"
type="password"
id="value"
- :availableVars="$this->availableSharedVariables"
+ :availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
:projectUuid="data_get($parameters, 'project_uuid')"
:environmentUuid="data_get($parameters, 'environment_uuid')"
:serverUuid="data_get($parameters, 'server_uuid')" />
@@ -145,7 +145,7 @@
disabled
type="password"
id="value"
- :availableVars="$this->availableSharedVariables"
+ :availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
:projectUuid="data_get($parameters, 'project_uuid')"
:environmentUuid="data_get($parameters, 'environment_uuid')"
:serverUuid="data_get($parameters, 'server_uuid')" />