Initial environment state system refactor

This commit is contained in:
Andrew Bastin
2021-06-04 22:41:07 -04:00
parent c3f713c0bd
commit 5bfeb541fc
11 changed files with 430 additions and 226 deletions

View File

@@ -541,7 +541,7 @@
</SmartTab>
<SmartTab :id="'env'" :label="$t('environments')">
<Environments @use-environment="useSelectedEnvironment($event)" />
<Environments />
</SmartTab>
<SmartTab :id="'notes'" :label="$t('notes')">
@@ -1191,29 +1191,6 @@ export default {
},
},
methods: {
useSelectedEnvironment(args) {
let environment = args.environment
let environments = args.environments
let preRequestScriptString = ""
for (let variable of environment.variables) {
preRequestScriptString += `pw.env.set('${variable.key}', '${variable.value}');\n`
}
for (let env of environments) {
if (env.name === environment.name) {
continue
}
if (env.name === "Globals" || env.name === "globals") {
preRequestScriptString += this.useSelectedEnvironment({
environment: env,
environments,
})
}
}
this.preRequestScript = preRequestScriptString
this.showPreRequestScript = true
return preRequestScriptString
},
checkCollections() {
const checkCollectionAvailability =
this.$store.state.postwoman.collections &&