refactor: change default env name from 'global' to 'Global'

This commit is contained in:
liyasthomas
2021-08-18 10:44:58 +05:30
parent c949783698
commit 4f5de51104
4 changed files with 13 additions and 13 deletions

View File

@@ -10,7 +10,7 @@
class="input floating-input" class="input floating-input"
placeholder=" " placeholder=" "
type="text" type="text"
:disabled="editingEnvironmentIndex === 'global'" :disabled="editingEnvironmentIndex === 'Global'"
@keyup.enter="saveEnvironment" @keyup.enter="saveEnvironment"
/> />
<label for="selectLabelEnvEdit"> <label for="selectLabelEnvEdit">
@@ -114,7 +114,7 @@ export default defineComponent({
props: { props: {
show: Boolean, show: Boolean,
editingEnvironmentIndex: { editingEnvironmentIndex: {
type: [Number, String] as PropType<number | "global" | null>, type: [Number, String] as PropType<number | "Global" | null>,
default: null, default: null,
}, },
}, },
@@ -122,7 +122,7 @@ export default defineComponent({
const workingEnv = computed(() => { const workingEnv = computed(() => {
if (props.editingEnvironmentIndex === null) return null if (props.editingEnvironmentIndex === null) return null
if (props.editingEnvironmentIndex === "global") { if (props.editingEnvironmentIndex === "Global") {
return { return {
name: "Global", name: "Global",
variables: getGlobalVariables(), variables: getGlobalVariables(),
@@ -180,7 +180,7 @@ export default defineComponent({
variables: this.vars, variables: this.vars,
} }
if (this.editingEnvironmentIndex === "global") if (this.editingEnvironmentIndex === "Global")
setGlobalEnvVariables(environmentUpdated.variables) setGlobalEnvVariables(environmentUpdated.variables)
else updateEnvironment(this.editingEnvironmentIndex!, environmentUpdated) else updateEnvironment(this.editingEnvironmentIndex!, environmentUpdated)
this.hideModal() this.hideModal()

View File

@@ -40,7 +40,7 @@
" "
/> />
<SmartItem <SmartItem
v-if="!(environmentIndex === 'global')" v-if="!(environmentIndex === 'Global')"
icon="remove_circle_outline" icon="remove_circle_outline"
color="red" color="red"
:label="$t('delete')" :label="$t('delete')"
@@ -69,7 +69,7 @@ export default Vue.extend({
props: { props: {
environment: { type: Object, default: () => {} }, environment: { type: Object, default: () => {} },
environmentIndex: { environmentIndex: {
type: [Number, String] as PropType<number | "global">, type: [Number, String] as PropType<number | "Global">,
default: null, default: null,
}, },
}, },
@@ -80,7 +80,7 @@ export default Vue.extend({
}, },
methods: { methods: {
removeEnvironment() { removeEnvironment() {
if (this.environmentIndex !== "global") if (this.environmentIndex !== "Global")
deleteEnvironment(this.environmentIndex) deleteEnvironment(this.environmentIndex)
this.$toast.error(this.$t("deleted").toString(), { this.$toast.error(this.$t("deleted").toString(), {
icon: "delete", icon: "delete",

View File

@@ -76,10 +76,10 @@
/> />
<div class="flex flex-col"> <div class="flex flex-col">
<EnvironmentsEnvironment <EnvironmentsEnvironment
environment-index="global" environment-index="Global"
:environment="globalEnvironment" :environment="globalEnvironment"
class="border-b border-dashed border-dividerLight" class="border-b border-dashed border-dividerLight"
@edit-environment="editEnvironment('global')" @edit-environment="editEnvironment('Global')"
/> />
<EnvironmentsEnvironment <EnvironmentsEnvironment
v-for="(environment, index) in environments" v-for="(environment, index) in environments"
@@ -139,7 +139,7 @@ export default defineComponent({
showModalImportExport: false, showModalImportExport: false,
showModalAdd: false, showModalAdd: false,
showModalEdit: false, showModalEdit: false,
editingEnvironmentIndex: undefined as number | "global" | undefined, editingEnvironmentIndex: undefined as number | "Global" | undefined,
} }
}, },
methods: { methods: {
@@ -154,7 +154,7 @@ export default defineComponent({
displayModalImportExport(shouldDisplay: boolean) { displayModalImportExport(shouldDisplay: boolean) {
this.showModalImportExport = shouldDisplay this.showModalImportExport = shouldDisplay
}, },
editEnvironment(environmentIndex: number | "global") { editEnvironment(environmentIndex: number | "Global") {
this.$data.editingEnvironmentIndex = environmentIndex this.$data.editingEnvironmentIndex = environmentIndex
this.displayModalEdit(true) this.displayModalEdit(true)
}, },

View File

@@ -262,7 +262,7 @@ export const currentEnvironment$ = combineLatest([
/** /**
* Stream returning all the environment variables accessible in * Stream returning all the environment variables accessible in
* the current state (Global + The Selected Environment). * the current state (Global + The Selected Environment).
* NOTE: The source environment attribute will be "global" for Global Env as source. * NOTE: The source environment attribute will be "Global" for Global Env as source.
*/ */
export const aggregateEnvs$ = combineLatest([ export const aggregateEnvs$ = combineLatest([
currentEnvironment$, currentEnvironment$,
@@ -275,7 +275,7 @@ export const aggregateEnvs$ = combineLatest([
results.push({ key, value, sourceEnv: selectedEnv.name }) results.push({ key, value, sourceEnv: selectedEnv.name })
) )
globalVars.forEach(({ key, value }) => globalVars.forEach(({ key, value }) =>
results.push({ key, value, sourceEnv: "global" }) results.push({ key, value, sourceEnv: "Global" })
) )
return results return results