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

This commit is contained in:
Andras Bacsai 2026-01-02 17:31:00 +01:00
parent e3df380a04
commit 99d22ae7d6
2 changed files with 16 additions and 4 deletions

View file

@ -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,

View file

@ -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')" />