Review Updates

This commit is contained in:
Jacob Anavisca
2020-02-23 22:21:10 -05:00
parent 54d590765f
commit 00fa17b31f
4 changed files with 50 additions and 16 deletions

View File

@@ -69,7 +69,7 @@ export default {
},
addNewEnvironment() {
if (!this.$data.name) {
this.$toast.info($t("invalid_environment_name"));
this.$toast.info(this.$t("invalid_environment_name"));
return;
}
let newEnvironment = [
@@ -78,11 +78,15 @@ export default {
variables: []
}
];
this.$store.commit("postwoman/importAddEnvironments", newEnvironment);
this.$store.commit("postwoman/importAddEnvironments", {
environments: newEnvironment,
confirmation: "Environment added"
});
this.$emit("hide-modal");
this.syncEnvironments();
},
hideModal() {
this.$data.name = undefined;
this.$emit("hide-modal");
}
}

View File

@@ -71,7 +71,11 @@
<input
:placeholder="$t('value_count', { count: index + 1 })"
:name="'value' + index"
:value="variable.value"
:value="
typeof variable.value === 'string'
? variable.value
: JSON.stringify(variable.value)
"
@change="
$store.commit('postwoman/setVariableValue', {
index,
@@ -140,6 +144,9 @@ export default {
},
watch: {
editingEnvironment: function(update) {
this.name = this.$props.editingEnvironment && this.$props.editingEnvironment.name
? this.$props.editingEnvironment.name
: undefined
this.$store.commit(
"postwoman/setEditingEnvironment",
this.$props.editingEnvironment

View File

@@ -119,8 +119,8 @@ export default {
let reader = new FileReader();
reader.onload = event => {
let content = event.target.result;
let environment = JSON.parse(content);
this.$store.commit("postwoman/replaceEnvironments", environment);
let environments = JSON.parse(content);
this.$store.commit("postwoman/replaceEnvironments", environments);
};
reader.readAsText(this.$refs.inputChooseFileToReplaceWith.files[0]);
this.fileImported();
@@ -129,11 +129,14 @@ export default {
let reader = new FileReader();
reader.onload = event => {
let content = event.target.result;
let environment = JSON.parse(content);
this.$store.commit("postwoman/importAddEnvironments", environment);
let environments = JSON.parse(content);
let confirmation = this.$t("file_imported")
this.$store.commit("postwoman/importAddEnvironments", {
environments,
confirmation
});
};
reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0]);
this.fileImported();
},
exportJSON() {
let text = this.environmentJson;