fix: filter available scopes based on existing variables in env var input
This commit is contained in:
parent
e3df380a04
commit
99d22ae7d6
2 changed files with 16 additions and 4 deletions
|
|
@ -17,8 +17,15 @@
|
||||||
selectedIndex: 0,
|
selectedIndex: 0,
|
||||||
cursorPosition: 0,
|
cursorPosition: 0,
|
||||||
currentScope: null,
|
currentScope: null,
|
||||||
availableScopes: ['team', 'project', 'environment', 'server'],
|
|
||||||
availableVars: @js($availableVars),
|
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),
|
scopeUrls: @js($scopeUrls),
|
||||||
|
|
||||||
handleInput() {
|
handleInput() {
|
||||||
|
|
@ -54,6 +61,11 @@
|
||||||
|
|
||||||
if (content === '') {
|
if (content === '') {
|
||||||
this.currentScope = null;
|
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 => ({
|
this.suggestions = this.availableScopes.map(scope => ({
|
||||||
type: 'scope',
|
type: 'scope',
|
||||||
value: scope,
|
value: scope,
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
disabled
|
disabled
|
||||||
type="password"
|
type="password"
|
||||||
id="value"
|
id="value"
|
||||||
:availableVars="$this->availableSharedVariables"
|
:availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
|
||||||
:projectUuid="data_get($parameters, 'project_uuid')"
|
:projectUuid="data_get($parameters, 'project_uuid')"
|
||||||
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
||||||
:serverUuid="data_get($parameters, 'server_uuid')" />
|
:serverUuid="data_get($parameters, 'server_uuid')" />
|
||||||
|
|
@ -128,7 +128,7 @@
|
||||||
:required="$is_redis_credential"
|
:required="$is_redis_credential"
|
||||||
type="password"
|
type="password"
|
||||||
id="value"
|
id="value"
|
||||||
:availableVars="$this->availableSharedVariables"
|
:availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
|
||||||
:projectUuid="data_get($parameters, 'project_uuid')"
|
:projectUuid="data_get($parameters, 'project_uuid')"
|
||||||
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
||||||
:serverUuid="data_get($parameters, 'server_uuid')" />
|
:serverUuid="data_get($parameters, 'server_uuid')" />
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
disabled
|
disabled
|
||||||
type="password"
|
type="password"
|
||||||
id="value"
|
id="value"
|
||||||
:availableVars="$this->availableSharedVariables"
|
:availableVars="$isSharedVariable ? [] : $this->availableSharedVariables"
|
||||||
:projectUuid="data_get($parameters, 'project_uuid')"
|
:projectUuid="data_get($parameters, 'project_uuid')"
|
||||||
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
:environmentUuid="data_get($parameters, 'environment_uuid')"
|
||||||
:serverUuid="data_get($parameters, 'server_uuid')" />
|
:serverUuid="data_get($parameters, 'server_uuid')" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue