platypush/platypush/backend/http/webapp/dist/static/js/2106.00c755d8.js

2 lines
2.5 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[2106],{2106:function(a,e,l){l.r(e),l.d(e,{default:function(){return $}});var i=l(6252),s=l(9963);const t=a=>((0,i.dD)("data-v-4e3d4a40"),a=a(),(0,i.Cn)(),a),n={class:"variable-modal-container"},r={class:"row"},o=t((()=>(0,i._)("div",{class:"col-s-12 col-m-4 label"},[(0,i._)("label",{for:"name"},"Variable Name")],-1))),d={class:"col-s-12 col-m-8 value"},u=["disabled"],c={class:"row"},v=t((()=>(0,i._)("div",{class:"col-s-12 col-m-4 label"},[(0,i._)("label",{for:"name"},"Variable Value")],-1))),m={class:"col-s-12 col-m-8 value"},b=["disabled"],h={class:"row button-container"},p=["disabled"],f=t((()=>(0,i._)("i",{class:"fas fa-check"},null,-1))),V=[f];function _(a,e,l,t,f,_){const y=(0,i.up)("Modal");return(0,i.wg)(),(0,i.j4)(y,{visible:l.visible,title:"Set Variable",ref:"modal",onOpen:_.onOpen,onClose:e[3]||(e[3]=e=>a.$emit("close",e))},{default:(0,i.w5)((()=>[(0,i._)("div",n,[(0,i._)("form",{onSubmit:e[2]||(e[2]=(0,s.iM)(((...a)=>_.setValue&&_.setValue(...a)),["prevent"]))},[(0,i._)("div",r,[o,(0,i._)("div",d,[(0,i.wy)((0,i._)("input",{type:"text",id:"variable-name","onUpdate:modelValue":e[0]||(e[0]=a=>f.varName=a),placeholder:"Variable Name",disabled:f.loading,ref:"varName"},null,8,u),[[s.nr,f.varName]])])]),(0,i._)("div",c,[v,(0,i._)("div",m,[(0,i.wy)((0,i._)("input",{type:"text",id:"variable-value","onUpdate:modelValue":e[1]||(e[1]=a=>f.varValue=a),ref:"varValue",placeholder:"Variable Value",disabled:f.loading},null,8,b),[[s.nr,f.varValue]])])]),(0,i._)("div",h,[(0,i._)("button",{type:"submit",title:"Set",disabled:f.loading},V,8,p)])],32)])])),_:1},8,["visible","onOpen"])}var y=l(3493),g=l(8637),w={name:"VariableModal",components:{Modal:y.Z},mixins:[g.Z],emits:["close"],props:{visible:{type:Boolean,default:!1}},data(){return{loading:!1,varName:null,varValue:null}},methods:{async clearValue(){this.loading=!0;try{await this.request("variable.unset",{name:this.varName.trim()})}finally{this.loading=!1}},async setValue(){const a=this.varName.trim();a?.length||this.notifyWarning("No variable name has been specified");const e=this.varValue;if(e?.length){this.loading=!0;try{const l={};l[a]=e,await this.request("variable.set",l)}finally{this.loading=!1}}else await this.clearValue();this.$refs.varName.value="",this.$refs.varValue.value="",this.$refs.modal.close()},onOpen(){this.$nextTick((()=>{this.$refs.varName.focus()}))}}},N=l(3744);const k=(0,N.Z)(w,[["render",_],["__scopeId","data-v-4e3d4a40"]]);var $=k}}]);
//# sourceMappingURL=2106.00c755d8.js.map