platypush/platypush/backend/http/webapp/dist/static/js/5210-legacy.e39ce8e4.js

2 lines
5.9 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[5210],{6:function(e,n,t){t.d(n,{Z:function(){return p}});var i=t(6252),o=t(3577),a=t(9963),s=function(e){return(0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e},c=["checked"],r=s((function(){return(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1)})),u={class:"label"};function l(e,n,t,s,l,d){return(0,i.wg)(),(0,i.iD)("div",{class:(0,o.C_)(["power-switch",{disabled:t.disabled}]),onClick:n[0]||(n[0]=(0,a.iM)((function(){return d.onInput&&d.onInput.apply(d,arguments)}),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:t.value},null,8,c),(0,i._)("label",null,[r,(0,i._)("span",u,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var d={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput:function(e){if(this.disabled)return!1;this.$emit("input",e)}}},f=t(3744);const v=(0,f.Z)(d,[["render",l],["__scopeId","data-v-a6396ae8"]]);var p=v},4004:function(e,n,t){t.d(n,{Z:function(){return c}});var i=t(8534),o=(t(1539),t(8309),t(5666),t(6813)),a={name:"SwitchesMixin",mixins:[o.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:function(){return{}}},selected:{type:Boolean,default:!1}},data:function(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent:function(e){e===this.pluginName&&this.refresh()},toggle:function(e,n){var t=this;return(0,i.Z)(regeneratorRuntime.mark((function i(){var o;return regeneratorRuntime.wrap((function(i){while(1)switch(i.prev=i.next){case 0:return null==n&&(n=e),i.next=3,t.request("".concat(t.pluginName,".toggle"),{device:n});case 3:o=i.sent,t.devices[e].on=o.on;case 5:case"end":return i.stop()}}),i)})))()},refresh:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.loading=!0,n.prev=1,n.next=4,e.request("".concat(e.pluginName,".switch_status"));case 4:e.devices=n.sent.reduce((function(e,n){var t,i=null!==(t=n.name)&&void 0!==t&&t.length?n.name:n.id;return e[i]=n,e}),{});case 5:return n.prev=5,e.loading=!1,n.finish(5);case 8:case"end":return n.stop()}}),n,null,[[1,,5,8]])})))()}},mounted:function(){var e=this;this.$watch((function(){return e.selected}),(function(n){n&&!e.initialized&&(e.refresh(),e.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted:function(){this.bus.off("refresh",this.onRefreshEvent)}};const s=a;var c=s},8671:function(e,n,t){t.d(n,{Z:function(){return m}});t(8309);var i=t(6252),o=t(9963),a=t(3577),s=function(e){return(0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e},c={class:"name col-l-10 col-m-9 col-s-8"},r=s((function(){return(0,i._)("i",{class:"fa fa-info"},null,-1)})),u=[r],l=["textContent"],d={class:"toggler col-l-2 col-m-3 col-s-4"};function f(e,n,t,s,r,f){var v=(0,i.up)("Loading"),p=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:n[1]||(n[1]=(0,o.iM)((function(){return f.onToggle&&f.onToggle.apply(f,arguments)}),["stop"]))},[t.loading?((0,i.wg)(),(0,i.j4)(v,{key:0})):(0,i.kq)("",!0),(0,i._)("div",c,[t.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:n[0]||(n[0]=(0,o.iM)((function(){return f.onInfo&&f.onInfo.apply(f,arguments)}),["prevent"]))},u)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,a.zw)(t.name)},null,8,l)]),(0,i._)("div",d,[(0,i.Wm)(p,{disabled:t.loading,value:t.state,onInput:f.onToggle},null,8,["disabled","value","onInput"])])])}var v=t(6),p=t(1232),g={name:"Switch",components:{Loading:p.Z,ToggleSwitch:v.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo:function(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle:function(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},h=t(3744);const w=(0,h.Z)(g,[["render",f],["__scopeId","data-v-38eb9831"]]);var m=w},5210:function(e,n,t){t.r(n),t.d(n,{default:function(){return x}});t(7941),t(8309);var i=t(6252),o=t(3577),a=function(e){return(0,i.dD)("data-v-5c936ba2"),e=e(),(0,i.Cn)(),e},s={class:"switches wemo-switches"},c={key:1,class:"no-content"},r={key:0,class:"switch-info"},u={class:"row"},l=a((function(){return(0,i._)("div",{class:"name"},"Name",-1)})),d=["textContent"],f={class:"row"},v=a((function(){return(0,i._)("div",{class:"name"},"On",-1)})),p=["textContent"],g={class:"row"},h=a((function(){return(0,i._)("div",{class:"name"},"IP",-1)})),w=["textContent"];function m(e,n,t,a,m,_){var y=(0,i.up)("Loading"),k=(0,i.up)("Switch"),b=(0,i.up)("Modal");return(0,i.wg)(),(0,i.iD)("div",s,[e.loading?((0,i.wg)(),(0,i.j4)(y,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",c,"No WeMo switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,(function(n,t){return(0,i.wg)(),(0,i.j4)(k,{loading:e.loading,name:t,state:n.on,onToggle:function(n){return e.toggle(t)},key:t,"has-info":!0,onInfo:function(n){e.selectedDevice=t,e.$refs.switchInfoModal.show()}},null,8,["loading","name","state","onToggle","onInfo"])})),128)),(0,i.Wm)(b,{title:"Device Info",ref:"switchInfoModal"},{default:(0,i.w5)((function(){return[e.selectedDevice?((0,i.wg)(),(0,i.iD)("div",r,[(0,i._)("div",u,[l,(0,i._)("div",{class:"value",textContent:(0,o.zw)(e.devices[e.selectedDevice].name)},null,8,d)]),(0,i._)("div",f,[v,(0,i._)("div",{class:"value",textContent:(0,o.zw)(e.devices[e.selectedDevice].on)},null,8,p)]),(0,i._)("div",g,[h,(0,i._)("div",{class:"value",textContent:(0,o.zw)(e.devices[e.selectedDevice].ip)},null,8,w)])])):(0,i.kq)("",!0)]})),_:1},512)])}var _=t(1232),y=t(4004),k=t(8671),b=t(8453),I={name:"SwitchWemo",components:{Modal:b.Z,Switch:k.Z,Loading:_.Z},mixins:[y.Z]},C=t(3744);const D=(0,C.Z)(I,[["render",m],["__scopeId","data-v-5c936ba2"]]);var x=D}}]);
//# sourceMappingURL=5210-legacy.e39ce8e4.js.map