Allow duplication of global environment (#1924)
This commit is contained in:
@@ -42,7 +42,6 @@
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<SmartItem
|
<SmartItem
|
||||||
v-if="!(environmentIndex === 'Global')"
|
|
||||||
svg="copy"
|
svg="copy"
|
||||||
:label="`${$t('action.duplicate')}`"
|
:label="`${$t('action.duplicate')}`"
|
||||||
@click.native="
|
@click.native="
|
||||||
@@ -80,6 +79,10 @@ import { defineComponent, PropType } from "@nuxtjs/composition-api"
|
|||||||
import {
|
import {
|
||||||
deleteEnvironment,
|
deleteEnvironment,
|
||||||
duplicateEnvironment,
|
duplicateEnvironment,
|
||||||
|
createEnvironment,
|
||||||
|
setEnvironmentVariables,
|
||||||
|
getGlobalVariables,
|
||||||
|
environmentsStore,
|
||||||
} from "~/newstore/environments"
|
} from "~/newstore/environments"
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -104,8 +107,16 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
duplicateEnvironment() {
|
duplicateEnvironment() {
|
||||||
if (this.environmentIndex !== "Global")
|
if (this.environmentIndex === "Global") {
|
||||||
duplicateEnvironment(this.environmentIndex)
|
createEnvironment("Global-Copy")
|
||||||
|
setEnvironmentVariables(
|
||||||
|
environmentsStore.value.environments.length - 1,
|
||||||
|
getGlobalVariables().reduce((gVars, gVar) => {
|
||||||
|
gVars.push({ key: gVar.key, value: gVar.value })
|
||||||
|
return gVars
|
||||||
|
}, [])
|
||||||
|
)
|
||||||
|
} else duplicateEnvironment(this.environmentIndex)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user