text: (window.webpackJsonp=window.webpackJsonp||[]).push([[64],{933:function(t,e,n){"use strict";n.r(e);n(42),n(17),n(16),n(8),n(35);var o=n(14),r=(n(11),n(242),n(268)),l=n(238);function c(object,t){var e=Object.keys(object);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(object);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(object,t).enumerable}))),e.push.apply(e,n)}return e}var v={directives:{textareaAutoHeight:r.a},props:{show:Boolean,editingEnvironment:Object,editingEnvironmentIndex:Number},components:{modal:function(){return n.e(0).then(n.bind(null,937))}},data:function(){return{name:void 0}},watch:{editingEnvironment:function(t){this.name=this.$props.editingEnvironment&&this.$props.editingEnvironment.name?this.$props.editingEnvironment.name:void 0,this.$store.commit("postwoman/setEditingEnvironment",this.$props.editingEnvironment)}},computed:{editingEnvCopy:function(){return this.$store.state.postwoman.editingEnvironment},variableString:function(){var t=this.editingEnvCopy.variables;return""===t?"":JSON.stringify(t)}},methods:{syncEnvironments:function(){null!==l.a.currentUser&&l.a.currentSettings[1].value&&l.a.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))},clearContent:function(t){this.$store.commit("postwoman/removeVariables",[]),t.target.innerHTML=this.doneButton,this.$toast.info(this.$t("cleared"),{icon:"clear_all"}),setTimeout((function(){return t.target.innerHTML='<i class="material-icons">clear_all</i>'}),1e3)},addEnvironmentVariable:function(){this.$store.commit("postwoman/addVariable",{key:"",value:""}),this.syncEnvironments()},removeEnvironmentVariable:function(t){var e=this,n=t,o=this.editingEnvCopy.variables.slice(),r=this.editingEnvCopy.variables.filter((function(t,e){return n!==e}));this.$store.commit("postwoman/removeVariable",r),this.$toast.error(this.$t("deleted"),{icon:"delete",action:{text:this.$t("undo"),onClick:function(t,n){e.$store.commit("postwoman/removeVariable",o),n.remove()}}}),this.syncEnvironments()},saveEnvironment:function(){if(this.$data.name){var t=function(t){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?c(Object(source),!0).forEach((function(e){Object(o.a)(t,e,source[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(source)):c(Object(source)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(source,e))}))}return t}({},this.editingEnvCopy,{name:this.$data.name});this.$store.commit("postwoman/saveEnvironment",{environment:t,environmentIndex:this.$props.editingEnvironmentIndex}),this.$emit("hide-modal"),this.syncEnvironments()}else this.$toast.info(this.$t("invalid_environment_name"))},hideModal:function(){this.$emit("hide-modal"),this.$data.name=void 0}}},m=n(41),component=Object(m.a)(v,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.show?n("modal",{on:{close:t.hideModal}},[n("div",{attrs:{slot:"header"},slot:"header"},[n("ul",[n("li",[n("div",{staticClass:"flex-wrap"},[n("h3",{staticClass:"title"},[t._v(t._s(t.$t("edit_environment")))]),t._v(" "),n("div",[n("button",{staticClass:"icon",on:{click:t.hideModal}},[n("i",{staticClass:"material-icons"},[t._v("close")])])])])])])]),t._v(" "),n("div",{attrs:{slot:"body"},slot:"body"},[n("ul",[n("li",[n("input",{directives:[{name:"model",rawName:"v-model",value:t.name,expression:"name"}],attrs:{type:"text",placeholder:t.editingEnvironment.name},domProps:{value:t.name},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.saveEnvironment(e)},input:function(e){e.target.composing||(t.name=e.target.value)}}})])]),t._v(" "),n("ul",[n("li",[n("div",{staticClass:"flex-wrap"},[n("label",{attrs:{for:"variableList"}},[t._v(t._s(t.$t("env_variable_list")))]),t._v(" "),n("div",[n("button",{directives:[{name:"tooltip",rawName:"v-tooltip.bottom",value:t.$t("clear"),expression:"$t('clear')",modifiers:{bottom:!0}}],staticClass:"icon",on:{click:function(e){return t.clearContent(e)}}},[n("i",{staticClass:"material-icons"},[t._v("clear_all")])])])]),t._v(" "),n("textarea",{directives:[{name:"textarea-auto-height",rawName:"v-textarea-auto-height",value:t.variableString,expression:"variableString"},{name:"model",rawName:"v-model",value:t.variableString,expression:"variableString"}],attrs:{id:"variableList",readonly:"",placeholder:t.$t("add_one_variable"),rows:"1"},domProps:{value:t.variableString},on:{input:function(e){e.target.composing||(t.variableString=e.target.value)}}})])]),t._v(" "),t._l(this.editingEnvCopy.variables,(function(e,o){return n("ul",{key:o},[n("li",[n("input",{attrs:{placeholder:t.$t("parameter_count",{count:o+1}),name:"param"+o,autofocus:""},domProps:{value:e.key},on:{change:function(e){return t.$store.commit("postwoman/setVariableKey",{index:o,value:e.target.value})}}})]),t._v(" "),n("li",[n("input",{attrs:{placeholder:t.$t("value_count",{count:o+1}),name:"value"+o},domProps:{value:"string"==typeof e.value?e.value:JSON.stringify(e.value)},on:{change:function(e){return t.$store.commit("postwoman/setVariableValue",{index:o,value:e.target.value})}}})]),t._v(" "),n("div",[n("li",[n("button",{directives:[{name:"tooltip",rawName:"v-tooltip.bottom",value:t.$t("delete"),expression:"$t('delete')",modifiers:{bottom:!0}}],staticClass:"icon",attrs:{id:"variable"},on:{click:function(e){return t.removeEnvironmentVariable(o)}}},[n("i",{staticClass:"material-icons"},[t._v("delete")])])])])])})),t._v(" "),n("ul",[n("li",[n("button",{staticClass:"icon",on:{click:t.addEnvironmentVariable}},[n("i",{staticClass:"material-icons"},[t._v("add")]),t._v(" "),n("span",[t._v(t._s(t.$t("add_new")))])])])])],2),t._v(" "),n("div",{attrs:{slot:"footer"},slot:"footer"},[n("div",{staticClass:"flex-wrap"},[n("span"),t._v(" "),n("span",[n("button",{staticClass:"icon",on:{click:t.hideModal}},[t._v("\n          "+t._s(t.$t("cancel"))+"\n        ")]),t._v(" "),n("button",{staticClass:"icon primary",on:{click:t.saveEnvironment}},[t._v("\n          "+t._s(t.$t("save"))+"\n        ")])])])])]):t._e()}),[],!1,null,null,null);e.default=component.exports}}]);