chore: add action for inscpector and tooltip env

This commit is contained in:
nivedin
2024-02-19 14:01:01 +05:30
committed by Andrew Bastin
parent 82d687f665
commit 52220d9a2e
2 changed files with 35 additions and 14 deletions

View File

@@ -125,11 +125,16 @@ const cursorTooltipField = (aggregateEnvs: AggregateEnvironment[]) =>
invokeActionType = "modals.my.environment.edit" invokeActionType = "modals.my.environment.edit"
} }
invokeAction(invokeActionType, { if (tooltipEnv?.sourceEnv === "RequestVariable") {
envName: tooltipEnv?.sourceEnv !== "Global" ? envName : "Global", restTabs.currentActiveTab.value.document.optionTabPreference =
variableName: parsedEnvKey, "requestVariables"
isSecret: tooltipEnv?.secret, } else {
}) invokeAction(invokeActionType, {
envName: tooltipEnv?.sourceEnv !== "Global" ? envName : "Global",
variableName: parsedEnvKey,
isSecret: tooltipEnv?.secret,
})
}
}) })
editIcon.innerHTML = `<span class="inline-flex items-center justify-center my-1">${IconEdit}</span>` editIcon.innerHTML = `<span class="inline-flex items-center justify-center my-1">${IconEdit}</span>`
tooltip.appendChild(editIcon) tooltip.appendChild(editIcon)

View File

@@ -154,7 +154,18 @@ export class EnvironmentInspectorService extends Service implements Inspector {
const formattedExEnv = exEnv.slice(2, -2) const formattedExEnv = exEnv.slice(2, -2)
const currentSelectedEnvironment = getCurrentEnvironment() const currentSelectedEnvironment = getCurrentEnvironment()
this.aggregateEnvsWithSecrets.value.forEach((env) => { const currentTab = this.restTabs.currentActiveTab.value
const environmentVariables = [
...currentTab.document.request.requestVariables.map((env) => ({
...env,
secret: false,
sourceEnv: "RequestVariable",
})),
...this.aggregateEnvsWithSecrets.value,
]
environmentVariables.forEach((env) => {
const hasSecretEnv = this.secretEnvs.hasSecretValue( const hasSecretEnv = this.secretEnvs.hasSecretValue(
env.sourceEnv !== "Global" env.sourceEnv !== "Global"
? currentSelectedEnvironment.id ? currentSelectedEnvironment.id
@@ -208,14 +219,19 @@ export class EnvironmentInspectorService extends Service implements Inspector {
"inspections.environment.add_environment_value" "inspections.environment.add_environment_value"
), ),
apply: () => { apply: () => {
invokeAction(invokeActionType, { if (env.sourceEnv === "RequestVariable") {
envName: currentTab.document.optionTabPreference =
env.sourceEnv !== "Global" "requestVariables"
? currentSelectedEnvironment.name } else {
: "Global", invokeAction(invokeActionType, {
variableName: formattedExEnv, envName:
isSecret: env.secret, env.sourceEnv !== "Global"
}) ? currentSelectedEnvironment.name
: "Global",
variableName: formattedExEnv,
isSecret: env.secret,
})
}
}, },
}, },
severity: 2, severity: 2,