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"
}
invokeAction(invokeActionType, {
envName: tooltipEnv?.sourceEnv !== "Global" ? envName : "Global",
variableName: parsedEnvKey,
isSecret: tooltipEnv?.secret,
})
if (tooltipEnv?.sourceEnv === "RequestVariable") {
restTabs.currentActiveTab.value.document.optionTabPreference =
"requestVariables"
} 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>`
tooltip.appendChild(editIcon)

View File

@@ -154,7 +154,18 @@ export class EnvironmentInspectorService extends Service implements Inspector {
const formattedExEnv = exEnv.slice(2, -2)
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(
env.sourceEnv !== "Global"
? currentSelectedEnvironment.id
@@ -208,14 +219,19 @@ export class EnvironmentInspectorService extends Service implements Inspector {
"inspections.environment.add_environment_value"
),
apply: () => {
invokeAction(invokeActionType, {
envName:
env.sourceEnv !== "Global"
? currentSelectedEnvironment.name
: "Global",
variableName: formattedExEnv,
isSecret: env.secret,
})
if (env.sourceEnv === "RequestVariable") {
currentTab.document.optionTabPreference =
"requestVariables"
} else {
invokeAction(invokeActionType, {
envName:
env.sourceEnv !== "Global"
? currentSelectedEnvironment.name
: "Global",
variableName: formattedExEnv,
isSecret: env.secret,
})
}
},
},
severity: 2,