Show all variables as undefined when no environment is selected
This commit is contained in:
parent
4b43a509b0
commit
3659543bd2
@ -723,19 +723,28 @@ class RequestTabWidget(Gtk.Box):
|
|||||||
|
|
||||||
def _detect_undefined_variables(self):
|
def _detect_undefined_variables(self):
|
||||||
"""Detect undefined variables in the current request. Returns set of undefined variable names."""
|
"""Detect undefined variables in the current request. Returns set of undefined variable names."""
|
||||||
# Only detect if environment is selected
|
from .variable_substitution import VariableSubstitution
|
||||||
env = self.get_selected_environment()
|
|
||||||
if not env:
|
|
||||||
return set()
|
|
||||||
|
|
||||||
# Get current request from UI
|
# Get current request from UI
|
||||||
request = self.get_request()
|
request = self.get_request()
|
||||||
|
|
||||||
# Use VariableSubstitution to detect undefined variables
|
# Get selected environment
|
||||||
from .variable_substitution import VariableSubstitution
|
env = self.get_selected_environment()
|
||||||
_, undefined = VariableSubstitution.substitute_request(request, env)
|
|
||||||
|
|
||||||
return undefined
|
if not env:
|
||||||
|
# No environment selected - ALL variables are undefined
|
||||||
|
# Find all variables in the request
|
||||||
|
all_vars = set()
|
||||||
|
all_vars.update(VariableSubstitution.find_variables(request.url))
|
||||||
|
all_vars.update(VariableSubstitution.find_variables(request.body))
|
||||||
|
for key, value in request.headers.items():
|
||||||
|
all_vars.update(VariableSubstitution.find_variables(key))
|
||||||
|
all_vars.update(VariableSubstitution.find_variables(value))
|
||||||
|
return all_vars
|
||||||
|
else:
|
||||||
|
# Environment selected - find which variables are undefined
|
||||||
|
_, undefined = VariableSubstitution.substitute_request(request, env)
|
||||||
|
return undefined
|
||||||
|
|
||||||
def _schedule_indicator_update(self):
|
def _schedule_indicator_update(self):
|
||||||
"""Schedule an indicator update with debouncing."""
|
"""Schedule an indicator update with debouncing."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user