platypush/platypush/backend/http/webapp/dist/static/js/8358.c0dcf298.js

2 lines
2.9 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[8358],{8358:function(l,e,a){a.r(e),a.d(e,{default:function(){return D}});var t=a(6252),s=a(3577),i=a(9963);const n=l=>((0,t.dD)("data-v-0f534cfd"),l=l(),(0,t.Cn)(),l),o={key:0,class:"entity variable-container"},c={class:"col-1 icon"},d={class:"col-s-6 col-m-7 label"},u=["textContent"],r=["textContent"],v={class:"row"},p={class:"row"},f={class:"col-9"},h=["value","disabled"],_={class:"col-3 pull-right"},b=["disabled"],m=n((()=>(0,t._)("i",{class:"fas fa-trash"},null,-1))),y=[m],g=["disabled"],k=n((()=>(0,t._)("i",{class:"fas fa-check"},null,-1))),C=[k];function w(l,e,a,n,m,k){const w=(0,t.up)("EntityIcon");return null!=l.value.value?((0,t.wg)(),(0,t.iD)("div",o,[(0,t._)("div",{class:(0,s.C_)(["head",{collapsed:l.collapsed}])},[(0,t._)("div",c,[(0,t.Wm)(w,{entity:l.value,loading:l.loading,error:l.error},null,8,["entity","loading","error"])]),(0,t._)("div",d,[(0,t._)("div",{class:"name",textContent:(0,s.zw)(l.value.name)},null,8,u)]),(0,t._)("div",{class:"col-s-4 col-m-3 value-container",onClick:e[0]||(e[0]=(0,i.iM)((e=>l.collapsed=!l.collapsed),["stop"]))},[null!=l.value?.value?((0,t.wg)(),(0,t.iD)("span",{key:0,class:"value",textContent:(0,s.zw)(l.value.value)},null,8,r)):(0,t.kq)("",!0)]),(0,t._)("div",{class:"col-1 collapse-toggler",onClick:e[1]||(e[1]=(0,i.iM)((e=>l.collapsed=!l.collapsed),["stop"]))},[(0,t._)("i",{class:(0,s.C_)(["fas",{"fa-chevron-down":l.collapsed,"fa-chevron-up":!l.collapsed}])},null,2)])],2),l.collapsed?(0,t.kq)("",!0):((0,t.wg)(),(0,t.iD)("div",{key:0,class:"body",onClick:e[4]||(e[4]=(0,i.iM)(((...e)=>l.prevent&&l.prevent(...e)),["stop"]))},[(0,t._)("div",v,[(0,t._)("form",{onSubmit:e[3]||(e[3]=(0,i.iM)(((...l)=>k.setValue&&k.setValue(...l)),["prevent"]))},[(0,t._)("div",p,[(0,t._)("div",f,[(0,t._)("input",{type:"text",value:l.value.value,placeholder:"Variable value",disabled:l.loading,ref:"text"},null,8,h)]),(0,t._)("div",_,[(0,t._)("button",{type:"button",title:"Clear",onClick:e[2]||(e[2]=(0,i.iM)(((...l)=>k.clearValue&&k.clearValue(...l)),["stop"])),disabled:l.loading},y,8,b),(0,t._)("button",{type:"submit",title:"Edit",disabled:l.loading},C,8,g)])])],32)])]))])):(0,t.kq)("",!0)}var V=a(7909),x=a(5017),q={name:"Variable",components:{EntityIcon:x["default"]},mixins:[V["default"]],data:function(){return{collapsed:!0}},computed:{isCollapsed(){return this.collapsed}},methods:{async clearValue(){this.$emit("loading",!0);try{await this.request("variable.unset",{name:this.value.name})}finally{this.$emit("loading",!1)}},async setValue(){const l=this.$refs.text.value;if(!l?.length)return await this.clearValue();this.$emit("loading",!0);try{const e={};e[this.value.name]=l,await this.request("variable.set",e)}finally{this.$emit("loading",!1)}}}},M=a(3744);const $=(0,M.Z)(q,[["render",w],["__scopeId","data-v-0f534cfd"]]);var D=$}}]);
//# sourceMappingURL=8358.c0dcf298.js.map